@mhmo91/schmancy 0.2.21 → 0.2.22
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/{animated-text-DrjiBStC.js → animated-text-CUx9CM5O.js} +3 -3
- package/dist/{animated-text-DrjiBStC.js.map → animated-text-CUx9CM5O.js.map} +1 -1
- package/dist/{animated-text-VuDSGmJu.cjs → animated-text-Dj6eM2tE.cjs} +2 -2
- package/dist/{animated-text-VuDSGmJu.cjs.map → animated-text-Dj6eM2tE.cjs.map} +1 -1
- package/dist/animated-text.cjs +1 -1
- package/dist/animated-text.js +1 -1
- package/dist/area.cjs +1 -1
- package/dist/{area.component-BLglMVqv.js → area.component-B3adb0Y6.js} +3 -3
- package/dist/{area.component-BLglMVqv.js.map → area.component-B3adb0Y6.js.map} +1 -1
- package/dist/{area.component-qqTF9Cwv.cjs → area.component-Do3Jb3jC.cjs} +2 -2
- package/dist/{area.component-qqTF9Cwv.cjs.map → area.component-Do3Jb3jC.cjs.map} +1 -1
- package/dist/area.js +1 -1
- package/dist/{autocomplete-cGKAFBi1.js → autocomplete-BUOnKDbI.js} +3 -3
- package/dist/{autocomplete-cGKAFBi1.js.map → autocomplete-BUOnKDbI.js.map} +1 -1
- package/dist/{autocomplete-B0fc_Nh_.cjs → autocomplete-U3vu-siT.cjs} +2 -2
- package/dist/{autocomplete-B0fc_Nh_.cjs.map → autocomplete-U3vu-siT.cjs.map} +1 -1
- package/dist/autocomplete.cjs +1 -1
- package/dist/autocomplete.js +1 -1
- package/dist/busy.cjs +1 -1
- package/dist/busy.js +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/{checkbox-D9M3J9G8.js → checkbox-BWaWg2Gm.js} +2 -2
- package/dist/{checkbox-D9M3J9G8.js.map → checkbox-BWaWg2Gm.js.map} +1 -1
- package/dist/{checkbox-CFRY_WA9.cjs → checkbox-FZpN0Mgj.cjs} +2 -2
- package/dist/{checkbox-CFRY_WA9.cjs.map → checkbox-FZpN0Mgj.cjs.map} +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{chips-DK1t1fX8.cjs → chips-BoxKYOMa.cjs} +2 -2
- package/dist/{chips-DK1t1fX8.cjs.map → chips-BoxKYOMa.cjs.map} +1 -1
- package/dist/{chips-CCQq31in.js → chips-CRfhI-G7.js} +3 -3
- package/dist/{chips-CCQq31in.js.map → chips-CRfhI-G7.js.map} +1 -1
- package/dist/chips.cjs +1 -1
- package/dist/chips.js +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/{date-range-CyPVmgYc.js → date-range-2Zd4XvrS.js} +3 -3
- package/dist/{date-range-CyPVmgYc.js.map → date-range-2Zd4XvrS.js.map} +1 -1
- package/dist/{date-range-ojNc9Onw.cjs → date-range-X97ioY-h.cjs} +2 -2
- package/dist/{date-range-ojNc9Onw.cjs.map → date-range-X97ioY-h.cjs.map} +1 -1
- package/dist/date-range.cjs +1 -1
- package/dist/date-range.js +1 -1
- package/dist/{delay-BdpZfHDc.cjs → delay-BqTo3aLA.cjs} +2 -2
- package/dist/{delay-BdpZfHDc.cjs.map → delay-BqTo3aLA.cjs.map} +1 -1
- package/dist/{delay-75ofxuyx.js → delay-CwXLGveT.js} +2 -2
- package/dist/{delay-75ofxuyx.js.map → delay-CwXLGveT.js.map} +1 -1
- package/dist/delay.cjs +1 -1
- package/dist/delay.js +1 -1
- package/dist/{divider-_i9O2PBo.cjs → divider-BfxgNMsI.cjs} +2 -2
- package/dist/{divider-_i9O2PBo.cjs.map → divider-BfxgNMsI.cjs.map} +1 -1
- package/dist/{divider-C9o90_5e.js → divider-CdV7coS1.js} +3 -3
- package/dist/{divider-C9o90_5e.js.map → divider-CdV7coS1.js.map} +1 -1
- package/dist/divider.cjs +1 -1
- package/dist/divider.js +1 -1
- package/dist/{form-CqnEVlhB.cjs → form-BTnhPK7O.cjs} +2 -2
- package/dist/{form-CqnEVlhB.cjs.map → form-BTnhPK7O.cjs.map} +1 -1
- package/dist/{form-Cmp0Zkgn.js → form-DfGEOLag.js} +2 -2
- package/dist/{form-Cmp0Zkgn.js.map → form-DfGEOLag.js.map} +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.js +1 -1
- package/dist/{icon-DMpNiWR7.js → icon-B34qm8t_.js} +3 -3
- package/dist/{icon-DMpNiWR7.js.map → icon-B34qm8t_.js.map} +1 -1
- package/dist/{icon-CpZBVkRH.cjs → icon-DL24gxLi.cjs} +2 -2
- package/dist/{icon-CpZBVkRH.cjs.map → icon-DL24gxLi.cjs.map} +1 -1
- package/dist/{icon-button-BnakhpuT.cjs → icon-button-BXlgRBET.cjs} +2 -2
- package/dist/{icon-button-BnakhpuT.cjs.map → icon-button-BXlgRBET.cjs.map} +1 -1
- package/dist/{icon-button-DX3Zm-2u.js → icon-button-yOFOGX0Y.js} +3 -3
- package/dist/{icon-button-DX3Zm-2u.js.map → icon-button-yOFOGX0Y.js.map} +1 -1
- package/dist/icons.cjs +1 -1
- package/dist/icons.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +33 -33
- package/dist/{input-UMM0G3kS.js → input-B63-M9qj.js} +2 -2
- package/dist/{input-UMM0G3kS.js.map → input-B63-M9qj.js.map} +1 -1
- package/dist/{input-B2rV3JCi.cjs → input-C5Qe0WzY.cjs} +2 -2
- package/dist/{input-B2rV3JCi.cjs.map → input-C5Qe0WzY.cjs.map} +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/layout.cjs +1 -1
- package/dist/layout.js +1 -1
- package/dist/{list-DOnYlCys.cjs → list-BDw1aNOH.cjs} +2 -2
- package/dist/{list-DOnYlCys.cjs.map → list-BDw1aNOH.cjs.map} +1 -1
- package/dist/{list-fbJSJN44.js → list-C9kPT0mr.js} +2 -2
- package/dist/{list-fbJSJN44.js.map → list-C9kPT0mr.js.map} +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/{litElement.mixin-BnUdikbt.js → litElement.mixin-CJYb3izk.js} +2 -2
- package/dist/{litElement.mixin-BnUdikbt.js.map → litElement.mixin-CJYb3izk.js.map} +1 -1
- package/dist/{litElement.mixin-BGFFSTo6.cjs → litElement.mixin-Cw40wOLl.cjs} +2 -2
- package/dist/{litElement.mixin-BGFFSTo6.cjs.map → litElement.mixin-Cw40wOLl.cjs.map} +1 -1
- package/dist/{menu-BXkQgdTe.js → menu-B-9Sd5xU.js} +3 -3
- package/dist/{menu-BXkQgdTe.js.map → menu-B-9Sd5xU.js.map} +1 -1
- package/dist/{menu-BZyh3Omd.cjs → menu-BezCg_ZV.cjs} +2 -2
- package/dist/{menu-BZyh3Omd.cjs.map → menu-BezCg_ZV.cjs.map} +1 -1
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/notification.cjs +1 -1
- package/dist/notification.js +1 -1
- package/dist/{option-DC1BiTB1.cjs → option-Ds6sb35B.cjs} +2 -2
- package/dist/{option-DC1BiTB1.cjs.map → option-Ds6sb35B.cjs.map} +1 -1
- package/dist/{option-DLU4N2ZE.js → option-ETcMXlUc.js} +2 -2
- package/dist/{option-DLU4N2ZE.js.map → option-ETcMXlUc.js.map} +1 -1
- package/dist/option.cjs +1 -1
- package/dist/option.js +1 -1
- package/dist/outlet-BDkD7_9L.cjs +61 -0
- package/dist/outlet-BDkD7_9L.cjs.map +1 -0
- package/dist/outlet-Bc4MC45j.js +124 -0
- package/dist/outlet-Bc4MC45j.js.map +1 -0
- package/dist/{payment-card-form-DT2MgPCZ.cjs → payment-card-form-BXq6Mxck.cjs} +2 -2
- package/dist/{payment-card-form-DT2MgPCZ.cjs.map → payment-card-form-BXq6Mxck.cjs.map} +1 -1
- package/dist/{payment-card-form-D2wNtJk-.js → payment-card-form-yjKqadtl.js} +3 -3
- package/dist/{payment-card-form-D2wNtJk-.js.map → payment-card-form-yjKqadtl.js.map} +1 -1
- package/dist/{radio-group-WV66V12S.cjs → radio-group-B3jrTLIL.cjs} +2 -2
- package/dist/{radio-group-WV66V12S.cjs.map → radio-group-B3jrTLIL.cjs.map} +1 -1
- package/dist/{radio-group-BAXIANqT.js → radio-group-SZ7LT0BI.js} +2 -2
- package/dist/{radio-group-BAXIANqT.js.map → radio-group-SZ7LT0BI.js.map} +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/{scroll-BxE0fD2e.js → scroll-BZXWpgyx.js} +2 -2
- package/dist/{scroll-BxE0fD2e.js.map → scroll-BZXWpgyx.js.map} +1 -1
- package/dist/{scroll-CD1V-q-_.cjs → scroll-DIBR9WHR.cjs} +2 -2
- package/dist/{scroll-CD1V-q-_.cjs.map → scroll-DIBR9WHR.cjs.map} +1 -1
- package/dist/{select-CV8IdXQf.js → select-DP9QxGkH.js} +3 -3
- package/dist/{select-CV8IdXQf.js.map → select-DP9QxGkH.js.map} +1 -1
- package/dist/{select-BP6OE_lC.cjs → select-ExBspAsr.cjs} +2 -2
- package/dist/{select-BP6OE_lC.cjs.map → select-ExBspAsr.cjs.map} +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/{sheet-8CI6hWJb.cjs → sheet-CJ6kO7WG.cjs} +16 -17
- package/dist/{sheet-8CI6hWJb.cjs.map → sheet-CJ6kO7WG.cjs.map} +1 -1
- package/dist/{sheet-DD-6Y1DB.js → sheet-CoO8bSHc.js} +25 -24
- package/dist/{sheet-DD-6Y1DB.js.map → sheet-CoO8bSHc.js.map} +1 -1
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +1 -1
- package/dist/{slider-B12L6AxV.js → slider-D4GAHeMx.js} +3 -3
- package/dist/{slider-B12L6AxV.js.map → slider-D4GAHeMx.js.map} +1 -1
- package/dist/{slider-BEGG7odV.cjs → slider-DEaQC5Qe.cjs} +2 -2
- package/dist/{slider-BEGG7odV.cjs.map → slider-DEaQC5Qe.cjs.map} +1 -1
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +1 -1
- package/dist/{spinner-vK7ZLqSI.cjs → spinner-BJ5VG2fV.cjs} +2 -2
- package/dist/{spinner-vK7ZLqSI.cjs.map → spinner-BJ5VG2fV.cjs.map} +1 -1
- package/dist/{spinner-Qncx6I22.js → spinner-_aBya_Qc.js} +3 -3
- package/dist/{spinner-Qncx6I22.js.map → spinner-_aBya_Qc.js.map} +1 -1
- package/dist/{surface-pByMeeQt.cjs → surface-DKrkxarv.cjs} +2 -2
- package/dist/{surface-pByMeeQt.cjs.map → surface-DKrkxarv.cjs.map} +1 -1
- package/dist/{surface-DYJn8g9F.js → surface-DlwQilPV.js} +2 -2
- package/dist/{surface-DYJn8g9F.js.map → surface-DlwQilPV.js.map} +1 -1
- package/dist/surface.cjs +1 -1
- package/dist/surface.js +1 -1
- package/dist/{table-DduFFvUh.cjs → table-BmyyQrx8.cjs} +2 -2
- package/dist/{table-DduFFvUh.cjs.map → table-BmyyQrx8.cjs.map} +1 -1
- package/dist/{table-DvOkIhMb.js → table-Ds0ivk4n.js} +2 -2
- package/dist/{table-DvOkIhMb.js.map → table-Ds0ivk4n.js.map} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.js +1 -1
- package/dist/{tabs-group-BBByN_wj.cjs → tabs-group-2sFsKJxb.cjs} +2 -2
- package/dist/{tabs-group-BBByN_wj.cjs.map → tabs-group-2sFsKJxb.cjs.map} +1 -1
- package/dist/{tabs-group-Wohd6x3I.js → tabs-group-OdIAitHN.js} +2 -2
- package/dist/{tabs-group-Wohd6x3I.js.map → tabs-group-OdIAitHN.js.map} +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/{tailwind.mixin-bRVZL2lY.cjs → tailwind.mixin-mhYVlkxs.cjs} +2 -2
- package/dist/{tailwind.mixin-bRVZL2lY.cjs.map → tailwind.mixin-mhYVlkxs.cjs.map} +1 -1
- package/dist/{tailwind.mixin-jeUK-Doz.js → tailwind.mixin-wwBoa4Jw.js} +15 -15
- package/dist/{tailwind.mixin-jeUK-Doz.js.map → tailwind.mixin-wwBoa4Jw.js.map} +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/{teleport.component-DRoH0z1s.cjs → teleport.component-MYrtD0Li.cjs} +2 -2
- package/dist/{teleport.component-DRoH0z1s.cjs.map → teleport.component-MYrtD0Li.cjs.map} +1 -1
- package/dist/{teleport.component-nuRb4cB_.js → teleport.component-SInaGefV.js} +35 -35
- package/dist/{teleport.component-nuRb4cB_.js.map → teleport.component-SInaGefV.js.map} +1 -1
- package/dist/teleport.js +1 -1
- package/dist/{textarea-DnIefaLe.cjs → textarea-DE-5ySnu.cjs} +2 -2
- package/dist/{textarea-DnIefaLe.cjs.map → textarea-DE-5ySnu.cjs.map} +1 -1
- package/dist/{textarea-BfzMpFnt.js → textarea-p0XofIBJ.js} +2 -2
- package/dist/{textarea-BfzMpFnt.js.map → textarea-p0XofIBJ.js.map} +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{theme-button-C5ReoqDx.js → theme-button-BczCoNKk.js} +2 -2
- package/dist/{theme-button-C5ReoqDx.js.map → theme-button-BczCoNKk.js.map} +1 -1
- package/dist/{theme-button-B0kxPZka.cjs → theme-button-HfAO7YLi.cjs} +2 -2
- package/dist/{theme-button-B0kxPZka.cjs.map → theme-button-HfAO7YLi.cjs.map} +1 -1
- package/dist/theme-button.cjs +1 -1
- package/dist/theme-button.js +1 -1
- package/dist/theme.cjs +1 -1
- package/dist/{theme.component-CbQ3s3hX.cjs → theme.component-78M08LUD.cjs} +2 -2
- package/dist/{theme.component-CbQ3s3hX.cjs.map → theme.component-78M08LUD.cjs.map} +1 -1
- package/dist/{theme.component-wMpGPTus.js → theme.component-CKmrq6vY.js} +2 -2
- package/dist/{theme.component-wMpGPTus.js.map → theme.component-CKmrq6vY.js.map} +1 -1
- package/dist/theme.js +1 -1
- package/dist/{tree-BKd26LdC.cjs → tree-C0L22or-.cjs} +2 -2
- package/dist/{tree-BKd26LdC.cjs.map → tree-C0L22or-.cjs.map} +1 -1
- package/dist/{tree-DN5gv8hS.js → tree-CJueZNtq.js} +2 -2
- package/dist/{tree-DN5gv8hS.js.map → tree-CJueZNtq.js.map} +1 -1
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/{typewriter-FnhgAazS.js → typewriter-DOVBdtxY.js} +4 -4
- package/dist/{typewriter-FnhgAazS.js.map → typewriter-DOVBdtxY.js.map} +1 -1
- package/dist/{typewriter-jklG56Kf.cjs → typewriter-n3ITVaff.cjs} +2 -2
- package/dist/{typewriter-jklG56Kf.cjs.map → typewriter-n3ITVaff.cjs.map} +1 -1
- package/dist/typewriter.cjs +1 -1
- package/dist/typewriter.js +1 -1
- package/dist/{typography-CPFqZt0d.js → typography-BRiJcJhp.js} +2 -2
- package/dist/{typography-CPFqZt0d.js.map → typography-BRiJcJhp.js.map} +1 -1
- package/dist/{typography-D5hY_euh.cjs → typography-bMZIS2rJ.cjs} +2 -2
- package/dist/{typography-D5hY_euh.cjs.map → typography-bMZIS2rJ.cjs.map} +1 -1
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +1 -1
- package/package.json +1 -1
- package/dist/outlet-B1D2BYCl.cjs +0 -66
- package/dist/outlet-B1D2BYCl.cjs.map +0 -1
- package/dist/outlet-DuNsi1ZI.js +0 -129
- package/dist/outlet-DuNsi1ZI.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";require("rxjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const c=require("./tailwind.mixin-
|
|
1
|
+
"use strict";require("rxjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const c=require("./tailwind.mixin-mhYVlkxs.cjs"),u=require("lit"),i=require("lit/decorators.js");var h=Object.defineProperty,y=Object.getOwnPropertyDescriptor,n=(t,e,a,s)=>{for(var l,r=s>1?void 0:s?y(e,a):e,p=t.length-1;p>=0;p--)(l=t[p])&&(r=(s?l(e,a,r):l(r))||r);return s&&r&&h(e,a,r),r};let o=class extends c.TailwindElement(){constructor(){super(...arguments),this.value="",this.selected=!1}handleOptionClick(t){this.value=t,this.dispatchEvent(new CustomEvent("click",{detail:{value:t,label:this.label??this.innerText},bubbles:!0,composed:!0}))}render(){const t={"font-semibold relative cursor-pointer py-2 px-3":!0,"bg-secondary-container text-secondery-onContainer":this.selected};return u.html` <li
|
|
2
2
|
tabindex="0"
|
|
3
3
|
class="${this.classMap(t)}"
|
|
4
4
|
role="option"
|
|
@@ -11,4 +11,4 @@
|
|
|
11
11
|
<slot name="support"></slot>
|
|
12
12
|
</schmancy-flex>
|
|
13
13
|
</li>`}};n([i.property({type:String,reflect:!0})],o.prototype,"value",2),n([i.property({type:String,reflect:!0})],o.prototype,"label",2),n([i.property({type:Boolean})],o.prototype,"selected",2),o=n([i.customElement("schmancy-option")],o);
|
|
14
|
-
//# sourceMappingURL=option-
|
|
14
|
+
//# sourceMappingURL=option-Ds6sb35B.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-
|
|
1
|
+
{"version":3,"file":"option-Ds6sb35B.cjs","sources":["../src/option/option.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nexport type SchmancyOptionChangeEvent = CustomEvent<{\n\tvalue: string\n\tlabel: string\n}>\n@customElement('schmancy-option')\nexport default class SchmancyOption extends TailwindElement() {\n\t@property({ type: String, reflect: true }) value: string = ''\n\t@property({ type: String, reflect: true }) label: string | undefined\n\t@property({ type: Boolean }) selected: boolean = false\n\n\thandleOptionClick(option: string) {\n\t\tthis.value = option\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('click', {\n\t\t\t\tdetail: { value: option, label: this.label ?? this.innerText },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}) as SchmancyOptionChangeEvent,\n\t\t)\n\t}\n\n\tprotected render(): unknown {\n\t\tconst classes = {\n\t\t\t'font-semibold relative cursor-pointer py-2 px-3': true,\n\t\t\t'bg-secondary-container text-secondery-onContainer': this.selected,\n\t\t}\n\t\tconst stateLayerClasses = {\n\t\t\t'duration-500 transition-opacity': true,\n\t\t\t'hover:bg-surface-on opacity-[0.08] cursor-pointer absolute inset-0': true,\n\t\t}\n\n\t\treturn html` <li\n\t\t\ttabindex=\"0\"\n\t\t\tclass=\"${this.classMap(classes)}\"\n\t\t\trole=\"option\"\n\t\t\t@click=${e => {\n\t\t\t\te.stopPropagation()\n\t\t\t\te.preventDefault()\n\t\t\t\tthis.handleOptionClick(this.value)\n\t\t\t}}\n\t\t\t@keydown=${e => {\n\t\t\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\t\t\te.stopPropagation()\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\tthis.handleOptionClick(this.value)\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<div class=\"${this.classMap(stateLayerClasses)}\"></div>\n\t\t\t<schmancy-flex align=\"center\" justify=\"between\">\n\t\t\t\t<slot></slot>\n\t\t\t\t<slot name=\"support\"></slot>\n\t\t\t</schmancy-flex>\n\t\t</li>`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-option': SchmancyOption\n\t}\n}\n"],"names":["SchmancyOption","TailwindElement","super","arguments","this","value","selected","option","dispatchEvent","CustomEvent","detail","label","innerText","bubbles","composed","render","classes","html","classMap","e","stopPropagation","preventDefault","handleOptionClick","key","__decorateClass","property","type","String","reflect","prototype","Boolean","customElement"],"mappings":"4YAQA,IAAqBA,EAArB,cAA4CC,EAAAA,gBAA5C,CAAA,CAAA,aAAAC,CAAAA,MAAAA,GAAAC,SAC4DC,EAAAA,KAAAC,MAAA,GAEVD,KAAAE,SAAAA,EAAA,CAEjD,kBAAkBC,EACjBH,CAAAA,KAAKC,MAAQE,EACRH,KAAAI,cACJ,IAAIC,YAAY,QAAS,CACxBC,OAAQ,CAAEL,MAAOE,EAAQI,MAAOP,KAAKO,OAASP,KAAKQ,SACnDC,EAAAA,QAAAA,GACAC,SAAAA,EAEF,CAAA,CAAA,CAAA,CAGS,QAAAC,CACT,MAAMC,EAAU,CACf,kDAAA,GACA,oDAAqDZ,KAAKE,QAAAA,EAOpD,OAAAW;;YAEGb,KAAKc,SAASF,CAAAA,CAAAA;AAAAA;AAAAA,YAETG,GAAAA,CACbA,EAAEC,gBACFD,EAAAA,EAAEE,iBACGjB,KAAAkB,kBAAkBlB,KAAKC,KAAK,CAAA,CAAA;AAAA,cAElBc,GAAAA,CACXA,EAAEI,MAAQ,SAAWJ,EAAEI,MAAQ,MAClCJ,EAAEC,gBAAAA,EACFD,EAAEE,eAAAA,EACGjB,KAAAkB,kBAAkBlB,KAAKC,KAAK,EAAA,CAAA;AAAA;AAAA,iBAIrBD,KAAKc,SAtBM,CACzB,kCAAmC,GACnC,qEAAsE,EAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAoBxB,CAAA,EA1CLM,EAAA,CAA1CC,EAAAA,SAAS,CAAEC,KAAMC,OAAQC,QAAS,EAAA,CAAA,CAAA,EADf5B,EACuB6B,UAAA,QAAA,GACAL,EAAA,CAA1CC,EAAAA,SAAS,CAAEC,KAAMC,OAAQC,QAAAA,EAFN5B,CAAAA,CAAAA,EAAAA,EAEuB6B,UAAA,QAAA,CAAA,EACdL,EAAA,CAA5BC,WAAS,CAAEC,KAAMI,WAHE9B,EAGS6B,UAAA,WAAA,CAHT7B,EAAAA,EAArBwB,EAAA,CADCO,EAAAA,cAAc,iBACM/B,CAAAA,EAAAA,CAAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "rxjs";
|
|
2
2
|
import "lit/directives/class-map.js";
|
|
3
3
|
import "lit/directives/style-map.js";
|
|
4
|
-
import { T as c } from "./tailwind.mixin-
|
|
4
|
+
import { T as c } from "./tailwind.mixin-wwBoa4Jw.js";
|
|
5
5
|
import { html as h } from "lit";
|
|
6
6
|
import { property as p, customElement as u } from "lit/decorators.js";
|
|
7
7
|
var d = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (t, e, n, s) => {
|
|
@@ -37,4 +37,4 @@ let r = class extends c() {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
i([p({ type: String, reflect: !0 })], r.prototype, "value", 2), i([p({ type: String, reflect: !0 })], r.prototype, "label", 2), i([p({ type: Boolean })], r.prototype, "selected", 2), r = i([u("schmancy-option")], r);
|
|
40
|
-
//# sourceMappingURL=option-
|
|
40
|
+
//# sourceMappingURL=option-ETcMXlUc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-
|
|
1
|
+
{"version":3,"file":"option-ETcMXlUc.js","sources":["../src/option/option.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nexport type SchmancyOptionChangeEvent = CustomEvent<{\n\tvalue: string\n\tlabel: string\n}>\n@customElement('schmancy-option')\nexport default class SchmancyOption extends TailwindElement() {\n\t@property({ type: String, reflect: true }) value: string = ''\n\t@property({ type: String, reflect: true }) label: string | undefined\n\t@property({ type: Boolean }) selected: boolean = false\n\n\thandleOptionClick(option: string) {\n\t\tthis.value = option\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('click', {\n\t\t\t\tdetail: { value: option, label: this.label ?? this.innerText },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}) as SchmancyOptionChangeEvent,\n\t\t)\n\t}\n\n\tprotected render(): unknown {\n\t\tconst classes = {\n\t\t\t'font-semibold relative cursor-pointer py-2 px-3': true,\n\t\t\t'bg-secondary-container text-secondery-onContainer': this.selected,\n\t\t}\n\t\tconst stateLayerClasses = {\n\t\t\t'duration-500 transition-opacity': true,\n\t\t\t'hover:bg-surface-on opacity-[0.08] cursor-pointer absolute inset-0': true,\n\t\t}\n\n\t\treturn html` <li\n\t\t\ttabindex=\"0\"\n\t\t\tclass=\"${this.classMap(classes)}\"\n\t\t\trole=\"option\"\n\t\t\t@click=${e => {\n\t\t\t\te.stopPropagation()\n\t\t\t\te.preventDefault()\n\t\t\t\tthis.handleOptionClick(this.value)\n\t\t\t}}\n\t\t\t@keydown=${e => {\n\t\t\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\t\t\te.stopPropagation()\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\tthis.handleOptionClick(this.value)\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<div class=\"${this.classMap(stateLayerClasses)}\"></div>\n\t\t\t<schmancy-flex align=\"center\" justify=\"between\">\n\t\t\t\t<slot></slot>\n\t\t\t\t<slot name=\"support\"></slot>\n\t\t\t</schmancy-flex>\n\t\t</li>`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-option': SchmancyOption\n\t}\n}\n"],"names":["SchmancyOption","TailwindElement","super","arguments","this","value","selected","option","dispatchEvent","CustomEvent","detail","label","innerText","bubbles","composed","classes","html","classMap","e","stopPropagation","preventDefault","handleOptionClick","key","__decorateClass","property","type","String","reflect","prototype","Boolean","customElement"],"mappings":";;;;;;;;;;AAQA,IAAqBA,IAArB,cAA4CC,EAA5C,EAAA;AAAA,EAAA,cAAAC;AAAAA,UAAAA,GAAAC,SAC4DC,GAAAA,KAAAC,QAAA,IAEVD,KAAAE,WAAA;AAAA,EAAA;AAAA,EAEjD,kBAAkBC,GAAAA;AACjBH,SAAKC,QAAQE,GACRH,KAAAI,cACJ,IAAIC,YAAY,SAAS,EACxBC,QAAQ,EAAEL,OAAOE,GAAQI,OAAOP,KAAKO,SAASP,KAAKQ,UACnDC,GAAAA,SAAAA,IACAC,UAAAA;EAEF;AAAA,EAGS,SACT;AAAA,UAAMC,IAAU,EACf,mDAAmD,IACnD,qDAAqDX,KAAKE,SAOpD;AAAA,WAAAU;AAAAA;AAAAA,YAEGZ,KAAKa,SAASF,CAAAA,CAAAA;AAAAA;AAAAA,YAETG,CAAAA,MAAAA;AACbA,MAAAA,EAAEC,gBACFD,GAAAA,EAAEE,kBACGhB,KAAAiB,kBAAkBjB,KAAKC,KAAK;AAAA,IAAA,CAAA;AAAA,cAElBa,CAAAA,MAAAA;AACD,MAAVA,EAAEI,QAAQ,WAAWJ,EAAEI,QAAQ,QAClCJ,EAAEC,gBAAAA,GACFD,EAAEE,eAAAA,GACGhB,KAAAiB,kBAAkBjB,KAAKC,KAAK;AAAA,IAAA,CAAA;AAAA;AAAA,iBAIrBD,KAAKa,SAtBM,EACzB,mCAAmC,IACnC,sEAAsE,GAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBxB;AAAA;AA1CLM,EAAA,CAA1CC,EAAS,EAAEC,MAAMC,QAAQC,SAAS,GAAA,CAAA,CAAA,GADf3B,EACuB4B,WAAA,SAAA,CACAL,GAAAA,EAAA,CAA1CC,EAAS,EAAEC,MAAMC,QAAQC,SAAAA,GAFN3B,CAAAA,CAAAA,GAAAA,EAEuB4B,WAAA,SAAA,CAAA,GACdL,EAAA,CAA5BC,EAAS,EAAEC,MAAMI,QAHE7B,CAAAA,CAAAA,GAAAA,EAGS4B,WAAA,YAAA,CAAA,GAHT5B,IAArBuB,EAAA,CADCO,EAAc,iBACM9B,CAAAA,GAAAA,CAAAA;"}
|
package/dist/option.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("./option-
|
|
1
|
+
"use strict";require("./option-Ds6sb35B.cjs");
|
|
2
2
|
//# sourceMappingURL=option.cjs.map
|
package/dist/option.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./option-
|
|
1
|
+
import "./option-ETcMXlUc.js";
|
|
2
2
|
//# sourceMappingURL=option.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";const a=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const p=require("./tailwind.mixin-mhYVlkxs.cjs"),u=require("lit"),d=require("lit/decorators.js");function l(n,e){const t=document.createElement("schmancy-notification");return t.setAttribute("type",e),t.innerHTML=n,t}const r=new a.Subject,f={success:(n,e)=>{const t=l(n,"success");return r.next({component:t,config:e}),t},error:(n,e)=>{const t=l(n,"error");return r.next({component:t,config:e}),t},warning:(n,e)=>{const t=l(n,"warning");return r.next({component:t,config:e}),t},info:(n,e)=>{const t=l(n,"info");return r.next({component:t,config:e}),t}};r.pipe(a.buffer(r.pipe(a.debounceTime(1e3)))).subscribe(n=>{if(n.length>1){const e=n[n.length-1];r.next({component:e.component,config:e.config})}}),r.subscribe(({component:n,config:e})=>{var t;(t=document.body)==null||t.appendChild(n),a.race(a.fromEvent(n,"close"),a.timer((e==null?void 0:e.duration)??3e3)).subscribe(()=>{n.remove()})});var v=Object.defineProperty,h=Object.getOwnPropertyDescriptor,m=(n,e,t,c)=>{for(var o,i=c>1?void 0:c?h(e,t):e,s=n.length-1;s>=0;s--)(o=n[s])&&(i=(c?o(e,t,i):o(i))||i);return c&&i&&v(e,t,i),i};exports.SchmancyNotification=class extends p.TailwindElement(){constructor(){super(...arguments),this.type="success"}render(){return u.html`
|
|
2
|
+
<div
|
|
3
|
+
aria-live="assertive"
|
|
4
|
+
class="pointer-events-none z-100 fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6"
|
|
5
|
+
>
|
|
6
|
+
<div class="flex w-full flex-col items-center space-y-4 sm:items-end">
|
|
7
|
+
<div
|
|
8
|
+
class="pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-surface-container shadow-lg ring-1 ring-outlineVariant ring-opacity-5"
|
|
9
|
+
>
|
|
10
|
+
<div class="p-2">
|
|
11
|
+
<div class="flex items-center">
|
|
12
|
+
<div class="shrink-0">
|
|
13
|
+
${this.type==="success"?u.html` <svg
|
|
14
|
+
class="h-6 w-6 text-success-default"
|
|
15
|
+
fill="none"
|
|
16
|
+
viewBox="0 0 24 24"
|
|
17
|
+
stroke-width="1.5"
|
|
18
|
+
stroke="currentColor"
|
|
19
|
+
aria-hidden="true"
|
|
20
|
+
>
|
|
21
|
+
<path
|
|
22
|
+
stroke-linecap="round"
|
|
23
|
+
stroke-linejoin="round"
|
|
24
|
+
d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
25
|
+
/>
|
|
26
|
+
</svg>`:u.html` <svg
|
|
27
|
+
class="h-6 w-6 text-error-default"
|
|
28
|
+
fill="none"
|
|
29
|
+
viewBox="0 0 24 24"
|
|
30
|
+
stroke-width="1.5"
|
|
31
|
+
stroke="currentColor"
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
>
|
|
34
|
+
<path
|
|
35
|
+
stroke-linecap="round"
|
|
36
|
+
stroke-linejoin="round"
|
|
37
|
+
d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"
|
|
38
|
+
/>
|
|
39
|
+
</svg>`}
|
|
40
|
+
</div>
|
|
41
|
+
<div class="ml-3 w-0 flex-1 pt-0.5">
|
|
42
|
+
<p class=" text-sm ">
|
|
43
|
+
<slot></slot>
|
|
44
|
+
</p>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="ml-4 flex shrink-0">
|
|
47
|
+
<schmancy-icon-button
|
|
48
|
+
type="button"
|
|
49
|
+
@click=${()=>{this.dispatchEvent(new CustomEvent("close"))}}
|
|
50
|
+
>
|
|
51
|
+
<span class="sr-only">Close</span>
|
|
52
|
+
close
|
|
53
|
+
</schmancy-icon-button>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
`}},m([d.property({type:String})],exports.SchmancyNotification.prototype,"type",2),exports.SchmancyNotification=m([d.customElement("schmancy-notification")],exports.SchmancyNotification);var y=Object.defineProperty,g=Object.getOwnPropertyDescriptor;exports.SchmancyNotificationOutlet=class extends p.TailwindElement(){render(){return u.html` <slot></slot> `}},exports.SchmancyNotificationOutlet=((n,e,t,c)=>{for(var o,i=c>1?void 0:c?g(e,t):e,s=n.length-1;s>=0;s--)(o=n[s])&&(i=(c?o(e,t,i):o(i))||i);return c&&i&&y(e,t,i),i})([d.customElement("schmancy-notification-outlet")],exports.SchmancyNotificationOutlet),exports.$notify=f;
|
|
61
|
+
//# sourceMappingURL=outlet-BDkD7_9L.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlet-BDkD7_9L.cjs","sources":["../src/notification/$notification.ts","../src/notification/notification.ts","../src/notification/outlet.ts"],"sourcesContent":["import { Subject, buffer, debounceTime, fromEvent, race, timer } from 'rxjs'\nimport { SchmancyNotification } from './notification'\n\nexport type TNotification = 'success' | 'error' | 'warning' | 'info'\nexport type TNotificationConfig = {\n action?: typeof Function\n duration?: number\n}\n\nfunction createNotificationComponent(message, type) {\n const notificationComponent = document.createElement('schmancy-notification')\n notificationComponent.setAttribute('type', type)\n notificationComponent.innerHTML = message\n return notificationComponent\n}\nconst $notifications = new Subject<{\n component: SchmancyNotification\n config?: TNotificationConfig\n}>()\nexport const $notify = {\n success: (message: string, config?: TNotificationConfig) => {\n const component = createNotificationComponent(message, 'success')\n $notifications.next({ component, config })\n return component\n },\n error: (message: string, config?: TNotificationConfig) => {\n const component = createNotificationComponent(message, 'error')\n $notifications.next({ component, config })\n return component\n },\n warning: (message: string, config?: TNotificationConfig) => {\n const component = createNotificationComponent(message, 'warning')\n $notifications.next({ component, config })\n return component\n },\n info: (message: string, config?: TNotificationConfig) => {\n const component = createNotificationComponent(message, 'info')\n $notifications.next({ component, config })\n return component\n }\n}\n\n$notifications.pipe(buffer($notifications.pipe(debounceTime(1000)))).subscribe((notifications) => {\n if (notifications.length > 1) {\n const notification = notifications[notifications.length - 1]\n $notifications.next({ component: notification.component, config: notification.config })\n }\n})\n$notifications.subscribe(({ component, config }) => {\n document.body?.appendChild(component)\n race(fromEvent(component, 'close'), timer(config?.duration ?? 3000)).subscribe(() => {\n component.remove()\n })\n})\n","import { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n@customElement('schmancy-notification')\nexport class SchmancyNotification extends TailwindElement() {\n\t@property({ type: String })\n\ttype: 'success' | 'error' | 'warning' | 'info' = 'success'\n\n\trender() {\n\t\treturn html`\n\t\t\t<div\n\t\t\t\taria-live=\"assertive\"\n\t\t\t\tclass=\"pointer-events-none z-100 fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6\"\n\t\t\t>\n\t\t\t\t<div class=\"flex w-full flex-col items-center space-y-4 sm:items-end\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-surface-container shadow-lg ring-1 ring-outlineVariant ring-opacity-5\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div class=\"p-2\">\n\t\t\t\t\t\t\t<div class=\"flex items-center\">\n\t\t\t\t\t\t\t\t<div class=\"shrink-0\">\n\t\t\t\t\t\t\t\t\t${this.type === 'success'\n\t\t\t\t\t\t\t\t\t\t? html` <svg\n\t\t\t\t\t\t\t\t\t\t\t\tclass=\"h-6 w-6 text-success-default\"\n\t\t\t\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\t\t\t\t\tstroke-width=\"1.5\"\n\t\t\t\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\t\t\t\t\t\t\td=\"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</svg>`\n\t\t\t\t\t\t\t\t\t\t: html` <svg\n\t\t\t\t\t\t\t\t\t\t\t\tclass=\"h-6 w-6 text-error-default\"\n\t\t\t\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\t\t\t\t\tstroke-width=\"1.5\"\n\t\t\t\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\t\t\t\t\t\t\td=\"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z\"\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</svg>`}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"ml-3 w-0 flex-1 pt-0.5\">\n\t\t\t\t\t\t\t\t\t<p class=\" text-sm \">\n\t\t\t\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"ml-4 flex shrink-0\">\n\t\t\t\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\t\t\t\tthis.dispatchEvent(new CustomEvent('close'))\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<span class=\"sr-only\">Close</span>\n\t\t\t\t\t\t\t\t\t\tclose\n\t\t\t\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-notification': SchmancyNotification\n\t}\n}\n","import { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\n@customElement('schmancy-notification-outlet')\nexport class SchmancyNotificationOutlet extends TailwindElement() {\n\trender() {\n\t\treturn html` <slot></slot> `\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-notification-outlet': SchmancyNotificationOutlet\n\t}\n}\n"],"names":["createNotificationComponent","message","type","notificationComponent","document","createElement","setAttribute","innerHTML","$notifications","Subject","$notify","success","config","component","next","error","warning","info","pipe","buffer","debounceTime","subscribe","notifications","length","notification","body","appendChild","race","fromEvent","timer","duration","remove","SchmancyNotification","TailwindElement","constructor","super","arguments","this","render","html","dispatchEvent","CustomEvent","__decorateClass","property","String","prototype","customElement","SchmancyNotificationOutlet"],"mappings":"oNASA,SAASA,EAA4BC,EAASC,EAAAA,CACtC,MAAAC,EAAwBC,SAASC,cAAc,uBAG9C,EAAA,OAFeF,EAAAG,aAAa,OAAQJ,CAC3CC,EAAAA,EAAsBI,UAAYN,EAC3BE,CACT,CACA,MAAMK,EAAiB,IAAIC,EAAAA,QAIdC,EAAU,CACrBC,QAAS,CAACV,EAAiBW,IACnB,CAAA,MAAAC,EAAYb,EAA4BC,EAAS,SAAA,EAEhD,OADPO,EAAeM,KAAK,CAAED,UAAWD,EAAAA,OAAAA,CAAAA,CAAAA,EAC1BC,CAAA,EAETE,MAAO,CAACd,EAAiBW,IACjB,CAAA,MAAAC,EAAYb,EAA4BC,EAAS,OAAA,EAEhD,OADPO,EAAeM,KAAK,CAAED,YAAWD,OAC1BC,CAAAA,CAAAA,EAAAA,CAAA,EAETG,QAAS,CAACf,EAAiBW,IACnB,CAAA,MAAAC,EAAYb,EAA4BC,EAAS,SAAA,EAEhD,OADPO,EAAeM,KAAK,CAAED,UAAAA,EAAWD,OAC1BC,CAAAA,CAAAA,EAAAA,CAAA,EAETI,KAAM,CAAChB,EAAiBW,IAChB,CAAA,MAAAC,EAAYb,EAA4BC,EAAS,MAAA,EAEhD,OADPO,EAAeM,KAAK,CAAED,UAAWD,EAAAA,OAAAA,CAAAA,CAAAA,EAC1BC,CAAA,CAAA,EAIXL,EAAeU,KAAKC,EAAAA,OAAOX,EAAeU,KAAKE,EAAAA,aAAa,QAASC,UAAWC,GAAAA,CAC1E,GAAAA,EAAcC,OAAS,EAAG,CAC5B,MAAMC,EAAeF,EAAcA,EAAcC,OAAS,CAC3Cf,EAAAA,EAAAM,KAAK,CAAED,UAAWW,EAAaX,UAAWD,OAAQY,EAAaZ,MAAQ,CAAA,CAAA,CAAA,CAAA,EAG1FJ,EAAea,UAAU,CAAGR,CAAAA,UAAAA,EAAWD,OAC5BR,CAAAA,IAAAA,QAAAA,EAAAA,SAAAqB,OAAArB,MAAAA,EAAMsB,YAAYb,GACtBc,EAAAA,KAAAC,EAAAA,UAAUf,EAAW,OAAA,EAAUgB,EAAAA,OAAMjB,GAAAA,YAAAA,EAAQkB,WAAY,GAAOT,CAAAA,EAAAA,UAAU,IAC7ER,CAAAA,EAAUkB,OAAO,CAAA,CAAA,CAClB,mMChDUC,QAAAA,qBAAN,cAAmCC,EAAAA,gBAAAA,CAAAA,CAAnC,aAAAC,CAAAC,MAAAC,GAAAA,SAAAA,EAE2CC,KAAAnC,KAAA,SAAA,CAEjD,QAAAoC,CACQ,OAAAC,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,WAYEF,KAAKnC,OAAS,UACbqC;;;;;;;;;;;;;mBAcAA,EAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;;;;;;;;;;mBAuBO,IAAA,CACRF,KAAKG,cAAc,IAAIC,YAAY,OAAQ,CAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAC3C,CAvDVC,EAAAA,EAAA,CADCC,WAAS,CAAEzC,KAAM0C,MAAAA,CAAAA,CAAAA,EADNZ,6BAEZa,UAAA,OAAA,CAFYb,EAAAA,QAANA,qBAAAU,EAAA,CADNI,EAAAA,cAAc,uBAAA,CAAA,EACFd,4FCCAe,QAAAA,2BAAN,cAAyCd,EAAAA,gBAC/C,CAAA,CAAA,SACQ,OAAAM,EAAAA,qBAAA,CAAA,EAFIQ,QAANA,6JAAA,CADND,EAAAA,cAAc,8BACFC,CAAAA,EAAAA"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Subject as v, buffer as h, debounceTime as g, race as x, fromEvent as y, timer as b } from "rxjs";
|
|
2
|
+
import "lit/directives/class-map.js";
|
|
3
|
+
import "lit/directives/style-map.js";
|
|
4
|
+
import { T as m } from "./tailwind.mixin-wwBoa4Jw.js";
|
|
5
|
+
import { html as l } from "lit";
|
|
6
|
+
import { property as w, customElement as f } from "lit/decorators.js";
|
|
7
|
+
function a(s, e) {
|
|
8
|
+
const t = document.createElement("schmancy-notification");
|
|
9
|
+
return t.setAttribute("type", e), t.innerHTML = s, t;
|
|
10
|
+
}
|
|
11
|
+
const r = new v(), T = { success: (s, e) => {
|
|
12
|
+
const t = a(s, "success");
|
|
13
|
+
return r.next({ component: t, config: e }), t;
|
|
14
|
+
}, error: (s, e) => {
|
|
15
|
+
const t = a(s, "error");
|
|
16
|
+
return r.next({ component: t, config: e }), t;
|
|
17
|
+
}, warning: (s, e) => {
|
|
18
|
+
const t = a(s, "warning");
|
|
19
|
+
return r.next({ component: t, config: e }), t;
|
|
20
|
+
}, info: (s, e) => {
|
|
21
|
+
const t = a(s, "info");
|
|
22
|
+
return r.next({ component: t, config: e }), t;
|
|
23
|
+
} };
|
|
24
|
+
r.pipe(h(r.pipe(g(1e3)))).subscribe((s) => {
|
|
25
|
+
if (s.length > 1) {
|
|
26
|
+
const e = s[s.length - 1];
|
|
27
|
+
r.next({ component: e.component, config: e.config });
|
|
28
|
+
}
|
|
29
|
+
}), r.subscribe(({ component: s, config: e }) => {
|
|
30
|
+
var t;
|
|
31
|
+
(t = document.body) == null || t.appendChild(s), x(y(s, "close"), b((e == null ? void 0 : e.duration) ?? 3e3)).subscribe(() => {
|
|
32
|
+
s.remove();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
var k = Object.defineProperty, j = Object.getOwnPropertyDescriptor, d = (s, e, t, o) => {
|
|
36
|
+
for (var c, n = o > 1 ? void 0 : o ? j(e, t) : e, i = s.length - 1; i >= 0; i--) (c = s[i]) && (n = (o ? c(e, t, n) : c(n)) || n);
|
|
37
|
+
return o && n && k(e, t, n), n;
|
|
38
|
+
};
|
|
39
|
+
let p = class extends m() {
|
|
40
|
+
constructor() {
|
|
41
|
+
super(...arguments), this.type = "success";
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
return l`
|
|
45
|
+
<div
|
|
46
|
+
aria-live="assertive"
|
|
47
|
+
class="pointer-events-none z-100 fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6"
|
|
48
|
+
>
|
|
49
|
+
<div class="flex w-full flex-col items-center space-y-4 sm:items-end">
|
|
50
|
+
<div
|
|
51
|
+
class="pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-surface-container shadow-lg ring-1 ring-outlineVariant ring-opacity-5"
|
|
52
|
+
>
|
|
53
|
+
<div class="p-2">
|
|
54
|
+
<div class="flex items-center">
|
|
55
|
+
<div class="shrink-0">
|
|
56
|
+
${this.type === "success" ? l` <svg
|
|
57
|
+
class="h-6 w-6 text-success-default"
|
|
58
|
+
fill="none"
|
|
59
|
+
viewBox="0 0 24 24"
|
|
60
|
+
stroke-width="1.5"
|
|
61
|
+
stroke="currentColor"
|
|
62
|
+
aria-hidden="true"
|
|
63
|
+
>
|
|
64
|
+
<path
|
|
65
|
+
stroke-linecap="round"
|
|
66
|
+
stroke-linejoin="round"
|
|
67
|
+
d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
68
|
+
/>
|
|
69
|
+
</svg>` : l` <svg
|
|
70
|
+
class="h-6 w-6 text-error-default"
|
|
71
|
+
fill="none"
|
|
72
|
+
viewBox="0 0 24 24"
|
|
73
|
+
stroke-width="1.5"
|
|
74
|
+
stroke="currentColor"
|
|
75
|
+
aria-hidden="true"
|
|
76
|
+
>
|
|
77
|
+
<path
|
|
78
|
+
stroke-linecap="round"
|
|
79
|
+
stroke-linejoin="round"
|
|
80
|
+
d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"
|
|
81
|
+
/>
|
|
82
|
+
</svg>`}
|
|
83
|
+
</div>
|
|
84
|
+
<div class="ml-3 w-0 flex-1 pt-0.5">
|
|
85
|
+
<p class=" text-sm ">
|
|
86
|
+
<slot></slot>
|
|
87
|
+
</p>
|
|
88
|
+
</div>
|
|
89
|
+
<div class="ml-4 flex shrink-0">
|
|
90
|
+
<schmancy-icon-button
|
|
91
|
+
type="button"
|
|
92
|
+
@click=${() => {
|
|
93
|
+
this.dispatchEvent(new CustomEvent("close"));
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<span class="sr-only">Close</span>
|
|
97
|
+
close
|
|
98
|
+
</schmancy-icon-button>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
d([w({ type: String })], p.prototype, "type", 2), p = d([f("schmancy-notification")], p);
|
|
109
|
+
var O = Object.defineProperty, C = Object.getOwnPropertyDescriptor;
|
|
110
|
+
let u = class extends m() {
|
|
111
|
+
render() {
|
|
112
|
+
return l` <slot></slot> `;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
u = ((s, e, t, o) => {
|
|
116
|
+
for (var c, n = o > 1 ? void 0 : o ? C(e, t) : e, i = s.length - 1; i >= 0; i--) (c = s[i]) && (n = (o ? c(e, t, n) : c(n)) || n);
|
|
117
|
+
return o && n && O(e, t, n), n;
|
|
118
|
+
})([f("schmancy-notification-outlet")], u);
|
|
119
|
+
export {
|
|
120
|
+
T as $,
|
|
121
|
+
p as S,
|
|
122
|
+
u as a
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=outlet-Bc4MC45j.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlet-Bc4MC45j.js","sources":["../src/notification/$notification.ts","../src/notification/notification.ts","../src/notification/outlet.ts"],"sourcesContent":["import { Subject, buffer, debounceTime, fromEvent, race, timer } from 'rxjs'\nimport { SchmancyNotification } from './notification'\n\nexport type TNotification = 'success' | 'error' | 'warning' | 'info'\nexport type TNotificationConfig = {\n action?: typeof Function\n duration?: number\n}\n\nfunction createNotificationComponent(message, type) {\n const notificationComponent = document.createElement('schmancy-notification')\n notificationComponent.setAttribute('type', type)\n notificationComponent.innerHTML = message\n return notificationComponent\n}\nconst $notifications = new Subject<{\n component: SchmancyNotification\n config?: TNotificationConfig\n}>()\nexport const $notify = {\n success: (message: string, config?: TNotificationConfig) => {\n const component = createNotificationComponent(message, 'success')\n $notifications.next({ component, config })\n return component\n },\n error: (message: string, config?: TNotificationConfig) => {\n const component = createNotificationComponent(message, 'error')\n $notifications.next({ component, config })\n return component\n },\n warning: (message: string, config?: TNotificationConfig) => {\n const component = createNotificationComponent(message, 'warning')\n $notifications.next({ component, config })\n return component\n },\n info: (message: string, config?: TNotificationConfig) => {\n const component = createNotificationComponent(message, 'info')\n $notifications.next({ component, config })\n return component\n }\n}\n\n$notifications.pipe(buffer($notifications.pipe(debounceTime(1000)))).subscribe((notifications) => {\n if (notifications.length > 1) {\n const notification = notifications[notifications.length - 1]\n $notifications.next({ component: notification.component, config: notification.config })\n }\n})\n$notifications.subscribe(({ component, config }) => {\n document.body?.appendChild(component)\n race(fromEvent(component, 'close'), timer(config?.duration ?? 3000)).subscribe(() => {\n component.remove()\n })\n})\n","import { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n@customElement('schmancy-notification')\nexport class SchmancyNotification extends TailwindElement() {\n\t@property({ type: String })\n\ttype: 'success' | 'error' | 'warning' | 'info' = 'success'\n\n\trender() {\n\t\treturn html`\n\t\t\t<div\n\t\t\t\taria-live=\"assertive\"\n\t\t\t\tclass=\"pointer-events-none z-100 fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6\"\n\t\t\t>\n\t\t\t\t<div class=\"flex w-full flex-col items-center space-y-4 sm:items-end\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-surface-container shadow-lg ring-1 ring-outlineVariant ring-opacity-5\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div class=\"p-2\">\n\t\t\t\t\t\t\t<div class=\"flex items-center\">\n\t\t\t\t\t\t\t\t<div class=\"shrink-0\">\n\t\t\t\t\t\t\t\t\t${this.type === 'success'\n\t\t\t\t\t\t\t\t\t\t? html` <svg\n\t\t\t\t\t\t\t\t\t\t\t\tclass=\"h-6 w-6 text-success-default\"\n\t\t\t\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\t\t\t\t\tstroke-width=\"1.5\"\n\t\t\t\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\t\t\t\t\t\t\td=\"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</svg>`\n\t\t\t\t\t\t\t\t\t\t: html` <svg\n\t\t\t\t\t\t\t\t\t\t\t\tclass=\"h-6 w-6 text-error-default\"\n\t\t\t\t\t\t\t\t\t\t\t\tfill=\"none\"\n\t\t\t\t\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\t\t\t\t\tstroke-width=\"1.5\"\n\t\t\t\t\t\t\t\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\t\t\t\t\t\t\t\t\td=\"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z\"\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</svg>`}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"ml-3 w-0 flex-1 pt-0.5\">\n\t\t\t\t\t\t\t\t\t<p class=\" text-sm \">\n\t\t\t\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"ml-4 flex shrink-0\">\n\t\t\t\t\t\t\t\t\t<schmancy-icon-button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t@click=${() => {\n\t\t\t\t\t\t\t\t\t\t\tthis.dispatchEvent(new CustomEvent('close'))\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<span class=\"sr-only\">Close</span>\n\t\t\t\t\t\t\t\t\t\tclose\n\t\t\t\t\t\t\t\t\t</schmancy-icon-button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-notification': SchmancyNotification\n\t}\n}\n","import { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\n\n@customElement('schmancy-notification-outlet')\nexport class SchmancyNotificationOutlet extends TailwindElement() {\n\trender() {\n\t\treturn html` <slot></slot> `\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-notification-outlet': SchmancyNotificationOutlet\n\t}\n}\n"],"names":["createNotificationComponent","message","type","notificationComponent","document","createElement","setAttribute","innerHTML","$notifications","Subject","$notify","success","config","component","next","error","warning","info","pipe","buffer","debounceTime","subscribe","notifications","length","notification","body","appendChild","race","fromEvent","timer","duration","remove","SchmancyNotification","TailwindElement","super","arguments","this","html","dispatchEvent","CustomEvent","__decorateClass","property","String","prototype","customElement","SchmancyNotificationOutlet"],"mappings":";;;;;;AASA,SAASA,EAA4BC,GAASC,GAAAA;AACtC,QAAAC,IAAwBC,SAASC,cAAc,uBAG9C;AAAA,SAFeF,EAAAG,aAAa,QAAQJ,CAC3CC,GAAAA,EAAsBI,YAAYN,GAC3BE;AACT;AACA,MAAMK,IAAiB,IAAIC,KAIdC,IAAU,EACrBC,SAAS,CAACV,GAAiBW,MAAAA;AACnB,QAAAC,IAAYb,EAA4BC,GAAS,SAEhD;AAAA,SADPO,EAAeM,KAAK,EAAED,WAAAA,GAAWD,QAC1BC,EAAAA,CAAAA,GAAAA;AAAA,GAETE,OAAO,CAACd,GAAiBW,MAAAA;AACjB,QAAAC,IAAYb,EAA4BC,GAAS,OAAA;AAEhD,SADPO,EAAeM,KAAK,EAAED,cAAWD,QAC1BC,EAAAA,CAAAA,GAAAA;AAAA,GAETG,SAAS,CAACf,GAAiBW,MACnB;AAAA,QAAAC,IAAYb,EAA4BC,GAAS,SAAA;AAEhD,SADPO,EAAeM,KAAK,EAAED,WAAAA,GAAWD,QAC1BC,EAAAA,CAAAA,GAAAA;AAAA,GAETI,MAAM,CAAChB,GAAiBW,MAAAA;AAChB,QAAAC,IAAYb,EAA4BC,GAAS;AAEhD,SADPO,EAAeM,KAAK,EAAED,WAAWD,GAAAA,QAAAA,EAAAA,CAAAA,GAC1BC;AAAA,EAAA;AAIXL,EAAeU,KAAKC,EAAOX,EAAeU,KAAKE,EAAa,QAASC,UAAWC,CAAAA,MAAAA;AAC1E,MAAAA,EAAcC,SAAS,GAAG;AAC5B,UAAMC,IAAeF,EAAcA,EAAcC,SAAS,CAAA;AAC3Cf,IAAAA,EAAAM,KAAK,EAAED,WAAWW,EAAaX,WAAWD,QAAQY,EAAaZ,OAAAA,CAAAA;AAAAA,EAAQ;AAG1FJ,CAAAA,GAAAA,EAAea,UAAU,CAAA,EAAGR,WAAWD,GAAAA,QAAAA,EAAAA,MAAAA;;AAC5BR,GAAAA,IAAAA,SAAAqB,SAAArB,QAAAA,EAAMsB,YAAYb,IACtBc,EAAAC,EAAUf,GAAW,UAAUgB,GAAMjB,KAAAA,gBAAAA,EAAQkB,aAAY,GAAA,CAAA,EAAOT,UAAU,MAAA;AAC7ER,IAAAA,EAAUkB,OAAO;AAAA,EAAA,CAAA;AAClB;;;;;AChDU,IAAAC,IAAN,cAAmCC,EAAnC,EAAA;AAAA,EAAA,cAAAC;AAAAA,UAAAA,GAAAC,SAE2CC,GAAAA,KAAAlC,OAAA;AAAA,EAAA;AAAA,EAEjD,SACQ;AAAA,WAAAmC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,WAYED,KAAKlC,SAAS,YACbmC;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,qBAcAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;;;;;;;;;;mBAuBO,MAAA;AACRD,WAAKE,cAAc,IAAIC,YAAY,OAAQ,CAAA;AAAA,IAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAC3C;AAAA;AAvDVC,EAAA,CADCC,EAAS,EAAEvC,MAAMwC,OAAAA,CAAAA,CAAAA,GADNV,EAEZW,WAAA,QAAA,CAFYX,GAAAA,IAANQ,EAAA,CADNI,EAAc,2BACFZ;;ACCA,IAAAa,IAAN,cAAyCZ,EAC/C,EAAA;AAAA,EAAA;AACQ,WAAAI;AAAAA,EAAA;AAAA;AAFIQ;;;GAAN,CADND,EAAc,8BACFC,CAAAA,GAAAA,CAAAA;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";require("rxjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const w=require("./litElement.mixin-BGFFSTo6.cjs");require("./tailwind.mixin-bRVZL2lY.cjs");const b=require("lit"),f=require("lit/decorators.js");var x=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},y=function(e,t,r,i,n,a,o,s,d,p){var l=this;l.numeralDecimalMark=e||".",l.numeralIntegerScale=t>0?t:0,l.numeralDecimalScale=r>=0?r:2,l.numeralThousandsGroupStyle=i||y.groupStyle.thousand,l.numeralPositiveOnly=!!n,l.stripLeadingZeroes=a!==!1,l.prefix=o||o===""?o:"",l.signBeforePrefix=!!s,l.tailPrefix=!!d,l.delimiter=p||p===""?p:",",l.delimiterRE=p?new RegExp("\\"+p,"g"):""};y.groupStyle={thousand:"thousand",lakh:"lakh",wan:"wan",none:"none"},y.prototype={getRawValue:function(e){return e.replace(this.delimiterRE,"").replace(this.numeralDecimalMark,".")},format:function(e){var t,r,i,n,a=this,o="";switch(e=e.replace(/[A-Za-z]/g,"").replace(a.numeralDecimalMark,"M").replace(/[^\dM-]/g,"").replace(/^\-/,"N").replace(/\-/g,"").replace("N",a.numeralPositiveOnly?"":"-").replace("M",a.numeralDecimalMark),a.stripLeadingZeroes&&(e=e.replace(/^(-)?0+(?=\d)/,"$1")),r=e.slice(0,1)==="-"?"-":"",i=a.prefix!==void 0?a.signBeforePrefix?r+a.prefix:a.prefix+r:r,n=e,e.indexOf(a.numeralDecimalMark)>=0&&(n=(t=e.split(a.numeralDecimalMark))[0],o=a.numeralDecimalMark+t[1].slice(0,a.numeralDecimalScale)),r==="-"&&(n=n.slice(1)),a.numeralIntegerScale>0&&(n=n.slice(0,a.numeralIntegerScale)),a.numeralThousandsGroupStyle){case y.groupStyle.lakh:n=n.replace(/(\d)(?=(\d\d)+\d$)/g,"$1"+a.delimiter);break;case y.groupStyle.wan:n=n.replace(/(\d)(?=(\d{4})+$)/g,"$1"+a.delimiter);break;case y.groupStyle.thousand:n=n.replace(/(\d)(?=(\d{3})+$)/g,"$1"+a.delimiter)}return a.tailPrefix?r+n.toString()+(a.numeralDecimalScale>0?o.toString():"")+a.prefix:i+n.toString()+(a.numeralDecimalScale>0?o.toString():"")}};var I=y,k=function(e,t,r){var i=this;i.date=[],i.blocks=[],i.datePattern=e,i.dateMin=t.split("-").reverse().map(function(n){return parseInt(n,10)}),i.dateMin.length===2&&i.dateMin.unshift(0),i.dateMax=r.split("-").reverse().map(function(n){return parseInt(n,10)}),i.dateMax.length===2&&i.dateMax.unshift(0),i.initBlocks()};k.prototype={initBlocks:function(){var e=this;e.datePattern.forEach(function(t){t==="Y"?e.blocks.push(4):e.blocks.push(2)})},getISOFormatDate:function(){var e=this,t=e.date;return t[2]?t[2]+"-"+e.addLeadingZero(t[1])+"-"+e.addLeadingZero(t[0]):""},getBlocks:function(){return this.blocks},getValidatedDate:function(e){var t=this,r="";return e=e.replace(/[^\d]/g,""),t.blocks.forEach(function(i,n){if(e.length>0){var a=e.slice(0,i),o=a.slice(0,1),s=e.slice(i);switch(t.datePattern[n]){case"d":a==="00"?a="01":parseInt(o,10)>3?a="0"+o:parseInt(a,10)>31&&(a="31");break;case"m":a==="00"?a="01":parseInt(o,10)>1?a="0"+o:parseInt(a,10)>12&&(a="12")}r+=a,e=s}}),this.getFixedDateString(r)},getFixedDateString:function(e){var t,r,i,n=this,a=n.datePattern,o=[],s=0,d=0,p=0,l=0,m=0,u=0,g=!1;return e.length===4&&a[0].toLowerCase()!=="y"&&a[1].toLowerCase()!=="y"&&(m=2-(l=a[0]==="d"?0:2),t=parseInt(e.slice(l,l+2),10),r=parseInt(e.slice(m,m+2),10),o=this.getFixedDate(t,r,0)),e.length===8&&(a.forEach(function(h,C){switch(h){case"d":s=C;break;case"m":d=C;break;default:p=C}}),u=2*p,l=s<=p?2*s:2*s+2,m=d<=p?2*d:2*d+2,t=parseInt(e.slice(l,l+2),10),r=parseInt(e.slice(m,m+2),10),i=parseInt(e.slice(u,u+4),10),g=e.slice(u,u+4).length===4,o=this.getFixedDate(t,r,i)),e.length!==4||a[0]!=="y"&&a[1]!=="y"||(u=2-(m=a[0]==="m"?0:2),r=parseInt(e.slice(m,m+2),10),i=parseInt(e.slice(u,u+2),10),g=e.slice(u,u+2).length===2,o=[0,r,i]),e.length!==6||a[0]!=="Y"&&a[1]!=="Y"||(u=2-.5*(m=a[0]==="m"?0:4),r=parseInt(e.slice(m,m+2),10),i=parseInt(e.slice(u,u+4),10),g=e.slice(u,u+4).length===4,o=[0,r,i]),o=n.getRangeFixedDate(o),n.date=o,o.length===0?e:a.reduce(function(h,C){switch(C){case"d":return h+(o[0]===0?"":n.addLeadingZero(o[0]));case"m":return h+(o[1]===0?"":n.addLeadingZero(o[1]));case"y":return h+(g?n.addLeadingZeroForYear(o[2],!1):"");case"Y":return h+(g?n.addLeadingZeroForYear(o[2],!0):"")}},"")},getRangeFixedDate:function(e){var t=this,r=t.datePattern,i=t.dateMin||[],n=t.dateMax||[];return!e.length||i.length<3&&n.length<3||r.find(function(a){return a.toLowerCase()==="y"})&&e[2]===0?e:n.length&&(n[2]<e[2]||n[2]===e[2]&&(n[1]<e[1]||n[1]===e[1]&&n[0]<e[0]))?n:i.length&&(i[2]>e[2]||i[2]===e[2]&&(i[1]>e[1]||i[1]===e[1]&&i[0]>e[0]))?i:e},getFixedDate:function(e,t,r){return e=Math.min(e,31),t=Math.min(t,12),r=parseInt(r||0,10),(t<7&&t%2==0||t>8&&t%2==1)&&(e=Math.min(e,t===2?this.isLeapYear(r)?29:28:30)),[e,t,r]},isLeapYear:function(e){return e%4==0&&e%100!=0||e%400==0},addLeadingZero:function(e){return(e<10?"0":"")+e},addLeadingZeroForYear:function(e,t){return t?(e<10?"000":e<100?"00":e<1e3?"0":"")+e:(e<10?"0":"")+e}};var L=k,F=function(e,t){var r=this;r.time=[],r.blocks=[],r.timePattern=e,r.timeFormat=t,r.initBlocks()};F.prototype={initBlocks:function(){var e=this;e.timePattern.forEach(function(){e.blocks.push(2)})},getISOFormatTime:function(){var e=this,t=e.time;return t[2]?e.addLeadingZero(t[0])+":"+e.addLeadingZero(t[1])+":"+e.addLeadingZero(t[2]):""},getBlocks:function(){return this.blocks},getTimeFormatOptions:function(){return String(this.timeFormat)==="12"?{maxHourFirstDigit:1,maxHours:12,maxMinutesFirstDigit:5,maxMinutes:60}:{maxHourFirstDigit:2,maxHours:23,maxMinutesFirstDigit:5,maxMinutes:60}},getValidatedTime:function(e){var t=this,r="";e=e.replace(/[^\d]/g,"");var i=t.getTimeFormatOptions();return t.blocks.forEach(function(n,a){if(e.length>0){var o=e.slice(0,n),s=o.slice(0,1),d=e.slice(n);switch(t.timePattern[a]){case"h":parseInt(s,10)>i.maxHourFirstDigit?o="0"+s:parseInt(o,10)>i.maxHours&&(o=i.maxHours+"");break;case"m":case"s":parseInt(s,10)>i.maxMinutesFirstDigit?o="0"+s:parseInt(o,10)>i.maxMinutes&&(o=i.maxMinutes+"")}r+=o,e=d}}),this.getFixedTimeString(r)},getFixedTimeString:function(e){var t,r,i,n=this,a=n.timePattern,o=[],s=0,d=0,p=0,l=0,m=0,u=0;return e.length===6&&(a.forEach(function(g,h){switch(g){case"s":s=2*h;break;case"m":d=2*h;break;case"h":p=2*h}}),u=p,m=d,l=s,t=parseInt(e.slice(l,l+2),10),r=parseInt(e.slice(m,m+2),10),i=parseInt(e.slice(u,u+2),10),o=this.getFixedTime(i,r,t)),e.length===4&&n.timePattern.indexOf("s")<0&&(a.forEach(function(g,h){switch(g){case"m":d=2*h;break;case"h":p=2*h}}),u=p,m=d,t=0,r=parseInt(e.slice(m,m+2),10),i=parseInt(e.slice(u,u+2),10),o=this.getFixedTime(i,r,t)),n.time=o,o.length===0?e:a.reduce(function(g,h){switch(h){case"s":return g+n.addLeadingZero(o[2]);case"m":return g+n.addLeadingZero(o[1]);case"h":return g+n.addLeadingZero(o[0])}},"")},getFixedTime:function(e,t,r){return r=Math.min(parseInt(r||0,10),60),t=Math.min(t,60),[e=Math.min(e,60),t,r]},addLeadingZero:function(e){return(e<10?"0":"")+e}};var V=F,P=function(e,t){var r=this;r.delimiter=t||t===""?t:" ",r.delimiterRE=t?new RegExp("\\"+t,"g"):"",r.formatter=e};P.prototype={setFormatter:function(e){this.formatter=e},format:function(e){var t=this;t.formatter.clear();for(var r,i="",n=!1,a=0,o=(e=(e=(e=e.replace(/[^\d+]/g,"")).replace(/^\+/,"B").replace(/\+/g,"").replace("B","+")).replace(t.delimiterRE,"")).length;a<o;a++)r=t.formatter.inputDigit(e.charAt(a)),/[\s()-]/g.test(r)?(i=r,n=!0):n||(i=r);return i=(i=i.replace(/[()]/g,"")).replace(/[\s-]/g,t.delimiter)}};var M=P,D={blocks:{uatp:[4,5,6],amex:[4,6,5],diners:[4,6,4],discover:[4,4,4,4],mastercard:[4,4,4,4],dankort:[4,4,4,4],instapayment:[4,4,4,4],jcb15:[4,6,5],jcb:[4,4,4,4],maestro:[4,4,4,4],visa:[4,4,4,4],mir:[4,4,4,4],unionPay:[4,4,4,4],general:[4,4,4,4]},re:{uatp:/^(?!1800)1\d{0,14}/,amex:/^3[47]\d{0,13}/,discover:/^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/,diners:/^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/,mastercard:/^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/,dankort:/^(5019|4175|4571)\d{0,12}/,instapayment:/^63[7-9]\d{0,13}/,jcb15:/^(?:2131|1800)\d{0,11}/,jcb:/^(?:35\d{0,2})\d{0,12}/,maestro:/^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,mir:/^220[0-4]\d{0,12}/,visa:/^4\d{0,15}/,unionPay:/^(62|81)\d{0,14}/},getStrictBlocks:function(e){var t=e.reduce(function(r,i){return r+i},0);return e.concat(19-t)},getInfo:function(e,t){var r=D.blocks,i=D.re;for(var n in t=!!t,i)if(i[n].test(e)){var a=r[n];return{type:n,blocks:t?this.getStrictBlocks(a):a}}return{type:"unknown",blocks:t?this.getStrictBlocks(r.general):r.general}}},E=D,T={noop:function(){},strip:function(e,t){return e.replace(t,"")},getPostDelimiter:function(e,t,r){if(r.length===0)return e.slice(-t.length)===t?t:"";var i="";return r.forEach(function(n){e.slice(-n.length)===n&&(i=n)}),i},getDelimiterREByDelimiter:function(e){return new RegExp(e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g")},getNextCursorPosition:function(e,t,r,i,n){return t.length===e?r.length:e+this.getPositionOffset(e,t,r,i,n)},getPositionOffset:function(e,t,r,i,n){var a,o,s;return a=this.stripDelimiters(t.slice(0,e),i,n),o=this.stripDelimiters(r.slice(0,e),i,n),(s=a.length-o.length)!==0?s/Math.abs(s):0},stripDelimiters:function(e,t,r){var i=this;if(r.length===0){var n=t?i.getDelimiterREByDelimiter(t):"";return e.replace(n,"")}return r.forEach(function(a){a.split("").forEach(function(o){e=e.replace(i.getDelimiterREByDelimiter(o),"")})}),e},headStr:function(e,t){return e.slice(0,t)},getMaxLength:function(e){return e.reduce(function(t,r){return t+r},0)},getPrefixStrippedValue:function(e,t,r,i,n,a,o,s,d){if(r===0)return e;if(e===t&&e!=="")return"";if(d&&e.slice(0,1)=="-"){var p=i.slice(0,1)=="-"?i.slice(1):i;return"-"+this.getPrefixStrippedValue(e.slice(1),t,r,p,n,a,o,s,d)}if(i.slice(0,r)!==t&&!s||i.slice(-r)!==t&&s)return o&&!i&&e?e:"";var l=this.stripDelimiters(i,n,a);return e.slice(0,r)===t||s?e.slice(-r)!==t&&s?l.slice(0,-r-1):s?e.slice(0,-r):e.slice(r):l.slice(r)},getFirstDiffIndex:function(e,t){for(var r=0;e.charAt(r)===t.charAt(r);)if(e.charAt(r++)==="")return-1;return r},getFormattedValue:function(e,t,r,i,n,a){var o="",s=n.length>0,d="";return r===0?e:(t.forEach(function(p,l){if(e.length>0){var m=e.slice(0,p),u=e.slice(p);d=s?n[a?l-1:l]||d:i,a?(l>0&&(o+=d),o+=m):(o+=m,m.length===p&&l<r-1&&(o+=d)),e=u}}),o)},fixPrefixCursor:function(e,t,r,i){if(e){var n=e.value,a=r||i[0]||" ";if(e.setSelectionRange&&t&&!(t.length+a.length<=n.length)){var o=2*n.length;setTimeout(function(){e.setSelectionRange(o,o)},1)}}},checkFullSelection:function(e){try{return(window.getSelection()||document.getSelection()||{}).toString().length===e.length}catch{}return!1},setSelection:function(e,t,r){if(e===this.getActiveElement(r)&&!(e&&e.value.length<=t))if(e.createTextRange){var i=e.createTextRange();i.move("character",t),i.select()}else try{e.setSelectionRange(t,t)}catch{}},getActiveElement:function(e){var t=e.activeElement;return t&&t.shadowRoot?this.getActiveElement(t.shadowRoot):t},isAndroid:function(){return navigator&&/android/i.test(navigator.userAgent)},isAndroidBackspaceKeydown:function(e,t){return!!(this.isAndroid()&&e&&t)&&t===e.slice(0,-1)}},B={assign:function(e,t){return t=t||{},(e=e||{}).creditCard=!!t.creditCard,e.creditCardStrictMode=!!t.creditCardStrictMode,e.creditCardType="",e.onCreditCardTypeChanged=t.onCreditCardTypeChanged||function(){},e.phone=!!t.phone,e.phoneRegionCode=t.phoneRegionCode||"AU",e.phoneFormatter={},e.time=!!t.time,e.timePattern=t.timePattern||["h","m","s"],e.timeFormat=t.timeFormat||"24",e.timeFormatter={},e.date=!!t.date,e.datePattern=t.datePattern||["d","m","Y"],e.dateMin=t.dateMin||"",e.dateMax=t.dateMax||"",e.dateFormatter={},e.numeral=!!t.numeral,e.numeralIntegerScale=t.numeralIntegerScale>0?t.numeralIntegerScale:0,e.numeralDecimalScale=t.numeralDecimalScale>=0?t.numeralDecimalScale:2,e.numeralDecimalMark=t.numeralDecimalMark||".",e.numeralThousandsGroupStyle=t.numeralThousandsGroupStyle||"thousand",e.numeralPositiveOnly=!!t.numeralPositiveOnly,e.stripLeadingZeroes=t.stripLeadingZeroes!==!1,e.signBeforePrefix=!!t.signBeforePrefix,e.tailPrefix=!!t.tailPrefix,e.swapHiddenInput=!!t.swapHiddenInput,e.numericOnly=e.creditCard||e.date||!!t.numericOnly,e.uppercase=!!t.uppercase,e.lowercase=!!t.lowercase,e.prefix=e.creditCard||e.date?"":t.prefix||"",e.noImmediatePrefix=!!t.noImmediatePrefix,e.prefixLength=e.prefix.length,e.rawValueTrimPrefix=!!t.rawValueTrimPrefix,e.copyDelimiter=!!t.copyDelimiter,e.initValue=t.initValue!==void 0&&t.initValue!==null?t.initValue.toString():"",e.delimiter=t.delimiter||t.delimiter===""?t.delimiter:t.date?"/":t.time?":":t.numeral?",":(t.phone," "),e.delimiterLength=e.delimiter.length,e.delimiterLazyShow=!!t.delimiterLazyShow,e.delimiters=t.delimiters||[],e.blocks=t.blocks||[],e.blocksLength=e.blocks.length,e.root=typeof x=="object"&&x?x:window,e.document=t.document||e.root.document,e.maxLength=0,e.backspace=!1,e.result="",e.onValueChanged=t.onValueChanged||function(){},e}},c=function(e,t){var r=this;if(typeof e=="string"?(r.element=document.querySelector(e),document.querySelectorAll(e).length>1):e.length!==void 0&&e.length>0?(r.element=e[0],e.length>1):r.element=e,!r.element)throw new Error("[cleave.js] Please check the element");t.initValue=r.element.value,r.properties=c.DefaultProperties.assign({},t),r.init()};c.prototype={init:function(){var e=this,t=e.properties;t.numeral||t.phone||t.creditCard||t.time||t.date||t.blocksLength!==0||t.prefix?(t.maxLength=c.Util.getMaxLength(t.blocks),e.isAndroid=c.Util.isAndroid(),e.lastInputValue="",e.isBackward="",e.onChangeListener=e.onChange.bind(e),e.onKeyDownListener=e.onKeyDown.bind(e),e.onFocusListener=e.onFocus.bind(e),e.onCutListener=e.onCut.bind(e),e.onCopyListener=e.onCopy.bind(e),e.initSwapHiddenInput(),e.element.addEventListener("input",e.onChangeListener),e.element.addEventListener("keydown",e.onKeyDownListener),e.element.addEventListener("focus",e.onFocusListener),e.element.addEventListener("cut",e.onCutListener),e.element.addEventListener("copy",e.onCopyListener),e.initPhoneFormatter(),e.initDateFormatter(),e.initTimeFormatter(),e.initNumeralFormatter(),(t.initValue||t.prefix&&!t.noImmediatePrefix)&&e.onInput(t.initValue)):e.onInput(t.initValue)},initSwapHiddenInput:function(){var e=this;if(e.properties.swapHiddenInput){var t=e.element.cloneNode(!0);e.element.parentNode.insertBefore(t,e.element),e.elementSwapHidden=e.element,e.elementSwapHidden.type="hidden",e.element=t,e.element.id=""}},initNumeralFormatter:function(){var e=this.properties;e.numeral&&(e.numeralFormatter=new c.NumeralFormatter(e.numeralDecimalMark,e.numeralIntegerScale,e.numeralDecimalScale,e.numeralThousandsGroupStyle,e.numeralPositiveOnly,e.stripLeadingZeroes,e.prefix,e.signBeforePrefix,e.tailPrefix,e.delimiter))},initTimeFormatter:function(){var e=this.properties;e.time&&(e.timeFormatter=new c.TimeFormatter(e.timePattern,e.timeFormat),e.blocks=e.timeFormatter.getBlocks(),e.blocksLength=e.blocks.length,e.maxLength=c.Util.getMaxLength(e.blocks))},initDateFormatter:function(){var e=this.properties;e.date&&(e.dateFormatter=new c.DateFormatter(e.datePattern,e.dateMin,e.dateMax),e.blocks=e.dateFormatter.getBlocks(),e.blocksLength=e.blocks.length,e.maxLength=c.Util.getMaxLength(e.blocks))},initPhoneFormatter:function(){var e=this.properties;if(e.phone)try{e.phoneFormatter=new c.PhoneFormatter(new e.root.Cleave.AsYouTypeFormatter(e.phoneRegionCode),e.delimiter)}catch{throw new Error("[cleave.js] Please include phone-type-formatter.{country}.js lib")}},onKeyDown:function(e){var t=this,r=e.which||e.keyCode;t.lastInputValue=t.element.value,t.isBackward=r===8},onChange:function(e){var t=this,r=t.properties,i=c.Util;t.isBackward=t.isBackward||e.inputType==="deleteContentBackward";var n=i.getPostDelimiter(t.lastInputValue,r.delimiter,r.delimiters);t.isBackward&&n?r.postDelimiterBackspace=n:r.postDelimiterBackspace=!1,this.onInput(this.element.value)},onFocus:function(){var e=this,t=e.properties;e.lastInputValue=e.element.value,t.prefix&&t.noImmediatePrefix&&!e.element.value&&this.onInput(t.prefix),c.Util.fixPrefixCursor(e.element,t.prefix,t.delimiter,t.delimiters)},onCut:function(e){c.Util.checkFullSelection(this.element.value)&&(this.copyClipboardData(e),this.onInput(""))},onCopy:function(e){c.Util.checkFullSelection(this.element.value)&&this.copyClipboardData(e)},copyClipboardData:function(e){var t=this.properties,r=c.Util,i=this.element.value,n="";n=t.copyDelimiter?i:r.stripDelimiters(i,t.delimiter,t.delimiters);try{e.clipboardData?e.clipboardData.setData("Text",n):window.clipboardData.setData("Text",n),e.preventDefault()}catch{}},onInput:function(e){var t=this,r=t.properties,i=c.Util,n=i.getPostDelimiter(e,r.delimiter,r.delimiters);return r.numeral||!r.postDelimiterBackspace||n||(e=i.headStr(e,e.length-r.postDelimiterBackspace.length)),r.phone?(!r.prefix||r.noImmediatePrefix&&!e.length?r.result=r.phoneFormatter.format(e):r.result=r.prefix+r.phoneFormatter.format(e).slice(r.prefix.length),void t.updateValueState()):r.numeral?(r.prefix&&r.noImmediatePrefix&&e.length===0?r.result="":r.result=r.numeralFormatter.format(e),void t.updateValueState()):(r.date&&(e=r.dateFormatter.getValidatedDate(e)),r.time&&(e=r.timeFormatter.getValidatedTime(e)),e=i.stripDelimiters(e,r.delimiter,r.delimiters),e=i.getPrefixStrippedValue(e,r.prefix,r.prefixLength,r.result,r.delimiter,r.delimiters,r.noImmediatePrefix,r.tailPrefix,r.signBeforePrefix),e=r.numericOnly?i.strip(e,/[^\d]/g):e,e=r.uppercase?e.toUpperCase():e,e=r.lowercase?e.toLowerCase():e,r.prefix&&(r.tailPrefix?e+=r.prefix:e=r.prefix+e,r.blocksLength===0)?(r.result=e,void t.updateValueState()):(r.creditCard&&t.updateCreditCardPropsByValue(e),e=i.headStr(e,r.maxLength),r.result=i.getFormattedValue(e,r.blocks,r.blocksLength,r.delimiter,r.delimiters,r.delimiterLazyShow),void t.updateValueState()))},updateCreditCardPropsByValue:function(e){var t,r=this.properties,i=c.Util;i.headStr(r.result,4)!==i.headStr(e,4)&&(t=c.CreditCardDetector.getInfo(e,r.creditCardStrictMode),r.blocks=t.blocks,r.blocksLength=r.blocks.length,r.maxLength=i.getMaxLength(r.blocks),r.creditCardType!==t.type&&(r.creditCardType=t.type,r.onCreditCardTypeChanged.call(this,r.creditCardType)))},updateValueState:function(){var e=this,t=c.Util,r=e.properties;if(e.element){var i=e.element.selectionEnd,n=e.element.value,a=r.result;i=t.getNextCursorPosition(i,n,a,r.delimiter,r.delimiters),e.isAndroid?window.setTimeout(function(){e.element.value=a,t.setSelection(e.element,i,r.document,!1),e.callOnValueChanged()},1):(e.element.value=a,r.swapHiddenInput&&(e.elementSwapHidden.value=e.getRawValue()),t.setSelection(e.element,i,r.document,!1),e.callOnValueChanged())}},callOnValueChanged:function(){var e=this,t=e.properties;t.onValueChanged.call(e,{target:{name:e.element.name,value:t.result,rawValue:e.getRawValue()}})},setPhoneRegionCode:function(e){var t=this;t.properties.phoneRegionCode=e,t.initPhoneFormatter(),t.onChange()},setRawValue:function(e){var t=this,r=t.properties;e=e!=null?e.toString():"",r.numeral&&(e=e.replace(".",r.numeralDecimalMark)),r.postDelimiterBackspace=!1,t.element.value=e,t.onInput(e)},getRawValue:function(){var e=this.properties,t=c.Util,r=this.element.value;return e.rawValueTrimPrefix&&(r=t.getPrefixStrippedValue(r,e.prefix,e.prefixLength,e.result,e.delimiter,e.delimiters,e.noImmediatePrefix,e.tailPrefix,e.signBeforePrefix)),r=e.numeral?e.numeralFormatter.getRawValue(r):t.stripDelimiters(r,e.delimiter,e.delimiters)},getISOFormatDate:function(){var e=this.properties;return e.date?e.dateFormatter.getISOFormatDate():""},getISOFormatTime:function(){var e=this.properties;return e.time?e.timeFormatter.getISOFormatTime():""},getFormattedValue:function(){return this.element.value},destroy:function(){var e=this;e.element.removeEventListener("input",e.onChangeListener),e.element.removeEventListener("keydown",e.onKeyDownListener),e.element.removeEventListener("focus",e.onFocusListener),e.element.removeEventListener("cut",e.onCutListener),e.element.removeEventListener("copy",e.onCopyListener)},toString:function(){return"[Cleave Object]"}},c.NumeralFormatter=I,c.DateFormatter=L,c.TimeFormatter=V,c.PhoneFormatter=M,c.CreditCardDetector=E,c.Util=T,c.DefaultProperties=B,(typeof x=="object"&&x?x:window).Cleave=c;var S=c,N=Object.defineProperty,R=Object.getOwnPropertyDescriptor,v=(e,t,r,i)=>{for(var n,a=i>1?void 0:i?R(t,r):t,o=e.length-1;o>=0;o--)(n=e[o])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&N(t,r,a),a};exports.SchmancyPaymentCardForm=class extends w.$LitElement(){constructor(){super(...arguments),this.value={cardName:"",cardNumber:"",expirationDate:"",cvv:""}}firstUpdated(){new S(this.cardNumberInput,{creditCard:!0,creditCardStrictMode:!0,onCreditCardTypeChanged:e=>{e==="unknown"?this.cardNumberInput.setCustomValidity("Please enter a valid card number."):this.cardNumberInput.setCustomValidity("")}}),new S(this.expirationDateInput,{date:!0,datePattern:["m","y"],onValueChanged:e=>{!e.target.value||e.target.value.length<5?this.expirationDateInput.setCustomValidity("Please enter a valid expiration date."):this.expirationDateInput.setCustomValidity("")}}),new S(this.cvvInput,{blocks:[4],numericOnly:!0,onValueChanged:e=>{e.target.value.length<3?this.cvvInput.setCustomValidity("Please enter a valid CVV."):this.cvvInput.setCustomValidity("")}}),new S(this.cardNameInput,{uppercase:!0,delimiter:" "})}reportValidity(){return this.form.reportValidity()}checkValidity(){return!!this.form.reportValidity()}emitChange(){this.dispatchEvent(new CustomEvent("change",{detail:{...this.value}}))}render(){return b.html` <schmancy-form
|
|
1
|
+
"use strict";require("rxjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const w=require("./litElement.mixin-Cw40wOLl.cjs");require("./tailwind.mixin-mhYVlkxs.cjs");const b=require("lit"),f=require("lit/decorators.js");var x=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},y=function(e,t,r,i,n,a,o,s,d,p){var l=this;l.numeralDecimalMark=e||".",l.numeralIntegerScale=t>0?t:0,l.numeralDecimalScale=r>=0?r:2,l.numeralThousandsGroupStyle=i||y.groupStyle.thousand,l.numeralPositiveOnly=!!n,l.stripLeadingZeroes=a!==!1,l.prefix=o||o===""?o:"",l.signBeforePrefix=!!s,l.tailPrefix=!!d,l.delimiter=p||p===""?p:",",l.delimiterRE=p?new RegExp("\\"+p,"g"):""};y.groupStyle={thousand:"thousand",lakh:"lakh",wan:"wan",none:"none"},y.prototype={getRawValue:function(e){return e.replace(this.delimiterRE,"").replace(this.numeralDecimalMark,".")},format:function(e){var t,r,i,n,a=this,o="";switch(e=e.replace(/[A-Za-z]/g,"").replace(a.numeralDecimalMark,"M").replace(/[^\dM-]/g,"").replace(/^\-/,"N").replace(/\-/g,"").replace("N",a.numeralPositiveOnly?"":"-").replace("M",a.numeralDecimalMark),a.stripLeadingZeroes&&(e=e.replace(/^(-)?0+(?=\d)/,"$1")),r=e.slice(0,1)==="-"?"-":"",i=a.prefix!==void 0?a.signBeforePrefix?r+a.prefix:a.prefix+r:r,n=e,e.indexOf(a.numeralDecimalMark)>=0&&(n=(t=e.split(a.numeralDecimalMark))[0],o=a.numeralDecimalMark+t[1].slice(0,a.numeralDecimalScale)),r==="-"&&(n=n.slice(1)),a.numeralIntegerScale>0&&(n=n.slice(0,a.numeralIntegerScale)),a.numeralThousandsGroupStyle){case y.groupStyle.lakh:n=n.replace(/(\d)(?=(\d\d)+\d$)/g,"$1"+a.delimiter);break;case y.groupStyle.wan:n=n.replace(/(\d)(?=(\d{4})+$)/g,"$1"+a.delimiter);break;case y.groupStyle.thousand:n=n.replace(/(\d)(?=(\d{3})+$)/g,"$1"+a.delimiter)}return a.tailPrefix?r+n.toString()+(a.numeralDecimalScale>0?o.toString():"")+a.prefix:i+n.toString()+(a.numeralDecimalScale>0?o.toString():"")}};var I=y,k=function(e,t,r){var i=this;i.date=[],i.blocks=[],i.datePattern=e,i.dateMin=t.split("-").reverse().map(function(n){return parseInt(n,10)}),i.dateMin.length===2&&i.dateMin.unshift(0),i.dateMax=r.split("-").reverse().map(function(n){return parseInt(n,10)}),i.dateMax.length===2&&i.dateMax.unshift(0),i.initBlocks()};k.prototype={initBlocks:function(){var e=this;e.datePattern.forEach(function(t){t==="Y"?e.blocks.push(4):e.blocks.push(2)})},getISOFormatDate:function(){var e=this,t=e.date;return t[2]?t[2]+"-"+e.addLeadingZero(t[1])+"-"+e.addLeadingZero(t[0]):""},getBlocks:function(){return this.blocks},getValidatedDate:function(e){var t=this,r="";return e=e.replace(/[^\d]/g,""),t.blocks.forEach(function(i,n){if(e.length>0){var a=e.slice(0,i),o=a.slice(0,1),s=e.slice(i);switch(t.datePattern[n]){case"d":a==="00"?a="01":parseInt(o,10)>3?a="0"+o:parseInt(a,10)>31&&(a="31");break;case"m":a==="00"?a="01":parseInt(o,10)>1?a="0"+o:parseInt(a,10)>12&&(a="12")}r+=a,e=s}}),this.getFixedDateString(r)},getFixedDateString:function(e){var t,r,i,n=this,a=n.datePattern,o=[],s=0,d=0,p=0,l=0,m=0,u=0,g=!1;return e.length===4&&a[0].toLowerCase()!=="y"&&a[1].toLowerCase()!=="y"&&(m=2-(l=a[0]==="d"?0:2),t=parseInt(e.slice(l,l+2),10),r=parseInt(e.slice(m,m+2),10),o=this.getFixedDate(t,r,0)),e.length===8&&(a.forEach(function(h,C){switch(h){case"d":s=C;break;case"m":d=C;break;default:p=C}}),u=2*p,l=s<=p?2*s:2*s+2,m=d<=p?2*d:2*d+2,t=parseInt(e.slice(l,l+2),10),r=parseInt(e.slice(m,m+2),10),i=parseInt(e.slice(u,u+4),10),g=e.slice(u,u+4).length===4,o=this.getFixedDate(t,r,i)),e.length!==4||a[0]!=="y"&&a[1]!=="y"||(u=2-(m=a[0]==="m"?0:2),r=parseInt(e.slice(m,m+2),10),i=parseInt(e.slice(u,u+2),10),g=e.slice(u,u+2).length===2,o=[0,r,i]),e.length!==6||a[0]!=="Y"&&a[1]!=="Y"||(u=2-.5*(m=a[0]==="m"?0:4),r=parseInt(e.slice(m,m+2),10),i=parseInt(e.slice(u,u+4),10),g=e.slice(u,u+4).length===4,o=[0,r,i]),o=n.getRangeFixedDate(o),n.date=o,o.length===0?e:a.reduce(function(h,C){switch(C){case"d":return h+(o[0]===0?"":n.addLeadingZero(o[0]));case"m":return h+(o[1]===0?"":n.addLeadingZero(o[1]));case"y":return h+(g?n.addLeadingZeroForYear(o[2],!1):"");case"Y":return h+(g?n.addLeadingZeroForYear(o[2],!0):"")}},"")},getRangeFixedDate:function(e){var t=this,r=t.datePattern,i=t.dateMin||[],n=t.dateMax||[];return!e.length||i.length<3&&n.length<3||r.find(function(a){return a.toLowerCase()==="y"})&&e[2]===0?e:n.length&&(n[2]<e[2]||n[2]===e[2]&&(n[1]<e[1]||n[1]===e[1]&&n[0]<e[0]))?n:i.length&&(i[2]>e[2]||i[2]===e[2]&&(i[1]>e[1]||i[1]===e[1]&&i[0]>e[0]))?i:e},getFixedDate:function(e,t,r){return e=Math.min(e,31),t=Math.min(t,12),r=parseInt(r||0,10),(t<7&&t%2==0||t>8&&t%2==1)&&(e=Math.min(e,t===2?this.isLeapYear(r)?29:28:30)),[e,t,r]},isLeapYear:function(e){return e%4==0&&e%100!=0||e%400==0},addLeadingZero:function(e){return(e<10?"0":"")+e},addLeadingZeroForYear:function(e,t){return t?(e<10?"000":e<100?"00":e<1e3?"0":"")+e:(e<10?"0":"")+e}};var L=k,F=function(e,t){var r=this;r.time=[],r.blocks=[],r.timePattern=e,r.timeFormat=t,r.initBlocks()};F.prototype={initBlocks:function(){var e=this;e.timePattern.forEach(function(){e.blocks.push(2)})},getISOFormatTime:function(){var e=this,t=e.time;return t[2]?e.addLeadingZero(t[0])+":"+e.addLeadingZero(t[1])+":"+e.addLeadingZero(t[2]):""},getBlocks:function(){return this.blocks},getTimeFormatOptions:function(){return String(this.timeFormat)==="12"?{maxHourFirstDigit:1,maxHours:12,maxMinutesFirstDigit:5,maxMinutes:60}:{maxHourFirstDigit:2,maxHours:23,maxMinutesFirstDigit:5,maxMinutes:60}},getValidatedTime:function(e){var t=this,r="";e=e.replace(/[^\d]/g,"");var i=t.getTimeFormatOptions();return t.blocks.forEach(function(n,a){if(e.length>0){var o=e.slice(0,n),s=o.slice(0,1),d=e.slice(n);switch(t.timePattern[a]){case"h":parseInt(s,10)>i.maxHourFirstDigit?o="0"+s:parseInt(o,10)>i.maxHours&&(o=i.maxHours+"");break;case"m":case"s":parseInt(s,10)>i.maxMinutesFirstDigit?o="0"+s:parseInt(o,10)>i.maxMinutes&&(o=i.maxMinutes+"")}r+=o,e=d}}),this.getFixedTimeString(r)},getFixedTimeString:function(e){var t,r,i,n=this,a=n.timePattern,o=[],s=0,d=0,p=0,l=0,m=0,u=0;return e.length===6&&(a.forEach(function(g,h){switch(g){case"s":s=2*h;break;case"m":d=2*h;break;case"h":p=2*h}}),u=p,m=d,l=s,t=parseInt(e.slice(l,l+2),10),r=parseInt(e.slice(m,m+2),10),i=parseInt(e.slice(u,u+2),10),o=this.getFixedTime(i,r,t)),e.length===4&&n.timePattern.indexOf("s")<0&&(a.forEach(function(g,h){switch(g){case"m":d=2*h;break;case"h":p=2*h}}),u=p,m=d,t=0,r=parseInt(e.slice(m,m+2),10),i=parseInt(e.slice(u,u+2),10),o=this.getFixedTime(i,r,t)),n.time=o,o.length===0?e:a.reduce(function(g,h){switch(h){case"s":return g+n.addLeadingZero(o[2]);case"m":return g+n.addLeadingZero(o[1]);case"h":return g+n.addLeadingZero(o[0])}},"")},getFixedTime:function(e,t,r){return r=Math.min(parseInt(r||0,10),60),t=Math.min(t,60),[e=Math.min(e,60),t,r]},addLeadingZero:function(e){return(e<10?"0":"")+e}};var V=F,P=function(e,t){var r=this;r.delimiter=t||t===""?t:" ",r.delimiterRE=t?new RegExp("\\"+t,"g"):"",r.formatter=e};P.prototype={setFormatter:function(e){this.formatter=e},format:function(e){var t=this;t.formatter.clear();for(var r,i="",n=!1,a=0,o=(e=(e=(e=e.replace(/[^\d+]/g,"")).replace(/^\+/,"B").replace(/\+/g,"").replace("B","+")).replace(t.delimiterRE,"")).length;a<o;a++)r=t.formatter.inputDigit(e.charAt(a)),/[\s()-]/g.test(r)?(i=r,n=!0):n||(i=r);return i=(i=i.replace(/[()]/g,"")).replace(/[\s-]/g,t.delimiter)}};var M=P,D={blocks:{uatp:[4,5,6],amex:[4,6,5],diners:[4,6,4],discover:[4,4,4,4],mastercard:[4,4,4,4],dankort:[4,4,4,4],instapayment:[4,4,4,4],jcb15:[4,6,5],jcb:[4,4,4,4],maestro:[4,4,4,4],visa:[4,4,4,4],mir:[4,4,4,4],unionPay:[4,4,4,4],general:[4,4,4,4]},re:{uatp:/^(?!1800)1\d{0,14}/,amex:/^3[47]\d{0,13}/,discover:/^(?:6011|65\d{0,2}|64[4-9]\d?)\d{0,12}/,diners:/^3(?:0([0-5]|9)|[689]\d?)\d{0,11}/,mastercard:/^(5[1-5]\d{0,2}|22[2-9]\d{0,1}|2[3-7]\d{0,2})\d{0,12}/,dankort:/^(5019|4175|4571)\d{0,12}/,instapayment:/^63[7-9]\d{0,13}/,jcb15:/^(?:2131|1800)\d{0,11}/,jcb:/^(?:35\d{0,2})\d{0,12}/,maestro:/^(?:5[0678]\d{0,2}|6304|67\d{0,2})\d{0,12}/,mir:/^220[0-4]\d{0,12}/,visa:/^4\d{0,15}/,unionPay:/^(62|81)\d{0,14}/},getStrictBlocks:function(e){var t=e.reduce(function(r,i){return r+i},0);return e.concat(19-t)},getInfo:function(e,t){var r=D.blocks,i=D.re;for(var n in t=!!t,i)if(i[n].test(e)){var a=r[n];return{type:n,blocks:t?this.getStrictBlocks(a):a}}return{type:"unknown",blocks:t?this.getStrictBlocks(r.general):r.general}}},E=D,T={noop:function(){},strip:function(e,t){return e.replace(t,"")},getPostDelimiter:function(e,t,r){if(r.length===0)return e.slice(-t.length)===t?t:"";var i="";return r.forEach(function(n){e.slice(-n.length)===n&&(i=n)}),i},getDelimiterREByDelimiter:function(e){return new RegExp(e.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),"g")},getNextCursorPosition:function(e,t,r,i,n){return t.length===e?r.length:e+this.getPositionOffset(e,t,r,i,n)},getPositionOffset:function(e,t,r,i,n){var a,o,s;return a=this.stripDelimiters(t.slice(0,e),i,n),o=this.stripDelimiters(r.slice(0,e),i,n),(s=a.length-o.length)!==0?s/Math.abs(s):0},stripDelimiters:function(e,t,r){var i=this;if(r.length===0){var n=t?i.getDelimiterREByDelimiter(t):"";return e.replace(n,"")}return r.forEach(function(a){a.split("").forEach(function(o){e=e.replace(i.getDelimiterREByDelimiter(o),"")})}),e},headStr:function(e,t){return e.slice(0,t)},getMaxLength:function(e){return e.reduce(function(t,r){return t+r},0)},getPrefixStrippedValue:function(e,t,r,i,n,a,o,s,d){if(r===0)return e;if(e===t&&e!=="")return"";if(d&&e.slice(0,1)=="-"){var p=i.slice(0,1)=="-"?i.slice(1):i;return"-"+this.getPrefixStrippedValue(e.slice(1),t,r,p,n,a,o,s,d)}if(i.slice(0,r)!==t&&!s||i.slice(-r)!==t&&s)return o&&!i&&e?e:"";var l=this.stripDelimiters(i,n,a);return e.slice(0,r)===t||s?e.slice(-r)!==t&&s?l.slice(0,-r-1):s?e.slice(0,-r):e.slice(r):l.slice(r)},getFirstDiffIndex:function(e,t){for(var r=0;e.charAt(r)===t.charAt(r);)if(e.charAt(r++)==="")return-1;return r},getFormattedValue:function(e,t,r,i,n,a){var o="",s=n.length>0,d="";return r===0?e:(t.forEach(function(p,l){if(e.length>0){var m=e.slice(0,p),u=e.slice(p);d=s?n[a?l-1:l]||d:i,a?(l>0&&(o+=d),o+=m):(o+=m,m.length===p&&l<r-1&&(o+=d)),e=u}}),o)},fixPrefixCursor:function(e,t,r,i){if(e){var n=e.value,a=r||i[0]||" ";if(e.setSelectionRange&&t&&!(t.length+a.length<=n.length)){var o=2*n.length;setTimeout(function(){e.setSelectionRange(o,o)},1)}}},checkFullSelection:function(e){try{return(window.getSelection()||document.getSelection()||{}).toString().length===e.length}catch{}return!1},setSelection:function(e,t,r){if(e===this.getActiveElement(r)&&!(e&&e.value.length<=t))if(e.createTextRange){var i=e.createTextRange();i.move("character",t),i.select()}else try{e.setSelectionRange(t,t)}catch{}},getActiveElement:function(e){var t=e.activeElement;return t&&t.shadowRoot?this.getActiveElement(t.shadowRoot):t},isAndroid:function(){return navigator&&/android/i.test(navigator.userAgent)},isAndroidBackspaceKeydown:function(e,t){return!!(this.isAndroid()&&e&&t)&&t===e.slice(0,-1)}},B={assign:function(e,t){return t=t||{},(e=e||{}).creditCard=!!t.creditCard,e.creditCardStrictMode=!!t.creditCardStrictMode,e.creditCardType="",e.onCreditCardTypeChanged=t.onCreditCardTypeChanged||function(){},e.phone=!!t.phone,e.phoneRegionCode=t.phoneRegionCode||"AU",e.phoneFormatter={},e.time=!!t.time,e.timePattern=t.timePattern||["h","m","s"],e.timeFormat=t.timeFormat||"24",e.timeFormatter={},e.date=!!t.date,e.datePattern=t.datePattern||["d","m","Y"],e.dateMin=t.dateMin||"",e.dateMax=t.dateMax||"",e.dateFormatter={},e.numeral=!!t.numeral,e.numeralIntegerScale=t.numeralIntegerScale>0?t.numeralIntegerScale:0,e.numeralDecimalScale=t.numeralDecimalScale>=0?t.numeralDecimalScale:2,e.numeralDecimalMark=t.numeralDecimalMark||".",e.numeralThousandsGroupStyle=t.numeralThousandsGroupStyle||"thousand",e.numeralPositiveOnly=!!t.numeralPositiveOnly,e.stripLeadingZeroes=t.stripLeadingZeroes!==!1,e.signBeforePrefix=!!t.signBeforePrefix,e.tailPrefix=!!t.tailPrefix,e.swapHiddenInput=!!t.swapHiddenInput,e.numericOnly=e.creditCard||e.date||!!t.numericOnly,e.uppercase=!!t.uppercase,e.lowercase=!!t.lowercase,e.prefix=e.creditCard||e.date?"":t.prefix||"",e.noImmediatePrefix=!!t.noImmediatePrefix,e.prefixLength=e.prefix.length,e.rawValueTrimPrefix=!!t.rawValueTrimPrefix,e.copyDelimiter=!!t.copyDelimiter,e.initValue=t.initValue!==void 0&&t.initValue!==null?t.initValue.toString():"",e.delimiter=t.delimiter||t.delimiter===""?t.delimiter:t.date?"/":t.time?":":t.numeral?",":(t.phone," "),e.delimiterLength=e.delimiter.length,e.delimiterLazyShow=!!t.delimiterLazyShow,e.delimiters=t.delimiters||[],e.blocks=t.blocks||[],e.blocksLength=e.blocks.length,e.root=typeof x=="object"&&x?x:window,e.document=t.document||e.root.document,e.maxLength=0,e.backspace=!1,e.result="",e.onValueChanged=t.onValueChanged||function(){},e}},c=function(e,t){var r=this;if(typeof e=="string"?(r.element=document.querySelector(e),document.querySelectorAll(e).length>1):e.length!==void 0&&e.length>0?(r.element=e[0],e.length>1):r.element=e,!r.element)throw new Error("[cleave.js] Please check the element");t.initValue=r.element.value,r.properties=c.DefaultProperties.assign({},t),r.init()};c.prototype={init:function(){var e=this,t=e.properties;t.numeral||t.phone||t.creditCard||t.time||t.date||t.blocksLength!==0||t.prefix?(t.maxLength=c.Util.getMaxLength(t.blocks),e.isAndroid=c.Util.isAndroid(),e.lastInputValue="",e.isBackward="",e.onChangeListener=e.onChange.bind(e),e.onKeyDownListener=e.onKeyDown.bind(e),e.onFocusListener=e.onFocus.bind(e),e.onCutListener=e.onCut.bind(e),e.onCopyListener=e.onCopy.bind(e),e.initSwapHiddenInput(),e.element.addEventListener("input",e.onChangeListener),e.element.addEventListener("keydown",e.onKeyDownListener),e.element.addEventListener("focus",e.onFocusListener),e.element.addEventListener("cut",e.onCutListener),e.element.addEventListener("copy",e.onCopyListener),e.initPhoneFormatter(),e.initDateFormatter(),e.initTimeFormatter(),e.initNumeralFormatter(),(t.initValue||t.prefix&&!t.noImmediatePrefix)&&e.onInput(t.initValue)):e.onInput(t.initValue)},initSwapHiddenInput:function(){var e=this;if(e.properties.swapHiddenInput){var t=e.element.cloneNode(!0);e.element.parentNode.insertBefore(t,e.element),e.elementSwapHidden=e.element,e.elementSwapHidden.type="hidden",e.element=t,e.element.id=""}},initNumeralFormatter:function(){var e=this.properties;e.numeral&&(e.numeralFormatter=new c.NumeralFormatter(e.numeralDecimalMark,e.numeralIntegerScale,e.numeralDecimalScale,e.numeralThousandsGroupStyle,e.numeralPositiveOnly,e.stripLeadingZeroes,e.prefix,e.signBeforePrefix,e.tailPrefix,e.delimiter))},initTimeFormatter:function(){var e=this.properties;e.time&&(e.timeFormatter=new c.TimeFormatter(e.timePattern,e.timeFormat),e.blocks=e.timeFormatter.getBlocks(),e.blocksLength=e.blocks.length,e.maxLength=c.Util.getMaxLength(e.blocks))},initDateFormatter:function(){var e=this.properties;e.date&&(e.dateFormatter=new c.DateFormatter(e.datePattern,e.dateMin,e.dateMax),e.blocks=e.dateFormatter.getBlocks(),e.blocksLength=e.blocks.length,e.maxLength=c.Util.getMaxLength(e.blocks))},initPhoneFormatter:function(){var e=this.properties;if(e.phone)try{e.phoneFormatter=new c.PhoneFormatter(new e.root.Cleave.AsYouTypeFormatter(e.phoneRegionCode),e.delimiter)}catch{throw new Error("[cleave.js] Please include phone-type-formatter.{country}.js lib")}},onKeyDown:function(e){var t=this,r=e.which||e.keyCode;t.lastInputValue=t.element.value,t.isBackward=r===8},onChange:function(e){var t=this,r=t.properties,i=c.Util;t.isBackward=t.isBackward||e.inputType==="deleteContentBackward";var n=i.getPostDelimiter(t.lastInputValue,r.delimiter,r.delimiters);t.isBackward&&n?r.postDelimiterBackspace=n:r.postDelimiterBackspace=!1,this.onInput(this.element.value)},onFocus:function(){var e=this,t=e.properties;e.lastInputValue=e.element.value,t.prefix&&t.noImmediatePrefix&&!e.element.value&&this.onInput(t.prefix),c.Util.fixPrefixCursor(e.element,t.prefix,t.delimiter,t.delimiters)},onCut:function(e){c.Util.checkFullSelection(this.element.value)&&(this.copyClipboardData(e),this.onInput(""))},onCopy:function(e){c.Util.checkFullSelection(this.element.value)&&this.copyClipboardData(e)},copyClipboardData:function(e){var t=this.properties,r=c.Util,i=this.element.value,n="";n=t.copyDelimiter?i:r.stripDelimiters(i,t.delimiter,t.delimiters);try{e.clipboardData?e.clipboardData.setData("Text",n):window.clipboardData.setData("Text",n),e.preventDefault()}catch{}},onInput:function(e){var t=this,r=t.properties,i=c.Util,n=i.getPostDelimiter(e,r.delimiter,r.delimiters);return r.numeral||!r.postDelimiterBackspace||n||(e=i.headStr(e,e.length-r.postDelimiterBackspace.length)),r.phone?(!r.prefix||r.noImmediatePrefix&&!e.length?r.result=r.phoneFormatter.format(e):r.result=r.prefix+r.phoneFormatter.format(e).slice(r.prefix.length),void t.updateValueState()):r.numeral?(r.prefix&&r.noImmediatePrefix&&e.length===0?r.result="":r.result=r.numeralFormatter.format(e),void t.updateValueState()):(r.date&&(e=r.dateFormatter.getValidatedDate(e)),r.time&&(e=r.timeFormatter.getValidatedTime(e)),e=i.stripDelimiters(e,r.delimiter,r.delimiters),e=i.getPrefixStrippedValue(e,r.prefix,r.prefixLength,r.result,r.delimiter,r.delimiters,r.noImmediatePrefix,r.tailPrefix,r.signBeforePrefix),e=r.numericOnly?i.strip(e,/[^\d]/g):e,e=r.uppercase?e.toUpperCase():e,e=r.lowercase?e.toLowerCase():e,r.prefix&&(r.tailPrefix?e+=r.prefix:e=r.prefix+e,r.blocksLength===0)?(r.result=e,void t.updateValueState()):(r.creditCard&&t.updateCreditCardPropsByValue(e),e=i.headStr(e,r.maxLength),r.result=i.getFormattedValue(e,r.blocks,r.blocksLength,r.delimiter,r.delimiters,r.delimiterLazyShow),void t.updateValueState()))},updateCreditCardPropsByValue:function(e){var t,r=this.properties,i=c.Util;i.headStr(r.result,4)!==i.headStr(e,4)&&(t=c.CreditCardDetector.getInfo(e,r.creditCardStrictMode),r.blocks=t.blocks,r.blocksLength=r.blocks.length,r.maxLength=i.getMaxLength(r.blocks),r.creditCardType!==t.type&&(r.creditCardType=t.type,r.onCreditCardTypeChanged.call(this,r.creditCardType)))},updateValueState:function(){var e=this,t=c.Util,r=e.properties;if(e.element){var i=e.element.selectionEnd,n=e.element.value,a=r.result;i=t.getNextCursorPosition(i,n,a,r.delimiter,r.delimiters),e.isAndroid?window.setTimeout(function(){e.element.value=a,t.setSelection(e.element,i,r.document,!1),e.callOnValueChanged()},1):(e.element.value=a,r.swapHiddenInput&&(e.elementSwapHidden.value=e.getRawValue()),t.setSelection(e.element,i,r.document,!1),e.callOnValueChanged())}},callOnValueChanged:function(){var e=this,t=e.properties;t.onValueChanged.call(e,{target:{name:e.element.name,value:t.result,rawValue:e.getRawValue()}})},setPhoneRegionCode:function(e){var t=this;t.properties.phoneRegionCode=e,t.initPhoneFormatter(),t.onChange()},setRawValue:function(e){var t=this,r=t.properties;e=e!=null?e.toString():"",r.numeral&&(e=e.replace(".",r.numeralDecimalMark)),r.postDelimiterBackspace=!1,t.element.value=e,t.onInput(e)},getRawValue:function(){var e=this.properties,t=c.Util,r=this.element.value;return e.rawValueTrimPrefix&&(r=t.getPrefixStrippedValue(r,e.prefix,e.prefixLength,e.result,e.delimiter,e.delimiters,e.noImmediatePrefix,e.tailPrefix,e.signBeforePrefix)),r=e.numeral?e.numeralFormatter.getRawValue(r):t.stripDelimiters(r,e.delimiter,e.delimiters)},getISOFormatDate:function(){var e=this.properties;return e.date?e.dateFormatter.getISOFormatDate():""},getISOFormatTime:function(){var e=this.properties;return e.time?e.timeFormatter.getISOFormatTime():""},getFormattedValue:function(){return this.element.value},destroy:function(){var e=this;e.element.removeEventListener("input",e.onChangeListener),e.element.removeEventListener("keydown",e.onKeyDownListener),e.element.removeEventListener("focus",e.onFocusListener),e.element.removeEventListener("cut",e.onCutListener),e.element.removeEventListener("copy",e.onCopyListener)},toString:function(){return"[Cleave Object]"}},c.NumeralFormatter=I,c.DateFormatter=L,c.TimeFormatter=V,c.PhoneFormatter=M,c.CreditCardDetector=E,c.Util=T,c.DefaultProperties=B,(typeof x=="object"&&x?x:window).Cleave=c;var S=c,N=Object.defineProperty,R=Object.getOwnPropertyDescriptor,v=(e,t,r,i)=>{for(var n,a=i>1?void 0:i?R(t,r):t,o=e.length-1;o>=0;o--)(n=e[o])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&N(t,r,a),a};exports.SchmancyPaymentCardForm=class extends w.$LitElement(){constructor(){super(...arguments),this.value={cardName:"",cardNumber:"",expirationDate:"",cvv:""}}firstUpdated(){new S(this.cardNumberInput,{creditCard:!0,creditCardStrictMode:!0,onCreditCardTypeChanged:e=>{e==="unknown"?this.cardNumberInput.setCustomValidity("Please enter a valid card number."):this.cardNumberInput.setCustomValidity("")}}),new S(this.expirationDateInput,{date:!0,datePattern:["m","y"],onValueChanged:e=>{!e.target.value||e.target.value.length<5?this.expirationDateInput.setCustomValidity("Please enter a valid expiration date."):this.expirationDateInput.setCustomValidity("")}}),new S(this.cvvInput,{blocks:[4],numericOnly:!0,onValueChanged:e=>{e.target.value.length<3?this.cvvInput.setCustomValidity("Please enter a valid CVV."):this.cvvInput.setCustomValidity("")}}),new S(this.cardNameInput,{uppercase:!0,delimiter:" "})}reportValidity(){return this.form.reportValidity()}checkValidity(){return!!this.form.reportValidity()}emitChange(){this.dispatchEvent(new CustomEvent("change",{detail:{...this.value}}))}render(){return b.html` <schmancy-form
|
|
2
2
|
@change=${e=>{e.stopPropagation(),e.preventDefault()}}
|
|
3
3
|
>
|
|
4
4
|
<schmancy-grid gap="sm">
|
|
@@ -45,4 +45,4 @@
|
|
|
45
45
|
</schmancy-grid>
|
|
46
46
|
</schmancy-grid>
|
|
47
47
|
</schmancy-form>`}},v([f.property({type:Object,reflect:!0})],exports.SchmancyPaymentCardForm.prototype,"value",2),v([f.state()],exports.SchmancyPaymentCardForm.prototype,"cardName",2),v([f.state()],exports.SchmancyPaymentCardForm.prototype,"cardNumber",2),v([f.state()],exports.SchmancyPaymentCardForm.prototype,"expirationDate",2),v([f.state()],exports.SchmancyPaymentCardForm.prototype,"cvv",2),v([f.query("#cardNumber")],exports.SchmancyPaymentCardForm.prototype,"cardNumberInput",2),v([f.query("#expirationDate")],exports.SchmancyPaymentCardForm.prototype,"expirationDateInput",2),v([f.query("#cvv")],exports.SchmancyPaymentCardForm.prototype,"cvvInput",2),v([f.query("#cardName")],exports.SchmancyPaymentCardForm.prototype,"cardNameInput",2),v([f.query("schmancy-form")],exports.SchmancyPaymentCardForm.prototype,"form",2),exports.SchmancyPaymentCardForm=v([f.customElement("schmancy-payment-card-form")],exports.SchmancyPaymentCardForm);
|
|
48
|
-
//# sourceMappingURL=payment-card-form-
|
|
48
|
+
//# sourceMappingURL=payment-card-form-BXq6Mxck.cjs.map
|