scu-web-components 1.3.3 → 1.3.4
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/dist/docs/components/manifest.json +30 -30
- package/dist/docs/config.json +5 -5
- package/dist/scw-components.js +1 -1
- package/dist/scw-components.js.gz +0 -0
- package/dist/scw.js +1 -1
- package/dist/scw.js.gz +0 -0
- package/dist/tokens/source/jsCss.js +1 -1
- package/dist/tokens/source/jsCss.js.gz +0 -0
- package/dist/tokens/source/jsCssGenerator.js +1 -1
- package/dist/tokens/source/jsCssGenerator.js.gz +0 -0
- package/dist/tokens/source/jsCssGeneratorSansAssets.js +1 -1
- package/dist/tokens/source/jsCssGeneratorSansAssets.js.gz +0 -0
- package/dist-node/scw-components.js +1 -1
- package/dist-node/scw.js +1 -1
- package/package.json +1 -1
- package/scripts/publish/releaseNotes.mjs +5 -0
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
"tagName": "scw-alert",
|
|
12
12
|
"category": "interactive"
|
|
13
13
|
},
|
|
14
|
-
{
|
|
15
|
-
"name": "ScwButton",
|
|
16
|
-
"fileName": "ScwButton.json",
|
|
17
|
-
"tagName": "scw-button",
|
|
18
|
-
"category": "interactive"
|
|
19
|
-
},
|
|
20
14
|
{
|
|
21
15
|
"name": "ScwBlock",
|
|
22
16
|
"fileName": "ScwBlock.json",
|
|
23
17
|
"tagName": "scw-block",
|
|
24
18
|
"category": "interactive"
|
|
25
19
|
},
|
|
20
|
+
{
|
|
21
|
+
"name": "ScwButton",
|
|
22
|
+
"fileName": "ScwButton.json",
|
|
23
|
+
"tagName": "scw-button",
|
|
24
|
+
"category": "interactive"
|
|
25
|
+
},
|
|
26
26
|
{
|
|
27
27
|
"name": "ScwCallout",
|
|
28
28
|
"fileName": "ScwCallout.json",
|
|
@@ -41,12 +41,6 @@
|
|
|
41
41
|
"tagName": "scw-center-component",
|
|
42
42
|
"category": "layouts"
|
|
43
43
|
},
|
|
44
|
-
{
|
|
45
|
-
"name": "ScwCheckbox",
|
|
46
|
-
"fileName": "ScwCheckbox.json",
|
|
47
|
-
"tagName": "scw-checkbox",
|
|
48
|
-
"category": "form"
|
|
49
|
-
},
|
|
50
44
|
{
|
|
51
45
|
"name": "ScwComparisonCell",
|
|
52
46
|
"fileName": "ScwComparisonCell.json",
|
|
@@ -59,24 +53,30 @@
|
|
|
59
53
|
"tagName": "scw-comparison-row",
|
|
60
54
|
"category": "interactive"
|
|
61
55
|
},
|
|
56
|
+
{
|
|
57
|
+
"name": "ScwCheckbox",
|
|
58
|
+
"fileName": "ScwCheckbox.json",
|
|
59
|
+
"tagName": "scw-checkbox",
|
|
60
|
+
"category": "form"
|
|
61
|
+
},
|
|
62
62
|
{
|
|
63
63
|
"name": "ScwComparisonTable",
|
|
64
64
|
"fileName": "ScwComparisonTable.json",
|
|
65
65
|
"tagName": "scw-comparison-table",
|
|
66
66
|
"category": "interactive"
|
|
67
67
|
},
|
|
68
|
-
{
|
|
69
|
-
"name": "ScwComponent",
|
|
70
|
-
"fileName": "ScwComponent.json",
|
|
71
|
-
"tagName": "scw-component",
|
|
72
|
-
"category": "base"
|
|
73
|
-
},
|
|
74
68
|
{
|
|
75
69
|
"name": "ScwDisclosure",
|
|
76
70
|
"fileName": "ScwDisclosure.json",
|
|
77
71
|
"tagName": "scw-disclosure",
|
|
78
72
|
"category": "content"
|
|
79
73
|
},
|
|
74
|
+
{
|
|
75
|
+
"name": "ScwComponent",
|
|
76
|
+
"fileName": "ScwComponent.json",
|
|
77
|
+
"tagName": "scw-component",
|
|
78
|
+
"category": "base"
|
|
79
|
+
},
|
|
80
80
|
{
|
|
81
81
|
"name": "ScwDisclosureItem",
|
|
82
82
|
"fileName": "ScwDisclosureItem.json",
|
|
@@ -179,18 +179,18 @@
|
|
|
179
179
|
"tagName": "scw-layout-component",
|
|
180
180
|
"category": "layouts"
|
|
181
181
|
},
|
|
182
|
-
{
|
|
183
|
-
"name": "ScwLinkBase",
|
|
184
|
-
"fileName": "ScwLinkBase.json",
|
|
185
|
-
"tagName": "scw-link-base",
|
|
186
|
-
"category": "interactive"
|
|
187
|
-
},
|
|
188
182
|
{
|
|
189
183
|
"name": "ScwLink",
|
|
190
184
|
"fileName": "ScwLink.json",
|
|
191
185
|
"tagName": "scw-link",
|
|
192
186
|
"category": "interactive"
|
|
193
187
|
},
|
|
188
|
+
{
|
|
189
|
+
"name": "ScwLinkBase",
|
|
190
|
+
"fileName": "ScwLinkBase.json",
|
|
191
|
+
"tagName": "scw-link-base",
|
|
192
|
+
"category": "interactive"
|
|
193
|
+
},
|
|
194
194
|
{
|
|
195
195
|
"name": "ScwMenu",
|
|
196
196
|
"fileName": "ScwMenu.json",
|
|
@@ -287,18 +287,18 @@
|
|
|
287
287
|
"tagName": "scw-select",
|
|
288
288
|
"category": "form"
|
|
289
289
|
},
|
|
290
|
-
{
|
|
291
|
-
"name": "ScwSlider",
|
|
292
|
-
"fileName": "ScwSlider.json",
|
|
293
|
-
"tagName": "scw-slider",
|
|
294
|
-
"category": "interactive"
|
|
295
|
-
},
|
|
296
290
|
{
|
|
297
291
|
"name": "ScwStackComponent",
|
|
298
292
|
"fileName": "ScwStackComponent.json",
|
|
299
293
|
"tagName": "scw-stack-component",
|
|
300
294
|
"category": "layouts"
|
|
301
295
|
},
|
|
296
|
+
{
|
|
297
|
+
"name": "ScwSlider",
|
|
298
|
+
"fileName": "ScwSlider.json",
|
|
299
|
+
"tagName": "scw-slider",
|
|
300
|
+
"category": "interactive"
|
|
301
|
+
},
|
|
302
302
|
{
|
|
303
303
|
"name": "ScwStepper",
|
|
304
304
|
"fileName": "ScwStepper.json",
|
package/dist/docs/config.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "Summit Credit Union Web Design System (SCW)",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"navigation": [
|
|
5
5
|
{
|
|
6
6
|
"id": "tokens",
|
|
7
7
|
"title": "Component SASS",
|
|
8
|
-
"url": "../tokens/tokens.html?1.3.
|
|
8
|
+
"url": "../tokens/tokens.html?1.3.4"
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"id": "css",
|
|
12
12
|
"title": "CSS",
|
|
13
|
-
"url": "../tokens/css.html?clipboardType=classes&1.3.
|
|
13
|
+
"url": "../tokens/css.html?clipboardType=classes&1.3.4"
|
|
14
14
|
}
|
|
15
15
|
],
|
|
16
|
-
"moduleEmbed": "const scw = await import('../scw.js?
|
|
17
|
-
"cssLink": "../scw.css?
|
|
16
|
+
"moduleEmbed": "const scw = await import('../scw.js?1750699653814'); scw.defineComponents();",
|
|
17
|
+
"cssLink": "../scw.css?1750699653814",
|
|
18
18
|
"documents": [
|
|
19
19
|
{
|
|
20
20
|
"title": "Install",
|
package/dist/scw-components.js
CHANGED
|
@@ -535,7 +535,7 @@ var WZ=Object.create;var X6=Object.defineProperty;var bf=Object.getOwnPropertyDe
|
|
|
535
535
|
scw-tooltip {
|
|
536
536
|
padding-left: 5px;
|
|
537
537
|
display: inline-flex;
|
|
538
|
-
}`});var r2,$2,S2,O2,m5=C(()=>{"use strict";r2=(D=>(D.button="button",D.color="color",D.datetimeLocal="datetimeLocal",D.file="file",D.hidden="hidden",D.image="image",D.month="month",D.number="number",D.range="range",D.reset="reset",D.search="search",D.select="select",D.submit="submit",D.tel="tel",D.time="time",D.url="url",D.week="week",D.fieldset="fieldset",D.date="date",D.checkbox="checkbox",D.email="email",D.password="password",D.radio="radio",D.text="text",D.telephone="telephone",D.currency="currency",D.ssn="ssn",D))(r2||{}),$2=(o=>(o.none="none",o.sentences="sentences",o.words="words",o.characters="characters",o.default="none",o))($2||{}),S2=(r=>(r.off="off",r.on="on",r.default="on",r))(S2||{}),O2=(r=>(r.off="off",r.on="on",r.default="off",r))(O2||{})});function T(e,i,t={},r){let a=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0,detail:t,...r});return i.dispatchEvent(a),a}var j=C(()=>{"use strict"});function hk(e){return isFinite(e.getTime())}function mh(e){if(/(\d{2})\/(\d{2})\/(\d{4})/.test(e)){let[i,t,r]=e.split("/");return`${r}-${i}-${t}`}return""}function wh(e){if(/(\d{4})-(\d{2})-(\d{2})/.test(e)){let[i,t,r]=e.split("-");return`${t}/${r}/${i}`}return""}function Lh(e){if(hk(e)){let i=new Intl.DateTimeFormat("en",{year:"numeric"}).format(e),t=new Intl.DateTimeFormat("en",{month:"2-digit"}).format(e),r=new Intl.DateTimeFormat("en",{day:"2-digit"}).format(e);return`${t}/${r}/${i}`}return""}var b9=C(()=>{"use strict"});function vh(e,i,t){let r=t;if(e&&e.length>0){let a=e.replace(/[^\d]/g,""),o="";if(a.length>6){let d=a.substring(0,3),p=`${a.substring(3,6)}-${a.substring(6)}`;o=`(${d}) ${p}`}else a.length>3?o=`(${a.substring(0,3)}) ${a.substring(3)}`:a.length>0&&(o=`(${a.substring(0)}`);let l=e.length<i.length;return e.length===t?r=o?o.length:0:t===1?r=l?1:2:t===5||t===6?r=l?5:7:t===9&&(r=l?9:10),{value:a,display:o,selectionIndex:r}}else return{value:"",display:"",selectionIndex:r}}var bh=C(()=>{"use strict"});function xh(e,i){if(!e)return{value:"",display:"",selectionIndex:0};let t=e?e.replace(/[^\d]/g,""):"";return t.length<e.length&&i--,{value:t,display:t,selectionIndex:i||0}}var Hh=C(()=>{"use strict"});function H9(e,i,t=!1,r){if(!e||e==="$")return{value:"",display:"",selectionIndex:0};w5++;let a=new Date;if(w5>20)return x9=a,w5=0,{value:"error",display:"error",selectionIndex:0};a.getTime()-x9.getTime()>100&&(x9=a,w5=0);let o=e.replace(/[^\d|,|$|.]/g,"");o=o.replace(/^\$0+/g,"$");let l=o,d=l.split(".");if(d.length>2){let v=d.pop();l=`${d.join("")}.${v}`,d=l.split(".")}let p=d.length>1?d[d.length-1].length:0;p>2?(l=l.replace(/[^\d]/g,""),l=Vh(l,l.length-2,".")):p>0&&(l=l.replace(/[^\d/.]/g,"")),t&&(p===0?l=`${l.replace(/\./g,"")}.00`:p===1&&(l=`${l}0`));let h=l.split("."),m=h[0];m=m.replace(/[^\d]/g,""),m=m?`${parseInt(m)}`:"0",m=gk(m,",",3),h[0]=m;let g=`$${h.join(".")}`,V=g.replace(/,|\$/g,""),b=i;if(g!==o){let v=o.substr(0,i),E=g.substr(0,i),O=(v.match(/,|\$/g)||[]).length,N=(E.match(/,|\$/g)||[]).length,Y=g.substr(i);v===E&&Y.indexOf(",")===0&&r===i?b++:b+=N-O}else o!==e&&(b+=o.length-e.length);return{value:V,display:g,selectionIndex:b||0}}function Vh(e,i,t){return e.substring(0,i)+t+e.substring(i)}function gk(e,i,t){let r=0,a=e;for(let o=0;o<e.length;o++)o%t===0&&(r>0&&(a=Vh(a,e.length-o,i)),r++);return a}var w5,x9,yh=C(()=>{"use strict";w5=0,x9=new Date});function Mh(e,i,t){let r=t;if(e&&e.length>0){let a=e.replace(/[^\d]/g,""),o="",l=a.substring(0,3);if(a.length>5){let p=`${a.substring(3,5)}-${a.substring(5)}`;o=`${l}-${p}`}else a.length>3?o=`${l}-${a.substring(3)}`:a.length>0&&(o=`${l}`);let d=e.length<i.length;return e.length===t?r=o?o.length:0:t===4?r=d?4:5:t===7&&(r=d?7:8),{value:a,display:o,selectionIndex:r}}else return{value:"",display:"",selectionIndex:r}}var Ah=C(()=>{"use strict"});var a2,Zh=C(()=>{"use strict";b9();bh();Hh();yh();Ah();m5();a2=class{constructor(i){this.lastSelectionStart=0,this.inputBase=i}autoFormat(i){if(this.inputBase.type==="telephone"){let t=vh(i,this.inputBase.valueDisplayed,this.inputBase.input&&this.inputBase.input.selectionStart||0);this.applyValues(t)}else if(this.inputBase.type==="ssn"){let t=Mh(i,this.inputBase.valueDisplayed,this.inputBase.input&&this.inputBase.input.selectionStart||0);this.applyValues(t)}else if(this.inputBase.type==="date")i.includes("-")?(this.inputBase.value=wh(i),this.inputBase.valueDisplayed=i):i.includes("/")?(this.inputBase.value=i,this.inputBase.valueDisplayed=mh(i)):(this.inputBase.value=i,this.inputBase.valueDisplayed=i);else if(this.inputBase.type==="number"){let t=xh(i,this.inputBase.input&&this.inputBase.input.selectionStart||0);this.applyValues(t,!0,!1)}else if(this.inputBase.type==="currency"){let t=H9(i,this.inputBase.input&&this.inputBase.input.selectionStart||0,!1,this.lastSelectionStart);this.applyValues(t)}else this.inputBase.value=i,this.inputBase.valueDisplayed=this.inputBase.value;this.updateSelection()}autoFormatFinish(i){if(this.inputBase.type==="currency"){let t=H9(i,this.inputBase.input&&this.inputBase.input.selectionStart||0,!0,this.lastSelectionStart);this.applyValues(t,!1,!1)}this.updateSelection()}applyValues(i,t=!1,r=!0){this.inputBase.value=t?i.display:i.value?i.value:"",this.inputBase.valueDisplayed=i.display,this.inputBase.input&&(this.inputBase.input.value=i.display,r&&this.inputBase.input.setSelectionRange(i.selectionIndex,i.selectionIndex))}updateSelection(){this.lastSelectionStart=this.inputBase.input&&this.inputBase.input.selectionStart||0}}});function R(e,i){return(t,r)=>{let{update:a}=t;i=Object.assign({waitUntilFirstUpdate:!1},i),t.update=function(o){if(o.has(e)){let l=o.get(e),d=this[e];l!==d&&i&&(!i.waitUntilFirstUpdate||this.hasUpdated)&&this[r].call(this,l,d)}a.call(this,o)}}}var m3=C(()=>{"use strict"});var F,kh=C(()=>{k3();b1();F=s1(class extends P3{constructor(e){var i;if(super(e),e.type!==Q.ATTRIBUTE||e.name!=="class"||((i=e.strings)===null||i===void 0?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(e){return" "+Object.keys(e).filter(i=>e[i]).join(" ")+" "}update(e,[i]){var t,r;if(this.nt===void 0){this.nt=new Set,e.strings!==void 0&&(this.st=new Set(e.strings.join(" ").split(/\s/).filter(o=>o!=="")));for(let o in i)i[o]&&!(!((t=this.st)===null||t===void 0)&&t.has(o))&&this.nt.add(o);return this.render(i)}let a=e.element.classList;this.nt.forEach(o=>{o in i||(a.remove(o),this.nt.delete(o))});for(let o in i){let l=!!i[o];l===this.nt.has(o)||((r=this.st)===null||r===void 0?void 0:r.has(o))||(l?(a.add(o),this.nt.add(o)):(a.remove(o),this.nt.delete(o)))}return r3}})});var V3=C(()=>{kh()});var Eh,_h=C(()=>{k3();b1();f5();Eh=s1(class extends P3{constructor(e){if(super(e),e.type!==Q.PROPERTY&&e.type!==Q.ATTRIBUTE&&e.type!==Q.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!e2(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[i]){if(i===r3||i===B)return i;let t=e.element,r=e.name;if(e.type===Q.PROPERTY){if(i===t[r])return r3}else if(e.type===Q.BOOLEAN_ATTRIBUTE){if(!!i===t.hasAttribute(r))return r3}else if(e.type===Q.ATTRIBUTE&&t.getAttribute(r)===i+"")return r3;return th(e),i}})});var $h=C(()=>{_h()});var B2,V9=C(()=>{k3();B2=e=>e!=null?e:B});var q,Sh=C(()=>{"use strict";_();k();x1();A();uh();m5();j();j();Zh();m3();V3();$h();V9();q=class extends P{constructor(){super();this.type="text";this.autoCapitalize="none";this.autoComplete="on";this.autoCorrect="off";this.autoFocus=!1;this.inputmode="text";this.selectAllOnFocus=!1;this.hideFeedback=!1;this.defaultFeedback="";this.clearable=!1;this.dropdownText="";this.dropdownIcon="";this.inputSize="default";this.accept=null;this.valueDisplayed="";this.showPassword=!1;this.filePickerOpen=!1;this.hideDropdown=!0;this.showClear=!1;this.element="input-field",this.autoFormatter=new a2(this),this.boundOutsideClickHandler=this.handleOutsideClick.bind(this)}static get styles(){return[super.styles,gh]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","group"),this.autoFormatter=new a2(this),this.autoFormatter.autoFormat(this.value),this.autoFormatter.autoFormatFinish(this.value),this.dropdownText&&window.addEventListener("mousedown",this.boundOutsideClickHandler,!1)}disconnectedCallback(){this.dropdownText&&window.removeEventListener("mousedown",this.boundOutsideClickHandler),super.disconnectedCallback()}firstUpdated(){this.value&&this.valueHandler()}handleOutsideClick(t){t.composedPath().includes(this)||(this.hideDropdown=!0)}formatValue(){this.value!==this.lastFormattedValue&&(this.lastFormattedValue=this.value,this.autoFormatter.autoFormat(this.value),this.focused||this.autoFormatter.autoFormatFinish(this.value))}handleChange(){this.value=this.input.value,this.filePickerOpen=!1}valueHandler(){this.formatValue(),this.value&&(this.type==="file"||this.clearable)?this.showClear=!0:this.showClear=!1,T("scw-value-change",this,{value:this.value,name:this.name,valueDisplayed:this.valueDisplayed})}handleShowPassword(){this.showPassword=!this.showPassword,this.requestUpdate()}handleInteraction(t){this.autoFormatter.updateSelection(),this.type==="file"&&t.type==="click"&&(this.filePickerOpen=!0)}handleKeydown(t){this.type==="currency"&&t.key==="Enter"&&this.autoFormatter.autoFormatFinish(this.value)}handleCancel(){this.filePickerOpen=!1}blurHandler(){this.autoFormatter.autoFormatFinish(this.value),T("scw-blur",this),this.focused=!1,this.filePickerOpen||this.validate()}handleClear(){this.value=""}focusHandler(){this.autoFormatter.updateSelection(),this.focused=!0,this.hideDropdown=!1,this.selectAllOnFocus&&this.input.setSelectionRange(0,this.input.value.length),T("scw-focus",this)}dropdownClick(){this.hideDropdown=!0,T("scw-dropdown",this),this.requestUpdate()}invalidHandler(t){t.preventDefault()}render(){let t={focused:this.focused,invalid:this.invalid,inputWrapper:!0,small:this.inputSize==="small",showFile:this.type==="file"&&this.value};return f`<div class=${F(t)}>
|
|
538
|
+
}`});var r2,$2,S2,O2,m5=C(()=>{"use strict";r2=(D=>(D.button="button",D.color="color",D.datetimeLocal="datetimeLocal",D.file="file",D.hidden="hidden",D.image="image",D.month="month",D.number="number",D.range="range",D.reset="reset",D.search="search",D.select="select",D.submit="submit",D.tel="tel",D.time="time",D.url="url",D.week="week",D.fieldset="fieldset",D.date="date",D.checkbox="checkbox",D.email="email",D.password="password",D.radio="radio",D.text="text",D.telephone="telephone",D.currency="currency",D.ssn="ssn",D))(r2||{}),$2=(o=>(o.none="none",o.sentences="sentences",o.words="words",o.characters="characters",o.default="none",o))($2||{}),S2=(r=>(r.off="off",r.on="on",r.default="on",r))(S2||{}),O2=(r=>(r.off="off",r.on="on",r.default="off",r))(O2||{})});function T(e,i,t={},r){let a=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0,detail:t,...r});return i.dispatchEvent(a),a}var j=C(()=>{"use strict"});function hk(e){return isFinite(e.getTime())}function mh(e){if(/(\d{2})\/(\d{2})\/(\d{4})/.test(e)){let[i,t,r]=e.split("/");return`${r}-${i}-${t}`}return""}function wh(e){if(/(\d{4})-(\d{2})-(\d{2})/.test(e)){let[i,t,r]=e.split("-");return`${t}/${r}/${i}`}return""}function Lh(e){if(hk(e)){let i=new Intl.DateTimeFormat("en",{year:"numeric"}).format(e),t=new Intl.DateTimeFormat("en",{month:"2-digit"}).format(e),r=new Intl.DateTimeFormat("en",{day:"2-digit"}).format(e);return`${t}/${r}/${i}`}return""}var b9=C(()=>{"use strict"});function vh(e,i,t){let r=t;if(e&&e.length>0){let a=e.replace(/[^\d]/g,""),o="";if(a.length>6){let d=a.substring(0,3),p=`${a.substring(3,6)}-${a.substring(6)}`;o=`(${d}) ${p}`}else a.length>3?o=`(${a.substring(0,3)}) ${a.substring(3)}`:a.length>0&&(o=`(${a.substring(0)}`);let l=e.length<i.length;return e.length===t?r=o?o.length:0:t===1?r=l?1:2:t===5||t===6?r=l?5:7:t===9&&(r=l?9:10),{value:a,display:o,selectionIndex:r}}else return{value:"",display:"",selectionIndex:r}}var bh=C(()=>{"use strict"});function xh(e,i){if(!e)return{value:"",display:"",selectionIndex:0};let t=e?e.replace(/[^\d]/g,""):"";return t.length<e.length&&i--,{value:t,display:t,selectionIndex:i||0}}var Hh=C(()=>{"use strict"});function H9(e,i,t=!1,r){if(!e||e==="$")return{value:"",display:"",selectionIndex:0};w5++;let a=new Date;if(w5>20)return x9=a,w5=0,{value:"error",display:"error",selectionIndex:0};a.getTime()-x9.getTime()>100&&(x9=a,w5=0);let o=e.replace(/[^\d|,|$|.]/g,"");o=o.replace(/^\$0+/g,"$");let l=o,d=l.split(".");if(d.length>2){let v=d.pop();l=`${d.join("")}.${v}`,d=l.split(".")}let p=d.length>1?d[d.length-1].length:0;p>2?(l=l.replace(/[^\d]/g,""),l=Vh(l,l.length-2,".")):p>0&&(l=l.replace(/[^\d/.]/g,"")),t&&(p===0?l=`${l.replace(/\./g,"")}.00`:p===1&&(l=`${l}0`));let h=l.split("."),m=h[0];m=m.replace(/[^\d]/g,""),m=m?`${parseInt(m)}`:"0",m=gk(m,",",3),h[0]=m;let g=`$${h.join(".")}`,V=g.replace(/,|\$/g,""),b=i;if(g!==o){let v=o.substr(0,i),E=g.substr(0,i),O=(v.match(/,|\$/g)||[]).length,N=(E.match(/,|\$/g)||[]).length,Y=g.substr(i);v===E&&Y.indexOf(",")===0&&r===i?b++:b+=N-O}else o!==e&&(b+=o.length-e.length);return{value:V,display:g,selectionIndex:b||0}}function Vh(e,i,t){return e.substring(0,i)+t+e.substring(i)}function gk(e,i,t){let r=0,a=e;for(let o=0;o<e.length;o++)o%t===0&&(r>0&&(a=Vh(a,e.length-o,i)),r++);return a}var w5,x9,yh=C(()=>{"use strict";w5=0,x9=new Date});function Mh(e,i,t){let r=t;if(e&&e.length>0){let a=e.replace(/[^\d]/g,""),o="",l=a.substring(0,3);if(a.length>5){let p=`${a.substring(3,5)}-${a.substring(5)}`;o=`${l}-${p}`}else a.length>3?o=`${l}-${a.substring(3)}`:a.length>0&&(o=`${l}`);let d=e.length<i.length;return e.length===t?r=o?o.length:0:t===4?r=d?4:5:t===7&&(r=d?7:8),{value:a,display:o,selectionIndex:r}}else return{value:"",display:"",selectionIndex:r}}var Ah=C(()=>{"use strict"});var a2,Zh=C(()=>{"use strict";b9();bh();Hh();yh();Ah();m5();a2=class{constructor(i){this.lastSelectionStart=0,this.inputBase=i}autoFormat(i){if(this.inputBase.type==="telephone"){let t=vh(i,this.inputBase.valueDisplayed,this.inputBase.input&&this.inputBase.input.selectionStart||0);this.applyValues(t)}else if(this.inputBase.type==="ssn"){let t=Mh(i,this.inputBase.valueDisplayed,this.inputBase.input&&this.inputBase.input.selectionStart||0);this.applyValues(t)}else if(this.inputBase.type==="date")i.includes("-")?(this.inputBase.value=wh(i),this.inputBase.valueDisplayed=i):i.includes("/")?(this.inputBase.value=i,this.inputBase.valueDisplayed=mh(i)):(this.inputBase.value=i,this.inputBase.valueDisplayed=i);else if(this.inputBase.type==="number"){let t=xh(i,this.inputBase.input&&this.inputBase.input.selectionStart||0);this.applyValues(t,!0,!1)}else if(this.inputBase.type==="currency"){let t=H9(i,this.inputBase.input&&this.inputBase.input.selectionStart||0,!1,this.lastSelectionStart);this.applyValues(t)}else this.inputBase.value=i,this.inputBase.valueDisplayed=this.inputBase.value;this.updateSelection()}autoFormatFinish(i){if(this.inputBase.type==="currency"){let t=H9(i,this.inputBase.input&&this.inputBase.input.selectionStart||0,!0,this.lastSelectionStart);this.applyValues(t,!1,!1)}this.updateSelection()}applyValues(i,t=!1,r=!0){this.inputBase.value=t?i.display:i.value?i.value:"",this.inputBase.valueDisplayed=i.display,this.inputBase.input&&(this.inputBase.input.value=i.display,r&&this.inputBase.input.setSelectionRange(i.selectionIndex,i.selectionIndex))}updateSelection(){this.lastSelectionStart=this.inputBase.input&&this.inputBase.input.selectionStart||0}}});function R(e,i){return(t,r)=>{let{update:a}=t;i=Object.assign({waitUntilFirstUpdate:!1},i),t.update=function(o){if(o.has(e)){let l=o.get(e),d=this[e];l!==d&&i&&(!i.waitUntilFirstUpdate||this.hasUpdated)&&this[r].call(this,l,d)}a.call(this,o)}}}var m3=C(()=>{"use strict"});var F,kh=C(()=>{k3();b1();F=s1(class extends P3{constructor(e){var i;if(super(e),e.type!==Q.ATTRIBUTE||e.name!=="class"||((i=e.strings)===null||i===void 0?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(e){return" "+Object.keys(e).filter(i=>e[i]).join(" ")+" "}update(e,[i]){var t,r;if(this.nt===void 0){this.nt=new Set,e.strings!==void 0&&(this.st=new Set(e.strings.join(" ").split(/\s/).filter(o=>o!=="")));for(let o in i)i[o]&&!(!((t=this.st)===null||t===void 0)&&t.has(o))&&this.nt.add(o);return this.render(i)}let a=e.element.classList;this.nt.forEach(o=>{o in i||(a.remove(o),this.nt.delete(o))});for(let o in i){let l=!!i[o];l===this.nt.has(o)||((r=this.st)===null||r===void 0?void 0:r.has(o))||(l?(a.add(o),this.nt.add(o)):(a.remove(o),this.nt.delete(o)))}return r3}})});var V3=C(()=>{kh()});var Eh,_h=C(()=>{k3();b1();f5();Eh=s1(class extends P3{constructor(e){if(super(e),e.type!==Q.PROPERTY&&e.type!==Q.ATTRIBUTE&&e.type!==Q.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!e2(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[i]){if(i===r3||i===B)return i;let t=e.element,r=e.name;if(e.type===Q.PROPERTY){if(i===t[r])return r3}else if(e.type===Q.BOOLEAN_ATTRIBUTE){if(!!i===t.hasAttribute(r))return r3}else if(e.type===Q.ATTRIBUTE&&t.getAttribute(r)===i+"")return r3;return th(e),i}})});var $h=C(()=>{_h()});var B2,V9=C(()=>{k3();B2=e=>e!=null?e:B});var q,Sh=C(()=>{"use strict";_();k();x1();A();uh();m5();j();j();Zh();m3();V3();$h();V9();q=class extends P{constructor(){super();this.type="text";this.autoCapitalize="none";this.autoComplete="on";this.autoCorrect="off";this.autoFocus=!1;this.inputmode="text";this.selectAllOnFocus=!1;this.hideFeedback=!1;this.defaultFeedback="";this.clearable=!1;this.dropdownText="";this.dropdownIcon="";this.inputSize="default";this.accept=null;this.valueDisplayed="";this.showPassword=!1;this.filePickerOpen=!1;this.hideDropdown=!0;this.showClear=!1;this.element="input-field",this.autoFormatter=new a2(this),this.boundOutsideClickHandler=this.handleOutsideClick.bind(this)}static get styles(){return[super.styles,gh]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","group"),this.autoFormatter=new a2(this),this.autoFormatter.autoFormat(this.value),this.autoFormatter.autoFormatFinish(this.value),this.dropdownText&&window.addEventListener("mousedown",this.boundOutsideClickHandler,!1)}disconnectedCallback(){this.dropdownText&&window.removeEventListener("mousedown",this.boundOutsideClickHandler),super.disconnectedCallback()}firstUpdated(){this.value&&this.valueHandler()}handleOutsideClick(t){t.composedPath().includes(this)||(this.hideDropdown=!0)}formatValue(){this.value!==this.lastFormattedValue&&(this.lastFormattedValue=this.value,this.autoFormatter.autoFormat(this.value),this.focused||this.autoFormatter.autoFormatFinish(this.value))}handleChange(){this.value=this.input.value,this.filePickerOpen=!1}valueHandler(){var t;this.formatValue(),this.value&&(this.type==="file"||this.clearable)?this.showClear=!0:this.showClear=!1,T("scw-value-change",this,{value:this.value,name:this.name,valueDisplayed:this.valueDisplayed,...this.type==="file"?{files:(t=this.input)==null?void 0:t.files}:{}})}handleShowPassword(){this.showPassword=!this.showPassword,this.requestUpdate()}handleInteraction(t){this.autoFormatter.updateSelection(),this.type==="file"&&t.type==="click"&&(this.filePickerOpen=!0)}handleKeydown(t){this.type==="currency"&&t.key==="Enter"&&this.autoFormatter.autoFormatFinish(this.value)}handleCancel(){this.filePickerOpen=!1}blurHandler(){this.autoFormatter.autoFormatFinish(this.value),T("scw-blur",this),this.focused=!1,this.filePickerOpen||this.validate()}handleClear(){this.value=""}focusHandler(){this.autoFormatter.updateSelection(),this.focused=!0,this.hideDropdown=!1,this.selectAllOnFocus&&this.input.setSelectionRange(0,this.input.value.length),T("scw-focus",this)}dropdownClick(){this.hideDropdown=!0,T("scw-dropdown",this),this.requestUpdate()}invalidHandler(t){t.preventDefault()}render(){let t={focused:this.focused,invalid:this.invalid,inputWrapper:!0,small:this.inputSize==="small",showFile:this.type==="file"&&this.value};return f`<div class=${F(t)}>
|
|
539
539
|
${this.label?f` <div class="input-label">
|
|
540
540
|
${this.label}${this.required?f`<span class="required-label">
|
|
541
541
|
${this.requiredLabel}
|
|
Binary file
|
package/dist/scw.js
CHANGED
|
@@ -535,7 +535,7 @@ var Qk=Object.create;var X6=Object.defineProperty;var Hh=Object.getOwnPropertyDe
|
|
|
535
535
|
scw-tooltip {
|
|
536
536
|
padding-left: 5px;
|
|
537
537
|
display: inline-flex;
|
|
538
|
-
}`});var J1,Z2,k2,E2,u5=C(()=>{"use strict";J1=(D=>(D.button="button",D.color="color",D.datetimeLocal="datetimeLocal",D.file="file",D.hidden="hidden",D.image="image",D.month="month",D.number="number",D.range="range",D.reset="reset",D.search="search",D.select="select",D.submit="submit",D.tel="tel",D.time="time",D.url="url",D.week="week",D.fieldset="fieldset",D.date="date",D.checkbox="checkbox",D.email="email",D.password="password",D.radio="radio",D.text="text",D.telephone="telephone",D.currency="currency",D.ssn="ssn",D))(J1||{}),Z2=(o=>(o.none="none",o.sentences="sentences",o.words="words",o.characters="characters",o.default="none",o))(Z2||{}),k2=(r=>(r.off="off",r.on="on",r.default="on",r))(k2||{}),E2=(r=>(r.off="off",r.on="on",r.default="off",r))(E2||{})});function R(e,i,t={},r){let a=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0,detail:t,...r});return i.dispatchEvent(a),a}var Y=C(()=>{"use strict"});function vE(e){return isFinite(e.getTime())}function xf(e){if(/(\d{2})\/(\d{2})\/(\d{4})/.test(e)){let[i,t,r]=e.split("/");return`${r}-${i}-${t}`}return""}function Hf(e){if(/(\d{4})-(\d{2})-(\d{2})/.test(e)){let[i,t,r]=e.split("-");return`${t}/${r}/${i}`}return""}function Vf(e){if(vE(e)){let i=new Intl.DateTimeFormat("en",{year:"numeric"}).format(e),t=new Intl.DateTimeFormat("en",{month:"2-digit"}).format(e),r=new Intl.DateTimeFormat("en",{day:"2-digit"}).format(e);return`${t}/${r}/${i}`}return""}var H9=C(()=>{"use strict"});function yf(e,i,t){let r=t;if(e&&e.length>0){let a=e.replace(/[^\d]/g,""),o="";if(a.length>6){let c=a.substring(0,3),p=`${a.substring(3,6)}-${a.substring(6)}`;o=`(${c}) ${p}`}else a.length>3?o=`(${a.substring(0,3)}) ${a.substring(3)}`:a.length>0&&(o=`(${a.substring(0)}`);let l=e.length<i.length;return e.length===t?r=o?o.length:0:t===1?r=l?1:2:t===5||t===6?r=l?5:7:t===9&&(r=l?9:10),{value:a,display:o,selectionIndex:r}}else return{value:"",display:"",selectionIndex:r}}var Mf=C(()=>{"use strict"});function Af(e,i){if(!e)return{value:"",display:"",selectionIndex:0};let t=e?e.replace(/[^\d]/g,""):"";return t.length<e.length&&i--,{value:t,display:t,selectionIndex:i||0}}var Zf=C(()=>{"use strict"});function y9(e,i,t=!1,r){if(!e||e==="$")return{value:"",display:"",selectionIndex:0};m5++;let a=new Date;if(m5>20)return V9=a,m5=0,{value:"error",display:"error",selectionIndex:0};a.getTime()-V9.getTime()>100&&(V9=a,m5=0);let o=e.replace(/[^\d|,|$|.]/g,"");o=o.replace(/^\$0+/g,"$");let l=o,c=l.split(".");if(c.length>2){let L=c.pop();l=`${c.join("")}.${L}`,c=l.split(".")}let p=c.length>1?c[c.length-1].length:0;p>2?(l=l.replace(/[^\d]/g,""),l=kf(l,l.length-2,".")):p>0&&(l=l.replace(/[^\d/.]/g,"")),t&&(p===0?l=`${l.replace(/\./g,"")}.00`:p===1&&(l=`${l}0`));let f=l.split("."),m=f[0];m=m.replace(/[^\d]/g,""),m=m?`${parseInt(m)}`:"0",m=bE(m,",",3),f[0]=m;let g=`$${f.join(".")}`,V=g.replace(/,|\$/g,""),b=i;if(g!==o){let L=o.substr(0,i),E=g.substr(0,i),O=(L.match(/,|\$/g)||[]).length,N=(E.match(/,|\$/g)||[]).length,K=g.substr(i);L===E&&K.indexOf(",")===0&&r===i?b++:b+=N-O}else o!==e&&(b+=o.length-e.length);return{value:V,display:g,selectionIndex:b||0}}function kf(e,i,t){return e.substring(0,i)+t+e.substring(i)}function bE(e,i,t){let r=0,a=e;for(let o=0;o<e.length;o++)o%t===0&&(r>0&&(a=kf(a,e.length-o,i)),r++);return a}var m5,V9,Ef=C(()=>{"use strict";m5=0,V9=new Date});function _f(e,i,t){let r=t;if(e&&e.length>0){let a=e.replace(/[^\d]/g,""),o="",l=a.substring(0,3);if(a.length>5){let p=`${a.substring(3,5)}-${a.substring(5)}`;o=`${l}-${p}`}else a.length>3?o=`${l}-${a.substring(3)}`:a.length>0&&(o=`${l}`);let c=e.length<i.length;return e.length===t?r=o?o.length:0:t===4?r=c?4:5:t===7&&(r=c?7:8),{value:a,display:o,selectionIndex:r}}else return{value:"",display:"",selectionIndex:r}}var $f=C(()=>{"use strict"});var Q1,Sf=C(()=>{"use strict";H9();Mf();Zf();Ef();$f();u5();Q1=class{constructor(i){this.lastSelectionStart=0,this.inputBase=i}autoFormat(i){if(this.inputBase.type==="telephone"){let t=yf(i,this.inputBase.valueDisplayed,this.inputBase.input&&this.inputBase.input.selectionStart||0);this.applyValues(t)}else if(this.inputBase.type==="ssn"){let t=_f(i,this.inputBase.valueDisplayed,this.inputBase.input&&this.inputBase.input.selectionStart||0);this.applyValues(t)}else if(this.inputBase.type==="date")i.includes("-")?(this.inputBase.value=Hf(i),this.inputBase.valueDisplayed=i):i.includes("/")?(this.inputBase.value=i,this.inputBase.valueDisplayed=xf(i)):(this.inputBase.value=i,this.inputBase.valueDisplayed=i);else if(this.inputBase.type==="number"){let t=Af(i,this.inputBase.input&&this.inputBase.input.selectionStart||0);this.applyValues(t,!0,!1)}else if(this.inputBase.type==="currency"){let t=y9(i,this.inputBase.input&&this.inputBase.input.selectionStart||0,!1,this.lastSelectionStart);this.applyValues(t)}else this.inputBase.value=i,this.inputBase.valueDisplayed=this.inputBase.value;this.updateSelection()}autoFormatFinish(i){if(this.inputBase.type==="currency"){let t=y9(i,this.inputBase.input&&this.inputBase.input.selectionStart||0,!0,this.lastSelectionStart);this.applyValues(t,!1,!1)}this.updateSelection()}applyValues(i,t=!1,r=!0){this.inputBase.value=t?i.display:i.value?i.value:"",this.inputBase.valueDisplayed=i.display,this.inputBase.input&&(this.inputBase.input.value=i.display,r&&this.inputBase.input.setSelectionRange(i.selectionIndex,i.selectionIndex))}updateSelection(){this.lastSelectionStart=this.inputBase.input&&this.inputBase.input.selectionStart||0}}});function T(e,i){return(t,r)=>{let{update:a}=t;i=Object.assign({waitUntilFirstUpdate:!1},i),t.update=function(o){if(o.has(e)){let l=o.get(e),c=this[e];l!==c&&i&&(!i.waitUntilFirstUpdate||this.hasUpdated)&&this[r].call(this,l,c)}a.call(this,o)}}}var u3=C(()=>{"use strict"});var F,Of=C(()=>{Z3();g1();F=e1(class extends D3{constructor(e){var i;if(super(e),e.type!==Q.ATTRIBUTE||e.name!=="class"||((i=e.strings)===null||i===void 0?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(e){return" "+Object.keys(e).filter(i=>e[i]).join(" ")+" "}update(e,[i]){var t,r;if(this.nt===void 0){this.nt=new Set,e.strings!==void 0&&(this.st=new Set(e.strings.join(" ").split(/\s/).filter(o=>o!=="")));for(let o in i)i[o]&&!(!((t=this.st)===null||t===void 0)&&t.has(o))&&this.nt.add(o);return this.render(i)}let a=e.element.classList;this.nt.forEach(o=>{o in i||(a.remove(o),this.nt.delete(o))});for(let o in i){let l=!!i[o];l===this.nt.has(o)||((r=this.st)===null||r===void 0?void 0:r.has(o))||(l?(a.add(o),this.nt.add(o)):(a.remove(o),this.nt.delete(o)))}return r3}})});var x3=C(()=>{Of()});var Bf,If=C(()=>{Z3();g1();l5();Bf=e1(class extends D3{constructor(e){if(super(e),e.type!==Q.PROPERTY&&e.type!==Q.ATTRIBUTE&&e.type!==Q.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!j1(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[i]){if(i===r3||i===B)return i;let t=e.element,r=e.name;if(e.type===Q.PROPERTY){if(i===t[r])return r3}else if(e.type===Q.BOOLEAN_ATTRIBUTE){if(!!i===t.hasAttribute(r))return r3}else if(e.type===Q.ATTRIBUTE&&t.getAttribute(r)===i+"")return r3;return Th(e),i}})});var Nf=C(()=>{If()});var _2,M9=C(()=>{Z3();_2=e=>e!=null?e:B});var Rf={};n(Rf,{default:()=>U});var U,Tf=C(()=>{"use strict";_();k();w1();A();bf();u5();Y();Y();Sf();u3();x3();Nf();M9();U=class extends P{constructor(){super();this.type="text";this.autoCapitalize="none";this.autoComplete="on";this.autoCorrect="off";this.autoFocus=!1;this.inputmode="text";this.selectAllOnFocus=!1;this.hideFeedback=!1;this.defaultFeedback="";this.clearable=!1;this.dropdownText="";this.dropdownIcon="";this.inputSize="default";this.accept=null;this.valueDisplayed="";this.showPassword=!1;this.filePickerOpen=!1;this.hideDropdown=!0;this.showClear=!1;this.element="input-field",this.autoFormatter=new Q1(this),this.boundOutsideClickHandler=this.handleOutsideClick.bind(this)}static get styles(){return[super.styles,vf]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","group"),this.autoFormatter=new Q1(this),this.autoFormatter.autoFormat(this.value),this.autoFormatter.autoFormatFinish(this.value),this.dropdownText&&window.addEventListener("mousedown",this.boundOutsideClickHandler,!1)}disconnectedCallback(){this.dropdownText&&window.removeEventListener("mousedown",this.boundOutsideClickHandler),super.disconnectedCallback()}firstUpdated(){this.value&&this.valueHandler()}handleOutsideClick(t){t.composedPath().includes(this)||(this.hideDropdown=!0)}formatValue(){this.value!==this.lastFormattedValue&&(this.lastFormattedValue=this.value,this.autoFormatter.autoFormat(this.value),this.focused||this.autoFormatter.autoFormatFinish(this.value))}handleChange(){this.value=this.input.value,this.filePickerOpen=!1}valueHandler(){this.formatValue(),this.value&&(this.type==="file"||this.clearable)?this.showClear=!0:this.showClear=!1,R("scw-value-change",this,{value:this.value,name:this.name,valueDisplayed:this.valueDisplayed})}handleShowPassword(){this.showPassword=!this.showPassword,this.requestUpdate()}handleInteraction(t){this.autoFormatter.updateSelection(),this.type==="file"&&t.type==="click"&&(this.filePickerOpen=!0)}handleKeydown(t){this.type==="currency"&&t.key==="Enter"&&this.autoFormatter.autoFormatFinish(this.value)}handleCancel(){this.filePickerOpen=!1}blurHandler(){this.autoFormatter.autoFormatFinish(this.value),R("scw-blur",this),this.focused=!1,this.filePickerOpen||this.validate()}handleClear(){this.value=""}focusHandler(){this.autoFormatter.updateSelection(),this.focused=!0,this.hideDropdown=!1,this.selectAllOnFocus&&this.input.setSelectionRange(0,this.input.value.length),R("scw-focus",this)}dropdownClick(){this.hideDropdown=!0,R("scw-dropdown",this),this.requestUpdate()}invalidHandler(t){t.preventDefault()}render(){let t={focused:this.focused,invalid:this.invalid,inputWrapper:!0,small:this.inputSize==="small",showFile:this.type==="file"&&this.value};return h`<div class=${F(t)}>
|
|
538
|
+
}`});var J1,Z2,k2,E2,u5=C(()=>{"use strict";J1=(D=>(D.button="button",D.color="color",D.datetimeLocal="datetimeLocal",D.file="file",D.hidden="hidden",D.image="image",D.month="month",D.number="number",D.range="range",D.reset="reset",D.search="search",D.select="select",D.submit="submit",D.tel="tel",D.time="time",D.url="url",D.week="week",D.fieldset="fieldset",D.date="date",D.checkbox="checkbox",D.email="email",D.password="password",D.radio="radio",D.text="text",D.telephone="telephone",D.currency="currency",D.ssn="ssn",D))(J1||{}),Z2=(o=>(o.none="none",o.sentences="sentences",o.words="words",o.characters="characters",o.default="none",o))(Z2||{}),k2=(r=>(r.off="off",r.on="on",r.default="on",r))(k2||{}),E2=(r=>(r.off="off",r.on="on",r.default="off",r))(E2||{})});function R(e,i,t={},r){let a=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0,detail:t,...r});return i.dispatchEvent(a),a}var Y=C(()=>{"use strict"});function vE(e){return isFinite(e.getTime())}function xf(e){if(/(\d{2})\/(\d{2})\/(\d{4})/.test(e)){let[i,t,r]=e.split("/");return`${r}-${i}-${t}`}return""}function Hf(e){if(/(\d{4})-(\d{2})-(\d{2})/.test(e)){let[i,t,r]=e.split("-");return`${t}/${r}/${i}`}return""}function Vf(e){if(vE(e)){let i=new Intl.DateTimeFormat("en",{year:"numeric"}).format(e),t=new Intl.DateTimeFormat("en",{month:"2-digit"}).format(e),r=new Intl.DateTimeFormat("en",{day:"2-digit"}).format(e);return`${t}/${r}/${i}`}return""}var H9=C(()=>{"use strict"});function yf(e,i,t){let r=t;if(e&&e.length>0){let a=e.replace(/[^\d]/g,""),o="";if(a.length>6){let c=a.substring(0,3),p=`${a.substring(3,6)}-${a.substring(6)}`;o=`(${c}) ${p}`}else a.length>3?o=`(${a.substring(0,3)}) ${a.substring(3)}`:a.length>0&&(o=`(${a.substring(0)}`);let l=e.length<i.length;return e.length===t?r=o?o.length:0:t===1?r=l?1:2:t===5||t===6?r=l?5:7:t===9&&(r=l?9:10),{value:a,display:o,selectionIndex:r}}else return{value:"",display:"",selectionIndex:r}}var Mf=C(()=>{"use strict"});function Af(e,i){if(!e)return{value:"",display:"",selectionIndex:0};let t=e?e.replace(/[^\d]/g,""):"";return t.length<e.length&&i--,{value:t,display:t,selectionIndex:i||0}}var Zf=C(()=>{"use strict"});function y9(e,i,t=!1,r){if(!e||e==="$")return{value:"",display:"",selectionIndex:0};m5++;let a=new Date;if(m5>20)return V9=a,m5=0,{value:"error",display:"error",selectionIndex:0};a.getTime()-V9.getTime()>100&&(V9=a,m5=0);let o=e.replace(/[^\d|,|$|.]/g,"");o=o.replace(/^\$0+/g,"$");let l=o,c=l.split(".");if(c.length>2){let L=c.pop();l=`${c.join("")}.${L}`,c=l.split(".")}let p=c.length>1?c[c.length-1].length:0;p>2?(l=l.replace(/[^\d]/g,""),l=kf(l,l.length-2,".")):p>0&&(l=l.replace(/[^\d/.]/g,"")),t&&(p===0?l=`${l.replace(/\./g,"")}.00`:p===1&&(l=`${l}0`));let f=l.split("."),m=f[0];m=m.replace(/[^\d]/g,""),m=m?`${parseInt(m)}`:"0",m=bE(m,",",3),f[0]=m;let g=`$${f.join(".")}`,V=g.replace(/,|\$/g,""),b=i;if(g!==o){let L=o.substr(0,i),E=g.substr(0,i),O=(L.match(/,|\$/g)||[]).length,N=(E.match(/,|\$/g)||[]).length,K=g.substr(i);L===E&&K.indexOf(",")===0&&r===i?b++:b+=N-O}else o!==e&&(b+=o.length-e.length);return{value:V,display:g,selectionIndex:b||0}}function kf(e,i,t){return e.substring(0,i)+t+e.substring(i)}function bE(e,i,t){let r=0,a=e;for(let o=0;o<e.length;o++)o%t===0&&(r>0&&(a=kf(a,e.length-o,i)),r++);return a}var m5,V9,Ef=C(()=>{"use strict";m5=0,V9=new Date});function _f(e,i,t){let r=t;if(e&&e.length>0){let a=e.replace(/[^\d]/g,""),o="",l=a.substring(0,3);if(a.length>5){let p=`${a.substring(3,5)}-${a.substring(5)}`;o=`${l}-${p}`}else a.length>3?o=`${l}-${a.substring(3)}`:a.length>0&&(o=`${l}`);let c=e.length<i.length;return e.length===t?r=o?o.length:0:t===4?r=c?4:5:t===7&&(r=c?7:8),{value:a,display:o,selectionIndex:r}}else return{value:"",display:"",selectionIndex:r}}var $f=C(()=>{"use strict"});var Q1,Sf=C(()=>{"use strict";H9();Mf();Zf();Ef();$f();u5();Q1=class{constructor(i){this.lastSelectionStart=0,this.inputBase=i}autoFormat(i){if(this.inputBase.type==="telephone"){let t=yf(i,this.inputBase.valueDisplayed,this.inputBase.input&&this.inputBase.input.selectionStart||0);this.applyValues(t)}else if(this.inputBase.type==="ssn"){let t=_f(i,this.inputBase.valueDisplayed,this.inputBase.input&&this.inputBase.input.selectionStart||0);this.applyValues(t)}else if(this.inputBase.type==="date")i.includes("-")?(this.inputBase.value=Hf(i),this.inputBase.valueDisplayed=i):i.includes("/")?(this.inputBase.value=i,this.inputBase.valueDisplayed=xf(i)):(this.inputBase.value=i,this.inputBase.valueDisplayed=i);else if(this.inputBase.type==="number"){let t=Af(i,this.inputBase.input&&this.inputBase.input.selectionStart||0);this.applyValues(t,!0,!1)}else if(this.inputBase.type==="currency"){let t=y9(i,this.inputBase.input&&this.inputBase.input.selectionStart||0,!1,this.lastSelectionStart);this.applyValues(t)}else this.inputBase.value=i,this.inputBase.valueDisplayed=this.inputBase.value;this.updateSelection()}autoFormatFinish(i){if(this.inputBase.type==="currency"){let t=y9(i,this.inputBase.input&&this.inputBase.input.selectionStart||0,!0,this.lastSelectionStart);this.applyValues(t,!1,!1)}this.updateSelection()}applyValues(i,t=!1,r=!0){this.inputBase.value=t?i.display:i.value?i.value:"",this.inputBase.valueDisplayed=i.display,this.inputBase.input&&(this.inputBase.input.value=i.display,r&&this.inputBase.input.setSelectionRange(i.selectionIndex,i.selectionIndex))}updateSelection(){this.lastSelectionStart=this.inputBase.input&&this.inputBase.input.selectionStart||0}}});function T(e,i){return(t,r)=>{let{update:a}=t;i=Object.assign({waitUntilFirstUpdate:!1},i),t.update=function(o){if(o.has(e)){let l=o.get(e),c=this[e];l!==c&&i&&(!i.waitUntilFirstUpdate||this.hasUpdated)&&this[r].call(this,l,c)}a.call(this,o)}}}var u3=C(()=>{"use strict"});var F,Of=C(()=>{Z3();g1();F=e1(class extends D3{constructor(e){var i;if(super(e),e.type!==Q.ATTRIBUTE||e.name!=="class"||((i=e.strings)===null||i===void 0?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(e){return" "+Object.keys(e).filter(i=>e[i]).join(" ")+" "}update(e,[i]){var t,r;if(this.nt===void 0){this.nt=new Set,e.strings!==void 0&&(this.st=new Set(e.strings.join(" ").split(/\s/).filter(o=>o!=="")));for(let o in i)i[o]&&!(!((t=this.st)===null||t===void 0)&&t.has(o))&&this.nt.add(o);return this.render(i)}let a=e.element.classList;this.nt.forEach(o=>{o in i||(a.remove(o),this.nt.delete(o))});for(let o in i){let l=!!i[o];l===this.nt.has(o)||((r=this.st)===null||r===void 0?void 0:r.has(o))||(l?(a.add(o),this.nt.add(o)):(a.remove(o),this.nt.delete(o)))}return r3}})});var x3=C(()=>{Of()});var Bf,If=C(()=>{Z3();g1();l5();Bf=e1(class extends D3{constructor(e){if(super(e),e.type!==Q.PROPERTY&&e.type!==Q.ATTRIBUTE&&e.type!==Q.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!j1(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[i]){if(i===r3||i===B)return i;let t=e.element,r=e.name;if(e.type===Q.PROPERTY){if(i===t[r])return r3}else if(e.type===Q.BOOLEAN_ATTRIBUTE){if(!!i===t.hasAttribute(r))return r3}else if(e.type===Q.ATTRIBUTE&&t.getAttribute(r)===i+"")return r3;return Th(e),i}})});var Nf=C(()=>{If()});var _2,M9=C(()=>{Z3();_2=e=>e!=null?e:B});var Rf={};n(Rf,{default:()=>U});var U,Tf=C(()=>{"use strict";_();k();w1();A();bf();u5();Y();Y();Sf();u3();x3();Nf();M9();U=class extends P{constructor(){super();this.type="text";this.autoCapitalize="none";this.autoComplete="on";this.autoCorrect="off";this.autoFocus=!1;this.inputmode="text";this.selectAllOnFocus=!1;this.hideFeedback=!1;this.defaultFeedback="";this.clearable=!1;this.dropdownText="";this.dropdownIcon="";this.inputSize="default";this.accept=null;this.valueDisplayed="";this.showPassword=!1;this.filePickerOpen=!1;this.hideDropdown=!0;this.showClear=!1;this.element="input-field",this.autoFormatter=new Q1(this),this.boundOutsideClickHandler=this.handleOutsideClick.bind(this)}static get styles(){return[super.styles,vf]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","group"),this.autoFormatter=new Q1(this),this.autoFormatter.autoFormat(this.value),this.autoFormatter.autoFormatFinish(this.value),this.dropdownText&&window.addEventListener("mousedown",this.boundOutsideClickHandler,!1)}disconnectedCallback(){this.dropdownText&&window.removeEventListener("mousedown",this.boundOutsideClickHandler),super.disconnectedCallback()}firstUpdated(){this.value&&this.valueHandler()}handleOutsideClick(t){t.composedPath().includes(this)||(this.hideDropdown=!0)}formatValue(){this.value!==this.lastFormattedValue&&(this.lastFormattedValue=this.value,this.autoFormatter.autoFormat(this.value),this.focused||this.autoFormatter.autoFormatFinish(this.value))}handleChange(){this.value=this.input.value,this.filePickerOpen=!1}valueHandler(){var t;this.formatValue(),this.value&&(this.type==="file"||this.clearable)?this.showClear=!0:this.showClear=!1,R("scw-value-change",this,{value:this.value,name:this.name,valueDisplayed:this.valueDisplayed,...this.type==="file"?{files:(t=this.input)==null?void 0:t.files}:{}})}handleShowPassword(){this.showPassword=!this.showPassword,this.requestUpdate()}handleInteraction(t){this.autoFormatter.updateSelection(),this.type==="file"&&t.type==="click"&&(this.filePickerOpen=!0)}handleKeydown(t){this.type==="currency"&&t.key==="Enter"&&this.autoFormatter.autoFormatFinish(this.value)}handleCancel(){this.filePickerOpen=!1}blurHandler(){this.autoFormatter.autoFormatFinish(this.value),R("scw-blur",this),this.focused=!1,this.filePickerOpen||this.validate()}handleClear(){this.value=""}focusHandler(){this.autoFormatter.updateSelection(),this.focused=!0,this.hideDropdown=!1,this.selectAllOnFocus&&this.input.setSelectionRange(0,this.input.value.length),R("scw-focus",this)}dropdownClick(){this.hideDropdown=!0,R("scw-dropdown",this),this.requestUpdate()}invalidHandler(t){t.preventDefault()}render(){let t={focused:this.focused,invalid:this.invalid,inputWrapper:!0,small:this.inputSize==="small",showFile:this.type==="file"&&this.value};return h`<div class=${F(t)}>
|
|
539
539
|
${this.label?h` <div class="input-label">
|
|
540
540
|
${this.label}${this.required?h`<span class="required-label">
|
|
541
541
|
${this.requiredLabel}
|
package/dist/scw.js.gz
CHANGED
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
constructor (config) {// version, extraCssPromise, config ) {
|
|
5
5
|
this.prefix = 'scw';// dynamic
|
|
6
|
-
this.buildUUID = '
|
|
6
|
+
this.buildUUID = '9629613e-db06-4b43-907a-fae951a8c1a6';// dynamic
|
|
7
7
|
|
|
8
8
|
this.generator = false;
|
|
9
9
|
this.initialized = false;
|
|
Binary file
|