@govtechsg/sgds-web-component 0.0.8 → 0.0.11
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/Button/index.js +304 -39
- package/Button/index.js.map +1 -1
- package/Button/sgds-button.d.ts +29 -4
- package/Card/index.d.ts +1 -0
- package/Card/index.js +6150 -0
- package/Card/index.js.map +1 -0
- package/Card/package.json +7 -0
- package/Card/sgds-action-card.d.ts +20 -0
- package/Checkbox/index.d.ts +1 -0
- package/Checkbox/index.js +6366 -0
- package/Checkbox/index.js.map +1 -0
- package/Checkbox/package.json +7 -0
- package/Checkbox/sgds-checkbox.d.ts +36 -0
- package/Dropdown/index.d.ts +3 -0
- package/Dropdown/index.js +13502 -0
- package/Dropdown/index.js.map +1 -0
- package/Dropdown/package.json +7 -0
- package/Dropdown/sgds-dropdown-item.d.ts +7 -0
- package/Dropdown/sgds-dropdown.d.ts +7 -0
- package/Footer/index.js +111 -95
- package/Footer/index.js.map +1 -1
- package/Footer/sgds-footer.d.ts +2 -2
- package/Input/index.d.ts +1 -0
- package/Input/index.js +6656 -0
- package/Input/index.js.map +1 -0
- package/Input/package.json +7 -0
- package/Input/sgds-input.d.ts +42 -0
- package/Mainnav/index.d.ts +1 -0
- package/Mainnav/index.js +14755 -2188
- package/Mainnav/index.js.map +1 -1
- package/Mainnav/sgds-mainnav-dropdown.d.ts +5 -0
- package/Mainnav/sgds-mainnav-item.d.ts +2 -5
- package/Mainnav/sgds-mainnav.d.ts +2 -2
- package/Masthead/index.js +140 -114
- package/Masthead/index.js.map +1 -1
- package/Masthead/sgds-masthead.d.ts +1 -1
- package/Modal/index.d.ts +1 -0
- package/Modal/index.js +6432 -0
- package/Modal/index.js.map +1 -0
- package/Modal/package.json +7 -0
- package/Modal/sgds-modal.d.ts +28 -0
- package/QuantityToggle/index.d.ts +1 -0
- package/QuantityToggle/index.js +7049 -0
- package/QuantityToggle/index.js.map +1 -0
- package/QuantityToggle/package.json +7 -0
- package/QuantityToggle/sgds-quantitytoggle.d.ts +30 -0
- package/Radio/index.d.ts +2 -0
- package/Radio/index.js +12607 -0
- package/Radio/index.js.map +1 -0
- package/Radio/package.json +7 -0
- package/Radio/sgds-radio.d.ts +31 -0
- package/Radio/sgds-radiogroup.d.ts +41 -0
- package/Sidenav/index.js +2266 -2171
- package/Sidenav/index.js.map +1 -1
- package/Sidenav/sgds-sidenav-item.d.ts +2 -1
- package/Sidenav/sgds-sidenav-link.d.ts +2 -5
- package/Sidenav/sgds-sidenav.d.ts +1 -1
- package/Tab/index.d.ts +3 -0
- package/Tab/index.js +13557 -0
- package/Tab/index.js.map +1 -0
- package/Tab/package.json +7 -0
- package/Tab/sgds-tab.d.ts +26 -0
- package/Tab/sgds-tabgroup.d.ts +47 -0
- package/Tab/sgds-tabpanel.d.ts +25 -0
- package/Textarea/index.d.ts +1 -0
- package/Textarea/index.js +6696 -0
- package/Textarea/index.js.map +1 -0
- package/Textarea/package.json +7 -0
- package/Textarea/sgds-textarea.d.ts +53 -0
- package/index.d.ts +16 -5
- package/index.js +100191 -17701
- package/index.js.map +1 -1
- package/package.json +2 -4
- package/umd/index.js +96696 -14206
- package/umd/index.js.map +1 -1
- package/utils/animate.d.ts +10 -0
- package/utils/animation-registry.d.ts +18 -0
- package/utils/card-element.d.ts +11 -0
- package/utils/defaultvalue.d.ts +2 -0
- package/utils/dropdown-element.d.ts +37 -0
- package/utils/event.d.ts +2 -0
- package/utils/form.d.ts +38 -0
- package/utils/link-element.d.ts +7 -0
- package/utils/mergeDeep.d.ts +2 -0
- package/utils/modal.d.ts +12 -0
- package/utils/object.d.ts +2 -0
- package/utils/offset.d.ts +4 -0
- package/utils/scroll.d.ts +13 -0
- package/utils/slot.d.ts +22 -0
- package/utils/tabbable.d.ts +8 -0
- package/utils/watch.d.ts +14 -0
package/Button/index.js
CHANGED
|
@@ -22,74 +22,237 @@ function __decorate(decorators, target, key, desc) {
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* @license
|
|
25
|
-
* Copyright
|
|
25
|
+
* Copyright 2017 Google LLC
|
|
26
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
|
+
*/
|
|
28
|
+
const e$7=e=>n=>"function"==typeof n?((e,n)=>(customElements.define(e,n),n))(e,n):((e,n)=>{const{kind:t,elements:s}=n;return {kind:t,elements:s,finisher(n){customElements.define(e,n);}}})(e,n);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @license
|
|
32
|
+
* Copyright 2017 Google LLC
|
|
26
33
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
34
|
*/
|
|
28
|
-
const
|
|
35
|
+
const i$6=(i,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(n){n.createProperty(e.key,i);}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this));},finisher(n){n.createProperty(e.key,i);}};function e$6(e){return (n,t)=>void 0!==t?((i,e,n)=>{e.constructor.createProperty(n,i);})(e,n,t):i$6(e,n)}
|
|
29
36
|
|
|
30
37
|
/**
|
|
31
38
|
* @license
|
|
32
39
|
* Copyright 2017 Google LLC
|
|
33
40
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*/
|
|
41
|
+
*/function t$4(t){return e$6({...t,state:!0})}
|
|
35
42
|
|
|
36
43
|
/**
|
|
37
44
|
* @license
|
|
38
45
|
* Copyright 2017 Google LLC
|
|
39
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
40
47
|
*/
|
|
41
|
-
|
|
48
|
+
const o$6=({finisher:e,descriptor:t})=>(o,n)=>{var r;if(void 0===n){const n=null!==(r=o.originalKey)&&void 0!==r?r:o.key,i=null!=t?{kind:"method",placement:"prototype",key:n,descriptor:t(o.key)}:{...o,key:n};return null!=e&&(i.finisher=function(t){e(t,n);}),i}{const r=o.constructor;void 0!==t&&Object.defineProperty(o,n,t(n)),null==e||e(r,n);}};
|
|
42
49
|
|
|
43
50
|
/**
|
|
44
51
|
* @license
|
|
45
52
|
* Copyright 2017 Google LLC
|
|
46
53
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
|
-
*/
|
|
54
|
+
*/function i$5(i,n){return o$6({descriptor:o=>{const t={get(){var o,n;return null!==(n=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(i))&&void 0!==n?n:null},enumerable:!0,configurable:!0};if(n){const n="symbol"==typeof o?Symbol():"__"+o;t.get=function(){var o,t;return void 0===this[n]&&(this[n]=null!==(t=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(i))&&void 0!==t?t:null),this[n]};}return t}})}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @license
|
|
58
|
+
* Copyright 2021 Google LLC
|
|
59
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
60
|
+
*/var n$6;null!=(null===(n$6=window.HTMLSlotElement)||void 0===n$6?void 0:n$6.prototype.assignedElements)?(o,n)=>o.assignedElements(n):(o,n)=>o.assignedNodes(n).filter((o=>o.nodeType===Node.ELEMENT_NODE));
|
|
48
61
|
|
|
49
62
|
/**
|
|
50
63
|
* @license
|
|
51
64
|
* Copyright 2017 Google LLC
|
|
52
65
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
53
66
|
*/
|
|
54
|
-
const e$
|
|
67
|
+
var t$3;const i$4=window,s$5=i$4.trustedTypes,e$5=s$5?s$5.createPolicy("lit-html",{createHTML:t=>t}):void 0,o$5=`lit$${(Math.random()+"").slice(9)}$`,n$5="?"+o$5,l$5=`<${n$5}>`,h$2=document,r$3=(t="")=>h$2.createComment(t),d$2=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u$1=Array.isArray,c$2=t=>u$1(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),v$1=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,a$3=/-->/g,f$1=/>/g,_$1=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),m$1=/'/g,p$1=/"/g,$$1=/^(?:script|style|textarea|title)$/i,g=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),y=g(1),x$1=Symbol.for("lit-noChange"),b$1=Symbol.for("lit-nothing"),T$1=new WeakMap,A$1=h$2.createTreeWalker(h$2,129,null,!1),E$1=(t,i)=>{const s=t.length-1,n=[];let h,r=2===i?"<svg>":"",d=v$1;for(let i=0;i<s;i++){const s=t[i];let e,u,c=-1,g=0;for(;g<s.length&&(d.lastIndex=g,u=d.exec(s),null!==u);)g=d.lastIndex,d===v$1?"!--"===u[1]?d=a$3:void 0!==u[1]?d=f$1:void 0!==u[2]?($$1.test(u[2])&&(h=RegExp("</"+u[2],"g")),d=_$1):void 0!==u[3]&&(d=_$1):d===_$1?">"===u[0]?(d=null!=h?h:v$1,c=-1):void 0===u[1]?c=-2:(c=d.lastIndex-u[2].length,e=u[1],d=void 0===u[3]?_$1:'"'===u[3]?p$1:m$1):d===p$1||d===m$1?d=_$1:d===a$3||d===f$1?d=v$1:(d=_$1,h=void 0);const y=d===_$1&&t[i+1].startsWith("/>")?" ":"";r+=d===v$1?s+l$5:c>=0?(n.push(e),s.slice(0,c)+"$lit$"+s.slice(c)+o$5+y):s+o$5+(-2===c?(n.push(void 0),i):y);}const u=r+(t[s]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return [void 0!==e$5?e$5.createHTML(u):u,n]};class C$1{constructor({strings:t,_$litType$:i},e){let l;this.parts=[];let h=0,d=0;const u=t.length-1,c=this.parts,[v,a]=E$1(t,i);if(this.el=C$1.createElement(v,e),A$1.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes);}for(;null!==(l=A$1.nextNode())&&c.length<u;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const i of l.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(o$5)){const s=a[d++];if(t.push(i),void 0!==s){const t=l.getAttribute(s.toLowerCase()+"$lit$").split(o$5),i=/([.?@])?(.*)/.exec(s);c.push({type:1,index:h,name:i[2],strings:t,ctor:"."===i[1]?M$1:"?"===i[1]?k$1:"@"===i[1]?H$1:S$2});}else c.push({type:6,index:h});}for(const i of t)l.removeAttribute(i);}if($$1.test(l.tagName)){const t=l.textContent.split(o$5),i=t.length-1;if(i>0){l.textContent=s$5?s$5.emptyScript:"";for(let s=0;s<i;s++)l.append(t[s],r$3()),A$1.nextNode(),c.push({type:2,index:++h});l.append(t[i],r$3());}}}else if(8===l.nodeType)if(l.data===n$5)c.push({type:2,index:h});else {let t=-1;for(;-1!==(t=l.data.indexOf(o$5,t+1));)c.push({type:7,index:h}),t+=o$5.length-1;}h++;}}static createElement(t,i){const s=h$2.createElement("template");return s.innerHTML=t,s}}function P$1(t,i,s=t,e){var o,n,l,h;if(i===x$1)return i;let r=void 0!==e?null===(o=s._$Co)||void 0===o?void 0:o[e]:s._$Cl;const u=d$2(i)?void 0:i._$litDirective$;return (null==r?void 0:r.constructor)!==u&&(null===(n=null==r?void 0:r._$AO)||void 0===n||n.call(r,!1),void 0===u?r=void 0:(r=new u(t),r._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Co)&&void 0!==l?l:h._$Co=[])[e]=r:s._$Cl=r),void 0!==r&&(i=P$1(t,r._$AS(t,i.values),r,e)),i}class V$1{constructor(t,i){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:h$2).importNode(s,!0);A$1.currentNode=o;let n=A$1.nextNode(),l=0,r=0,d=e[0];for(;void 0!==d;){if(l===d.index){let i;2===d.type?i=new N$1(n,n.nextSibling,this,t):1===d.type?i=new d.ctor(n,d.name,d.strings,this,t):6===d.type&&(i=new I$1(n,this,t)),this.u.push(i),d=e[++r];}l!==(null==d?void 0:d.index)&&(n=A$1.nextNode(),l++);}return o}p(t){let i=0;for(const s of this.u)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class N$1{constructor(t,i,s,e){var o;this.type=2,this._$AH=b$1,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cm=null===(o=null==e?void 0:e.isConnected)||void 0===o||o;}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=P$1(this,t,i),d$2(t)?t===b$1||null==t||""===t?(this._$AH!==b$1&&this._$AR(),this._$AH=b$1):t!==this._$AH&&t!==x$1&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):c$2(t)?this.k(t):this.g(t);}O(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}g(t){this._$AH!==b$1&&d$2(this._$AH)?this._$AA.nextSibling.data=t:this.T(h$2.createTextNode(t)),this._$AH=t;}$(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=C$1.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.p(s);else {const t=new V$1(o,this),i=t.v(this.options);t.p(s),this.T(i),this._$AH=t;}}_$AC(t){let i=T$1.get(t.strings);return void 0===i&&T$1.set(t.strings,i=new C$1(t)),i}k(t){u$1(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new N$1(this.O(r$3()),this.O(r$3()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){var i;void 0===this._$AM&&(this._$Cm=t,null===(i=this._$AP)||void 0===i||i.call(this,t));}}class S$2{constructor(t,i,s,e,o){this.type=1,this._$AH=b$1,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=b$1;}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=P$1(this,t,i,0),n=!d$2(t)||t!==this._$AH&&t!==x$1,n&&(this._$AH=t);else {const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=P$1(this,e[s+l],i,l),h===x$1&&(h=this._$AH[l]),n||(n=!d$2(h)||h!==this._$AH[l]),h===b$1?t=b$1:t!==b$1&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h;}n&&!e&&this.j(t);}j(t){t===b$1?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"");}}class M$1 extends S$2{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===b$1?void 0:t;}}const R$1=s$5?s$5.emptyScript:"";class k$1 extends S$2{constructor(){super(...arguments),this.type=4;}j(t){t&&t!==b$1?this.element.setAttribute(this.name,R$1):this.element.removeAttribute(this.name);}}class H$1 extends S$2{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5;}_$AI(t,i=this){var s;if((t=null!==(s=P$1(this,t,i,0))&&void 0!==s?s:b$1)===x$1)return;const e=this._$AH,o=t===b$1&&e!==b$1||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==b$1&&(e===b$1||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t);}}class I$1{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){P$1(this,t);}}const z$1=i$4.litHtmlPolyfillSupport;null==z$1||z$1(C$1,N$1),(null!==(t$3=i$4.litHtmlVersions)&&void 0!==t$3?t$3:i$4.litHtmlVersions=[]).push("2.6.1");
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @license
|
|
71
|
+
* Copyright 2020 Google LLC
|
|
72
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
73
|
+
*/const e$4=Symbol.for(""),l$4=t=>{if((null==t?void 0:t.r)===e$4)return null==t?void 0:t._$litStatic$},i$3=(t,...r)=>({_$litStatic$:r.reduce(((r,e,l)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(e)+t[l+1]),t[0]),r:e$4}),s$4=new Map,a$2=t=>(r,...e)=>{const o=e.length;let i,a;const n=[],u=[];let c,$=0,f=!1;for(;$<o;){for(c=r[$];$<o&&void 0!==(a=e[$],i=l$4(a));)c+=i+r[++$],f=!0;u.push(a),n.push(c),$++;}if($===o&&n.push(r[o]),f){const t=n.join("$$lit$$");void 0===(r=s$4.get(t))&&(n.raw=n,s$4.set(t,r=n)),e=u;}return t(r,...e)},n$4=a$2(y);
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @license
|
|
77
|
+
* Copyright 2018 Google LLC
|
|
78
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
79
|
+
*/const l$3=l=>null!=l?l:b$1;
|
|
55
80
|
|
|
56
81
|
/**
|
|
57
82
|
* @license
|
|
58
83
|
* Copyright 2017 Google LLC
|
|
59
84
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
60
85
|
*/
|
|
61
|
-
const
|
|
86
|
+
const t$2={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$3=t=>(...e)=>({_$litDirective$:t,values:e});class i$2{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
62
87
|
|
|
63
88
|
/**
|
|
64
89
|
* @license
|
|
65
|
-
* Copyright
|
|
90
|
+
* Copyright 2018 Google LLC
|
|
66
91
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
67
|
-
*/var
|
|
92
|
+
*/const o$4=e$3(class extends i$2{constructor(t){var i;if(super(t),t.type!==t$2.ATTRIBUTE||"class"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((i=>t[i])).join(" ")+" "}update(i,[s]){var r,o;if(void 0===this.nt){this.nt=new Set,void 0!==i.strings&&(this.st=new Set(i.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in s)s[t]&&!(null===(r=this.st)||void 0===r?void 0:r.has(t))&&this.nt.add(t);return this.render(s)}const e=i.element.classList;this.nt.forEach((t=>{t in s||(e.remove(t),this.nt.delete(t));}));for(const t in s){const i=!!s[t];i===this.nt.has(t)||(null===(o=this.st)||void 0===o?void 0:o.has(t))||(i?(e.add(t),this.nt.add(t)):(e.remove(t),this.nt.delete(t)));}return x$1}});
|
|
93
|
+
|
|
94
|
+
const reportValidityOverloads = new WeakMap();
|
|
95
|
+
class FormSubmitController {
|
|
96
|
+
constructor(host, options) {
|
|
97
|
+
(this.host = host).addController(this);
|
|
98
|
+
this.options = Object.assign({ form: (input) => input.closest('form'), name: (input) => input.name, value: (input) => input.value, defaultValue: (input) => input.defaultValue, disabled: (input) => input.disabled, reportValidity: (input) => {
|
|
99
|
+
return typeof input.reportValidity === 'function' ? input.reportValidity() : true;
|
|
100
|
+
}, setValue: (input, value) => {
|
|
101
|
+
input.value = value;
|
|
102
|
+
} }, options);
|
|
103
|
+
this.handleFormData = this.handleFormData.bind(this);
|
|
104
|
+
this.handleFormSubmit = this.handleFormSubmit.bind(this);
|
|
105
|
+
this.handleFormReset = this.handleFormReset.bind(this);
|
|
106
|
+
this.reportFormValidity = this.reportFormValidity.bind(this);
|
|
107
|
+
}
|
|
108
|
+
hostConnected() {
|
|
109
|
+
this.form = this.options.form(this.host);
|
|
110
|
+
if (this.form) {
|
|
111
|
+
this.form.addEventListener('formdata', this.handleFormData);
|
|
112
|
+
this.form.addEventListener('submit', this.handleFormSubmit);
|
|
113
|
+
this.form.addEventListener('reset', this.handleFormReset);
|
|
114
|
+
// Overload the form's reportValidity() method so it looks at Shoelace form controls
|
|
115
|
+
if (!reportValidityOverloads.has(this.form)) {
|
|
116
|
+
reportValidityOverloads.set(this.form, this.form.reportValidity);
|
|
117
|
+
this.form.reportValidity = () => this.reportFormValidity();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
hostDisconnected() {
|
|
122
|
+
if (this.form) {
|
|
123
|
+
this.form.removeEventListener('formdata', this.handleFormData);
|
|
124
|
+
this.form.removeEventListener('submit', this.handleFormSubmit);
|
|
125
|
+
this.form.removeEventListener('reset', this.handleFormReset);
|
|
126
|
+
// Remove the overload and restore the original method
|
|
127
|
+
if (reportValidityOverloads.has(this.form)) {
|
|
128
|
+
this.form.reportValidity = reportValidityOverloads.get(this.form);
|
|
129
|
+
reportValidityOverloads.delete(this.form);
|
|
130
|
+
}
|
|
131
|
+
this.form = undefined;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
handleFormData(event) {
|
|
135
|
+
const disabled = this.options.disabled(this.host);
|
|
136
|
+
const name = this.options.name(this.host);
|
|
137
|
+
const value = this.options.value(this.host);
|
|
138
|
+
if (!disabled && typeof name === 'string' && typeof value !== 'undefined') {
|
|
139
|
+
if (Array.isArray(value)) {
|
|
140
|
+
value.forEach(val => {
|
|
141
|
+
event.formData.append(name, val.toString());
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
event.formData.append(name, value.toString());
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
handleFormSubmit(event) {
|
|
150
|
+
const disabled = this.options.disabled(this.host);
|
|
151
|
+
const reportValidity = this.options.reportValidity;
|
|
152
|
+
if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {
|
|
153
|
+
event.preventDefault();
|
|
154
|
+
event.stopImmediatePropagation();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
handleFormReset() {
|
|
158
|
+
this.options.setValue(this.host, this.options.defaultValue(this.host));
|
|
159
|
+
}
|
|
160
|
+
reportFormValidity() {
|
|
161
|
+
//
|
|
162
|
+
// Shoelace form controls work hard to act like regular form controls. They support the Constraint Validation API
|
|
163
|
+
// and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also
|
|
164
|
+
// has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using
|
|
165
|
+
// ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.
|
|
166
|
+
//
|
|
167
|
+
// We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger
|
|
168
|
+
// validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't
|
|
169
|
+
// be necessary once we can use ElementInternals.
|
|
170
|
+
//
|
|
171
|
+
// Note that we're also honoring the form's novalidate attribute.
|
|
172
|
+
//
|
|
173
|
+
if (this.form && !this.form.noValidate) {
|
|
174
|
+
// This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom
|
|
175
|
+
// elements that support the constraint validation API.
|
|
176
|
+
const elements = this.form.querySelectorAll('*');
|
|
177
|
+
for (const element of elements) {
|
|
178
|
+
if (typeof element.reportValidity === 'function') {
|
|
179
|
+
if (!element.reportValidity()) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
doAction(type, invoker) {
|
|
188
|
+
if (this.form) {
|
|
189
|
+
const button = document.createElement('button');
|
|
190
|
+
button.type = type;
|
|
191
|
+
button.style.position = 'absolute';
|
|
192
|
+
button.style.width = '0';
|
|
193
|
+
button.style.height = '0';
|
|
194
|
+
button.style.clipPath = 'inset(50%)';
|
|
195
|
+
button.style.overflow = 'hidden';
|
|
196
|
+
button.style.whiteSpace = 'nowrap';
|
|
197
|
+
// Pass form attributes through to the temporary button
|
|
198
|
+
if (invoker) {
|
|
199
|
+
['formaction', 'formmethod', 'formnovalidate', 'formtarget'].forEach(attr => {
|
|
200
|
+
if (invoker.hasAttribute(attr)) {
|
|
201
|
+
button.setAttribute(attr, invoker.getAttribute(attr));
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
this.form.append(button);
|
|
206
|
+
button.click();
|
|
207
|
+
button.remove();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/** Resets the form, restoring all the control to their default value */
|
|
211
|
+
reset(invoker) {
|
|
212
|
+
this.doAction('reset', invoker);
|
|
213
|
+
}
|
|
214
|
+
/** Submits the form, triggering validation and form data injection. */
|
|
215
|
+
submit(invoker) {
|
|
216
|
+
// Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a
|
|
217
|
+
// native submit button into the form, "click" it, then remove it to simulate a standard form submission.
|
|
218
|
+
this.doAction('submit', invoker);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
68
221
|
|
|
69
222
|
/**
|
|
70
223
|
* @license
|
|
71
|
-
* Copyright
|
|
224
|
+
* Copyright 2019 Google LLC
|
|
72
225
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
73
|
-
*/
|
|
226
|
+
*/
|
|
227
|
+
const t$1=window,e$2=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$3=Symbol(),n$3=new WeakMap;class o$3{constructor(t,e,n){if(this._$cssResult$=!0,n!==s$3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$2&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=n$3.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n$3.set(s,t));}return t}toString(){return this.cssText}}const r$2=t=>new o$3("string"==typeof t?t:t+"",void 0,s$3),i$1=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,s,n)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[n+1]),t[0]);return new o$3(n,t,s$3)},S$1=(s,n)=>{e$2?s.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((e=>{const n=document.createElement("style"),o=t$1.litNonce;void 0!==o&&n.setAttribute("nonce",o),n.textContent=e.cssText,s.appendChild(n);}));},c$1=e$2?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
|
|
74
228
|
|
|
75
229
|
/**
|
|
76
230
|
* @license
|
|
77
|
-
* Copyright
|
|
231
|
+
* Copyright 2017 Google LLC
|
|
78
232
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
79
|
-
*/const l=l=>null
|
|
233
|
+
*/var s$2;const e$1=window,r$1=e$1.trustedTypes,h$1=r$1?r$1.emptyScript:"",o$2=e$1.reactiveElementPolyfillSupport,n$2={toAttribute(t,i){switch(i){case Boolean:t=t?h$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t);}catch(t){s=null;}}return s}},a$1=(t,i)=>i!==t&&(i==i||t==t),l$2={attribute:!0,type:String,converter:n$2,reflect:!1,hasChanged:a$1};class d$1 extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u();}static addInitializer(t){var i;this.finalize(),(null!==(i=this.h)&&void 0!==i?i:this.h=[]).push(t);}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,s)=>{const e=this._$Ep(s,i);void 0!==e&&(this._$Ev.set(e,s),t.push(e));})),t}static createProperty(t,i=l$2){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const s="symbol"==typeof t?Symbol():"__"+t,e=this.getPropertyDescriptor(t,s,i);void 0!==e&&Object.defineProperty(this.prototype,t,e);}}static getPropertyDescriptor(t,i,s){return {get(){return this[i]},set(e){const r=this[t];this[i]=e,this.requestUpdate(t,r,s);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||l$2}static finalize(){if(this.hasOwnProperty("finalized"))return !1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of i)this.createProperty(s,t[s]);}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(i){const s=[];if(Array.isArray(i)){const e=new Set(i.flat(1/0).reverse());for(const i of e)s.unshift(c$1(i));}else void 0!==i&&s.push(c$1(i));return s}static _$Ep(t,i){const s=i.attribute;return !1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}u(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)));}addController(t){var i,s;(null!==(i=this._$ES)&&void 0!==i?i:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t));}removeController(t){var i;null===(i=this._$ES)||void 0===i||i.splice(this._$ES.indexOf(t)>>>0,1);}_$Eg(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Ei.set(i,this[i]),delete this[i]);}));}createRenderRoot(){var t;const s=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return S$1(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}));}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}));}attributeChangedCallback(t,i,s){this._$AK(t,s);}_$EO(t,i,s=l$2){var e;const r=this.constructor._$Ep(t,s);if(void 0!==r&&!0===s.reflect){const h=(void 0!==(null===(e=s.converter)||void 0===e?void 0:e.toAttribute)?s.converter:n$2).toAttribute(i,s.type);this._$El=t,null==h?this.removeAttribute(r):this.setAttribute(r,h),this._$El=null;}}_$AK(t,i){var s;const e=this.constructor,r=e._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=e.getPropertyOptions(r),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(s=t.converter)||void 0===s?void 0:s.fromAttribute)?t.converter:n$2;this._$El=r,this[r]=h.fromAttribute(i,t.type),this._$El=null;}}requestUpdate(t,i,s){let e=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||a$1)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===s.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):e=!1),!this.isUpdatePending&&e&&(this._$E_=this._$Ej());}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,i)=>this[i]=t)),this._$Ei=void 0);let i=!1;const s=this._$AL;try{i=this.shouldUpdate(s),i?(this.willUpdate(s),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(s)):this._$Ek();}catch(t){throw i=!1,this._$Ek(),t}i&&this._$AE(s);}willUpdate(t){}_$AE(t){var i;null===(i=this._$ES)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return !0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,i)=>this._$EO(i,this[i],t))),this._$EC=void 0),this._$Ek();}updated(t){}firstUpdated(t){}}d$1.finalized=!0,d$1.elementProperties=new Map,d$1.elementStyles=[],d$1.shadowRootOptions={mode:"open"},null==o$2||o$2({ReactiveElement:d$1}),(null!==(s$2=e$1.reactiveElementVersions)&&void 0!==s$2?s$2:e$1.reactiveElementVersions=[]).push("1.6.1");
|
|
80
234
|
|
|
81
235
|
/**
|
|
82
236
|
* @license
|
|
83
237
|
* Copyright 2017 Google LLC
|
|
84
238
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
85
239
|
*/
|
|
86
|
-
const t={
|
|
240
|
+
var t;const i=window,s$1=i.trustedTypes,e=s$1?s$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,o$1=`lit$${(Math.random()+"").slice(9)}$`,n$1="?"+o$1,l$1=`<${n$1}>`,h=document,r=(t="")=>h.createComment(t),d=t=>null===t||"object"!=typeof t&&"function"!=typeof t,u=Array.isArray,c=t=>u(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,a=/-->/g,f=/>/g,_=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),m=/'/g,p=/"/g,$=/^(?:script|style|textarea|title)$/i,x=Symbol.for("lit-noChange"),b=Symbol.for("lit-nothing"),T=new WeakMap,A=h.createTreeWalker(h,129,null,!1),E=(t,i)=>{const s=t.length-1,n=[];let h,r=2===i?"<svg>":"",d=v;for(let i=0;i<s;i++){const s=t[i];let e,u,c=-1,g=0;for(;g<s.length&&(d.lastIndex=g,u=d.exec(s),null!==u);)g=d.lastIndex,d===v?"!--"===u[1]?d=a:void 0!==u[1]?d=f:void 0!==u[2]?($.test(u[2])&&(h=RegExp("</"+u[2],"g")),d=_):void 0!==u[3]&&(d=_):d===_?">"===u[0]?(d=null!=h?h:v,c=-1):void 0===u[1]?c=-2:(c=d.lastIndex-u[2].length,e=u[1],d=void 0===u[3]?_:'"'===u[3]?p:m):d===p||d===m?d=_:d===a||d===f?d=v:(d=_,h=void 0);const y=d===_&&t[i+1].startsWith("/>")?" ":"";r+=d===v?s+l$1:c>=0?(n.push(e),s.slice(0,c)+"$lit$"+s.slice(c)+o$1+y):s+o$1+(-2===c?(n.push(void 0),i):y);}const u=r+(t[s]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return [void 0!==e?e.createHTML(u):u,n]};class C{constructor({strings:t,_$litType$:i},e){let l;this.parts=[];let h=0,d=0;const u=t.length-1,c=this.parts,[v,a]=E(t,i);if(this.el=C.createElement(v,e),A.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes);}for(;null!==(l=A.nextNode())&&c.length<u;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const i of l.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(o$1)){const s=a[d++];if(t.push(i),void 0!==s){const t=l.getAttribute(s.toLowerCase()+"$lit$").split(o$1),i=/([.?@])?(.*)/.exec(s);c.push({type:1,index:h,name:i[2],strings:t,ctor:"."===i[1]?M:"?"===i[1]?k:"@"===i[1]?H:S});}else c.push({type:6,index:h});}for(const i of t)l.removeAttribute(i);}if($.test(l.tagName)){const t=l.textContent.split(o$1),i=t.length-1;if(i>0){l.textContent=s$1?s$1.emptyScript:"";for(let s=0;s<i;s++)l.append(t[s],r()),A.nextNode(),c.push({type:2,index:++h});l.append(t[i],r());}}}else if(8===l.nodeType)if(l.data===n$1)c.push({type:2,index:h});else {let t=-1;for(;-1!==(t=l.data.indexOf(o$1,t+1));)c.push({type:7,index:h}),t+=o$1.length-1;}h++;}}static createElement(t,i){const s=h.createElement("template");return s.innerHTML=t,s}}function P(t,i,s=t,e){var o,n,l,h;if(i===x)return i;let r=void 0!==e?null===(o=s._$Co)||void 0===o?void 0:o[e]:s._$Cl;const u=d(i)?void 0:i._$litDirective$;return (null==r?void 0:r.constructor)!==u&&(null===(n=null==r?void 0:r._$AO)||void 0===n||n.call(r,!1),void 0===u?r=void 0:(r=new u(t),r._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Co)&&void 0!==l?l:h._$Co=[])[e]=r:s._$Cl=r),void 0!==r&&(i=P(t,r._$AS(t,i.values),r,e)),i}class V{constructor(t,i){this.u=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:h).importNode(s,!0);A.currentNode=o;let n=A.nextNode(),l=0,r=0,d=e[0];for(;void 0!==d;){if(l===d.index){let i;2===d.type?i=new N(n,n.nextSibling,this,t):1===d.type?i=new d.ctor(n,d.name,d.strings,this,t):6===d.type&&(i=new I(n,this,t)),this.u.push(i),d=e[++r];}l!==(null==d?void 0:d.index)&&(n=A.nextNode(),l++);}return o}p(t){let i=0;for(const s of this.u)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class N{constructor(t,i,s,e){var o;this.type=2,this._$AH=b,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cm=null===(o=null==e?void 0:e.isConnected)||void 0===o||o;}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cm}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=P(this,t,i),d(t)?t===b||null==t||""===t?(this._$AH!==b&&this._$AR(),this._$AH=b):t!==this._$AH&&t!==x&&this.g(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):c(t)?this.k(t):this.g(t);}O(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}g(t){this._$AH!==b&&d(this._$AH)?this._$AA.nextSibling.data=t:this.T(h.createTextNode(t)),this._$AH=t;}$(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=C.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.p(s);else {const t=new V(o,this),i=t.v(this.options);t.p(s),this.T(i),this._$AH=t;}}_$AC(t){let i=T.get(t.strings);return void 0===i&&T.set(t.strings,i=new C(t)),i}k(t){u(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new N(this.O(r()),this.O(r()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){var i;void 0===this._$AM&&(this._$Cm=t,null===(i=this._$AP)||void 0===i||i.call(this,t));}}class S{constructor(t,i,s,e,o){this.type=1,this._$AH=b,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=b;}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=P(this,t,i,0),n=!d(t)||t!==this._$AH&&t!==x,n&&(this._$AH=t);else {const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=P(this,e[s+l],i,l),h===x&&(h=this._$AH[l]),n||(n=!d(h)||h!==this._$AH[l]),h===b?t=b:t!==b&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h;}n&&!e&&this.j(t);}j(t){t===b?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"");}}class M extends S{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===b?void 0:t;}}const R=s$1?s$1.emptyScript:"";class k extends S{constructor(){super(...arguments),this.type=4;}j(t){t&&t!==b?this.element.setAttribute(this.name,R):this.element.removeAttribute(this.name);}}class H extends S{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5;}_$AI(t,i=this){var s;if((t=null!==(s=P(this,t,i,0))&&void 0!==s?s:b)===x)return;const e=this._$AH,o=t===b&&e!==b||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==b&&(e===b||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t);}}class I{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){P(this,t);}}const z=i.litHtmlPolyfillSupport;null==z||z(C,N),(null!==(t=i.litHtmlVersions)&&void 0!==t?t:i.litHtmlVersions=[]).push("2.6.1");const Z=(t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new N(i.insertBefore(r(),t),t,void 0,null!=s?s:{});}return l._$AI(t),l};
|
|
87
241
|
|
|
88
242
|
/**
|
|
89
243
|
* @license
|
|
90
|
-
* Copyright
|
|
244
|
+
* Copyright 2017 Google LLC
|
|
91
245
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
92
|
-
*/
|
|
246
|
+
*/var l,o;class s extends d$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Z(i,this.renderRoot,this.renderOptions);}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0);}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1);}render(){return x}}s.finalized=!0,s._$litElement$=!0,null===(l=globalThis.litElementHydrateSupport)||void 0===l||l.call(globalThis,{LitElement:s});const n=globalThis.litElementPolyfillSupport;null==n||n({LitElement:s});(null!==(o=globalThis.litElementVersions)&&void 0!==o?o:globalThis.litElementVersions=[]).push("3.2.2");
|
|
247
|
+
|
|
248
|
+
class SgdsElement extends s {
|
|
249
|
+
/** Emits a custom event with more convenient defaults. */
|
|
250
|
+
emit(name, options) {
|
|
251
|
+
const event = new CustomEvent(name, Object.assign({ bubbles: true, cancelable: false, composed: true, detail: {} }, options));
|
|
252
|
+
this.dispatchEvent(event);
|
|
253
|
+
return event;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
93
256
|
|
|
94
257
|
/**
|
|
95
258
|
* @license
|
|
@@ -97,7 +260,7 @@ const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e
|
|
|
97
260
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
98
261
|
*/console.warn("The main 'lit-element' module entrypoint is deprecated. Please update your imports to use the 'lit' package: 'lit' and 'lit/decorators.ts' or import from 'lit-element/lit-element.ts'. See https://lit.dev/msg/deprecated-import-path for more information.");
|
|
99
262
|
|
|
100
|
-
var css_248z = i$
|
|
263
|
+
var css_248z = i$1`@charset "UTF-8";
|
|
101
264
|
:root {
|
|
102
265
|
--sgds-blue: #1f69ff;
|
|
103
266
|
--sgds-purple: #5925DC;
|
|
@@ -152,6 +315,15 @@ var css_248z = i$4`@charset "UTF-8";
|
|
|
152
315
|
:root {
|
|
153
316
|
--sgds-gutter-x: 1.5rem;
|
|
154
317
|
}
|
|
318
|
+
@media (min-width: 992px) {
|
|
319
|
+
:root {
|
|
320
|
+
--section-padding: 3rem 1.5rem;
|
|
321
|
+
--section-padding-xs: 1rem 1.5rem;
|
|
322
|
+
--section-padding-sm: 1.5rem 1.5rem;
|
|
323
|
+
--section-padding-lg: 9rem 1.5rem;
|
|
324
|
+
--section-padding-xl: 18rem 1.5rem;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
155
327
|
|
|
156
328
|
*,
|
|
157
329
|
*::before,
|
|
@@ -6293,11 +6465,47 @@ a[target=_blank]:after {
|
|
|
6293
6465
|
.btn-group-vertical > .btn-group:not(:first-child) > .btn {
|
|
6294
6466
|
border-top-left-radius: 0;
|
|
6295
6467
|
border-top-right-radius: 0;
|
|
6468
|
+
}
|
|
6469
|
+
|
|
6470
|
+
:host {
|
|
6471
|
+
display: inline-block;
|
|
6472
|
+
}
|
|
6473
|
+
|
|
6474
|
+
.btn-icon {
|
|
6475
|
+
background: transparent;
|
|
6476
|
+
border: 0;
|
|
6477
|
+
}
|
|
6478
|
+
.btn-icon:hover {
|
|
6479
|
+
background: transparent;
|
|
6480
|
+
}
|
|
6481
|
+
|
|
6482
|
+
:host(.button-group_button-first) .btn {
|
|
6483
|
+
border-start-end-radius: 0;
|
|
6484
|
+
border-end-end-radius: 0;
|
|
6485
|
+
}
|
|
6486
|
+
|
|
6487
|
+
:host(.button-group_button-last) .btn {
|
|
6488
|
+
border-start-start-radius: 0;
|
|
6489
|
+
border-end-start-radius: 0;
|
|
6296
6490
|
}`;
|
|
6297
6491
|
|
|
6298
|
-
let SgdsButton = class SgdsButton extends
|
|
6492
|
+
let SgdsButton = class SgdsButton extends SgdsElement {
|
|
6299
6493
|
constructor() {
|
|
6300
6494
|
super(...arguments);
|
|
6495
|
+
this.formSubmitController = new FormSubmitController(this, {
|
|
6496
|
+
form: (input) => {
|
|
6497
|
+
// Buttons support a form attribute that points to an arbitrary form, so if this attribute it set we need to query
|
|
6498
|
+
// the form from the same root using its id
|
|
6499
|
+
if (input.hasAttribute('form')) {
|
|
6500
|
+
const doc = input.getRootNode();
|
|
6501
|
+
const formId = input.getAttribute('form');
|
|
6502
|
+
return doc.getElementById(formId);
|
|
6503
|
+
}
|
|
6504
|
+
// Fall back to the closest containing form
|
|
6505
|
+
return input.closest('form');
|
|
6506
|
+
}
|
|
6507
|
+
});
|
|
6508
|
+
this.hasFocus = false;
|
|
6301
6509
|
/** The button's variant. */
|
|
6302
6510
|
this.variant = "primary";
|
|
6303
6511
|
/** Button active state */
|
|
@@ -6306,63 +6514,120 @@ let SgdsButton = class SgdsButton extends s$1 {
|
|
|
6306
6514
|
this.disabled = false;
|
|
6307
6515
|
this.type = 'button';
|
|
6308
6516
|
}
|
|
6517
|
+
/** Sets focus on the button. */
|
|
6518
|
+
focus(options) {
|
|
6519
|
+
this.button.focus(options);
|
|
6520
|
+
}
|
|
6521
|
+
/** Simulates a click on the button. */
|
|
6522
|
+
click() {
|
|
6523
|
+
this.button.click();
|
|
6524
|
+
}
|
|
6525
|
+
/** Removes focus from the button. */
|
|
6526
|
+
blur() {
|
|
6527
|
+
this.button.blur();
|
|
6528
|
+
}
|
|
6529
|
+
handleBlur() {
|
|
6530
|
+
this.hasFocus = false;
|
|
6531
|
+
this.emit('sgds-blur');
|
|
6532
|
+
}
|
|
6533
|
+
handleFocus() {
|
|
6534
|
+
this.hasFocus = true;
|
|
6535
|
+
this.emit('sgds-focus');
|
|
6536
|
+
}
|
|
6537
|
+
handleClick(event) {
|
|
6538
|
+
if (this.disabled) {
|
|
6539
|
+
event.preventDefault();
|
|
6540
|
+
event.stopPropagation();
|
|
6541
|
+
return;
|
|
6542
|
+
}
|
|
6543
|
+
if (this.type === 'submit') {
|
|
6544
|
+
this.formSubmitController.submit(this);
|
|
6545
|
+
}
|
|
6546
|
+
if (this.type === 'reset') {
|
|
6547
|
+
this.formSubmitController.reset(this);
|
|
6548
|
+
}
|
|
6549
|
+
}
|
|
6309
6550
|
render() {
|
|
6310
6551
|
const isLink = this.href;
|
|
6311
|
-
const tag = isLink ? i$
|
|
6312
|
-
return n `
|
|
6552
|
+
const tag = isLink ? i$3 `a` : i$3 `button`;
|
|
6553
|
+
return n$4 `
|
|
6313
6554
|
<${tag}
|
|
6314
|
-
class="sgds btn ${o({
|
|
6555
|
+
class="sgds btn ${o$4({
|
|
6315
6556
|
'disabled': isLink && this.disabled,
|
|
6316
6557
|
'active': this.active,
|
|
6317
6558
|
[`btn-${this.variant}`]: this.variant,
|
|
6318
6559
|
[`btn-${this.size}`]: this.size,
|
|
6319
6560
|
[`${this.buttonClasses}`]: this.buttonClasses
|
|
6320
6561
|
})}"
|
|
6321
|
-
?disabled=${l(isLink ? undefined : this.disabled)}
|
|
6322
|
-
type=${l(isLink ? undefined : this.type)}
|
|
6323
|
-
href=${l(isLink ? this.href : undefined)}
|
|
6324
|
-
target=${l(isLink ? this.target : undefined)}
|
|
6325
|
-
download=${l(isLink ? this.download : undefined)}
|
|
6326
|
-
rel=${l(isLink && this.target === "_blank" ? 'noreferrer noopener' : undefined)}
|
|
6327
|
-
role=${l(isLink ? 'button' : undefined)}
|
|
6562
|
+
?disabled=${l$3(isLink ? undefined : this.disabled)}
|
|
6563
|
+
type=${l$3(isLink ? undefined : this.type)}
|
|
6564
|
+
href=${l$3(isLink ? this.href : undefined)}
|
|
6565
|
+
target=${l$3(isLink ? this.target : undefined)}
|
|
6566
|
+
download=${l$3(isLink ? this.download : undefined)}
|
|
6567
|
+
rel=${l$3(isLink && this.target === "_blank" ? 'noreferrer noopener' : undefined)}
|
|
6568
|
+
role=${l$3(isLink ? 'button' : undefined)}
|
|
6328
6569
|
aria-disabled=${this.disabled ? 'true' : 'false'}
|
|
6329
6570
|
tabindex=${this.disabled ? '-1' : '0'}
|
|
6571
|
+
@click=${this.handleClick}
|
|
6572
|
+
@focus=${this.handleFocus}
|
|
6573
|
+
@blur=${this.handleBlur}
|
|
6330
6574
|
>
|
|
6331
|
-
|
|
6575
|
+
<slot></slot>
|
|
6332
6576
|
</${tag}>
|
|
6333
6577
|
`;
|
|
6334
6578
|
}
|
|
6335
6579
|
};
|
|
6336
6580
|
SgdsButton.styles = css_248z;
|
|
6337
6581
|
__decorate([
|
|
6338
|
-
|
|
6582
|
+
i$5('.btn')
|
|
6583
|
+
], SgdsButton.prototype, "button", void 0);
|
|
6584
|
+
__decorate([
|
|
6585
|
+
t$4()
|
|
6586
|
+
], SgdsButton.prototype, "hasFocus", void 0);
|
|
6587
|
+
__decorate([
|
|
6588
|
+
e$6({ reflect: true })
|
|
6339
6589
|
], SgdsButton.prototype, "variant", void 0);
|
|
6340
6590
|
__decorate([
|
|
6341
|
-
e$
|
|
6591
|
+
e$6({ reflect: true })
|
|
6342
6592
|
], SgdsButton.prototype, "buttonClasses", void 0);
|
|
6343
6593
|
__decorate([
|
|
6344
|
-
e$
|
|
6594
|
+
e$6({ reflect: true })
|
|
6345
6595
|
], SgdsButton.prototype, "size", void 0);
|
|
6346
6596
|
__decorate([
|
|
6347
|
-
e$
|
|
6597
|
+
e$6({ type: Boolean, reflect: true })
|
|
6348
6598
|
], SgdsButton.prototype, "active", void 0);
|
|
6349
6599
|
__decorate([
|
|
6350
|
-
e$
|
|
6600
|
+
e$6({ type: Boolean, reflect: true })
|
|
6351
6601
|
], SgdsButton.prototype, "disabled", void 0);
|
|
6352
6602
|
__decorate([
|
|
6353
|
-
e$
|
|
6603
|
+
e$6()
|
|
6354
6604
|
], SgdsButton.prototype, "type", void 0);
|
|
6355
6605
|
__decorate([
|
|
6356
|
-
e$
|
|
6606
|
+
e$6()
|
|
6357
6607
|
], SgdsButton.prototype, "href", void 0);
|
|
6358
6608
|
__decorate([
|
|
6359
|
-
e$
|
|
6609
|
+
e$6()
|
|
6360
6610
|
], SgdsButton.prototype, "target", void 0);
|
|
6361
6611
|
__decorate([
|
|
6362
|
-
e$
|
|
6612
|
+
e$6({ reflect: true })
|
|
6363
6613
|
], SgdsButton.prototype, "download", void 0);
|
|
6614
|
+
__decorate([
|
|
6615
|
+
e$6()
|
|
6616
|
+
], SgdsButton.prototype, "form", void 0);
|
|
6617
|
+
__decorate([
|
|
6618
|
+
e$6({ attribute: 'formaction' })
|
|
6619
|
+
], SgdsButton.prototype, "formAction", void 0);
|
|
6620
|
+
__decorate([
|
|
6621
|
+
e$6({ attribute: 'formmethod' })
|
|
6622
|
+
], SgdsButton.prototype, "formMethod", void 0);
|
|
6623
|
+
__decorate([
|
|
6624
|
+
e$6({ attribute: 'formnovalidate', type: Boolean })
|
|
6625
|
+
], SgdsButton.prototype, "formNoValidate", void 0);
|
|
6626
|
+
__decorate([
|
|
6627
|
+
e$6({ attribute: 'formtarget' })
|
|
6628
|
+
], SgdsButton.prototype, "formTarget", void 0);
|
|
6364
6629
|
SgdsButton = __decorate([
|
|
6365
|
-
e$
|
|
6630
|
+
e$7("sgds-button")
|
|
6366
6631
|
], SgdsButton);
|
|
6367
6632
|
|
|
6368
6633
|
export { SgdsButton };
|