@mhmo91/schmancy 0.2.23 → 0.2.27
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-Dj6eM2tE.cjs → animated-text-C5zM-91H.cjs} +2 -2
- package/dist/{animated-text-Dj6eM2tE.cjs.map → animated-text-C5zM-91H.cjs.map} +1 -1
- package/dist/{animated-text-CUx9CM5O.js → animated-text-IHZ7LNnc.js} +3 -3
- package/dist/{animated-text-CUx9CM5O.js.map → animated-text-IHZ7LNnc.js.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-B3adb0Y6.js → area.component-BrPf_qdG.js} +3 -3
- package/dist/{area.component-B3adb0Y6.js.map → area.component-BrPf_qdG.js.map} +1 -1
- package/dist/{area.component-Do3Jb3jC.cjs → area.component-DCLLi1YA.cjs} +2 -2
- package/dist/{area.component-Do3Jb3jC.cjs.map → area.component-DCLLi1YA.cjs.map} +1 -1
- package/dist/area.js +1 -1
- package/dist/{autocomplete-BUOnKDbI.js → autocomplete-CcDfKbfJ.js} +3 -3
- package/dist/{autocomplete-BUOnKDbI.js.map → autocomplete-CcDfKbfJ.js.map} +1 -1
- package/dist/{autocomplete-U3vu-siT.cjs → autocomplete-Dfq-Rhjy.cjs} +2 -2
- package/dist/{autocomplete-U3vu-siT.cjs.map → autocomplete-Dfq-Rhjy.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-FZpN0Mgj.cjs → checkbox-BdsGj_z6.cjs} +2 -2
- package/dist/{checkbox-FZpN0Mgj.cjs.map → checkbox-BdsGj_z6.cjs.map} +1 -1
- package/dist/{checkbox-BWaWg2Gm.js → checkbox-DV8tPYX0.js} +2 -2
- package/dist/{checkbox-BWaWg2Gm.js.map → checkbox-DV8tPYX0.js.map} +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{chips-CRfhI-G7.js → chips-Ca-SY6mg.js} +3 -3
- package/dist/{chips-CRfhI-G7.js.map → chips-Ca-SY6mg.js.map} +1 -1
- package/dist/{chips-BoxKYOMa.cjs → chips-Z8e_rQtM.cjs} +2 -2
- package/dist/{chips-BoxKYOMa.cjs.map → chips-Z8e_rQtM.cjs.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-X97ioY-h.cjs → date-range-CDX0VlcK.cjs} +2 -2
- package/dist/{date-range-X97ioY-h.cjs.map → date-range-CDX0VlcK.cjs.map} +1 -1
- package/dist/{date-range-2Zd4XvrS.js → date-range-DdGaWGVn.js} +3 -3
- package/dist/{date-range-2Zd4XvrS.js.map → date-range-DdGaWGVn.js.map} +1 -1
- package/dist/date-range.cjs +1 -1
- package/dist/date-range.js +1 -1
- package/dist/{delay-CwXLGveT.js → delay-BWLlCMKV.js} +2 -2
- package/dist/{delay-CwXLGveT.js.map → delay-BWLlCMKV.js.map} +1 -1
- package/dist/{delay-BqTo3aLA.cjs → delay-DsFVHHw2.cjs} +2 -2
- package/dist/{delay-BqTo3aLA.cjs.map → delay-DsFVHHw2.cjs.map} +1 -1
- package/dist/delay.cjs +1 -1
- package/dist/delay.js +1 -1
- package/dist/{divider-CdV7coS1.js → divider-B7kWs-q5.js} +3 -3
- package/dist/{divider-CdV7coS1.js.map → divider-B7kWs-q5.js.map} +1 -1
- package/dist/{divider-BfxgNMsI.cjs → divider-CjgOM462.cjs} +2 -2
- package/dist/{divider-BfxgNMsI.cjs.map → divider-CjgOM462.cjs.map} +1 -1
- package/dist/divider.cjs +1 -1
- package/dist/divider.js +1 -1
- package/dist/{form-DfGEOLag.js → form-BUV1hUzI.js} +2 -2
- package/dist/{form-DfGEOLag.js.map → form-BUV1hUzI.js.map} +1 -1
- package/dist/{form-BTnhPK7O.cjs → form-DyYGOlOR.cjs} +2 -2
- package/dist/{form-BTnhPK7O.cjs.map → form-DyYGOlOR.cjs.map} +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.js +1 -1
- package/dist/{icon-B34qm8t_.js → icon-CWvUTBIP.js} +3 -3
- package/dist/{icon-B34qm8t_.js.map → icon-CWvUTBIP.js.map} +1 -1
- package/dist/{icon-DL24gxLi.cjs → icon-DPN7kWO0.cjs} +2 -2
- package/dist/{icon-DL24gxLi.cjs.map → icon-DPN7kWO0.cjs.map} +1 -1
- package/dist/{icon-button-yOFOGX0Y.js → icon-button-CbEs8eyS.js} +3 -3
- package/dist/{icon-button-yOFOGX0Y.js.map → icon-button-CbEs8eyS.js.map} +1 -1
- package/dist/{icon-button-BXlgRBET.cjs → icon-button-DHiO0w8J.cjs} +2 -2
- package/dist/{icon-button-BXlgRBET.cjs.map → icon-button-DHiO0w8J.cjs.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 +49 -50
- package/dist/{input-C5Qe0WzY.cjs → input-2kqgsr0S.cjs} +2 -2
- package/dist/{input-C5Qe0WzY.cjs.map → input-2kqgsr0S.cjs.map} +1 -1
- package/dist/{input-B63-M9qj.js → input-D3hti5wB.js} +2 -2
- package/dist/{input-B63-M9qj.js.map → input-D3hti5wB.js.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-BDw1aNOH.cjs → list-Cq9RDYF_.cjs} +2 -2
- package/dist/{list-BDw1aNOH.cjs.map → list-Cq9RDYF_.cjs.map} +1 -1
- package/dist/{list-C9kPT0mr.js → list-D3m-rd6d.js} +2 -2
- package/dist/{list-C9kPT0mr.js.map → list-D3m-rd6d.js.map} +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/{litElement.mixin-CJYb3izk.js → litElement.mixin-CjxO_zfv.js} +2 -2
- package/dist/{litElement.mixin-CJYb3izk.js.map → litElement.mixin-CjxO_zfv.js.map} +1 -1
- package/dist/{litElement.mixin-Cw40wOLl.cjs → litElement.mixin-DWxwPXWQ.cjs} +2 -2
- package/dist/{litElement.mixin-Cw40wOLl.cjs.map → litElement.mixin-DWxwPXWQ.cjs.map} +1 -1
- package/dist/{menu-B-9Sd5xU.js → menu-CCQYHiy2.js} +3 -3
- package/dist/{menu-B-9Sd5xU.js.map → menu-CCQYHiy2.js.map} +1 -1
- package/dist/{menu-BezCg_ZV.cjs → menu-ifiBMg-F.cjs} +2 -2
- package/dist/{menu-BezCg_ZV.cjs.map → menu-ifiBMg-F.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-ETcMXlUc.js → option-CM24cDF6.js} +2 -2
- package/dist/{option-ETcMXlUc.js.map → option-CM24cDF6.js.map} +1 -1
- package/dist/{option-Ds6sb35B.cjs → option-DOBWmGE5.cjs} +2 -2
- package/dist/{option-Ds6sb35B.cjs.map → option-DOBWmGE5.cjs.map} +1 -1
- package/dist/option.cjs +1 -1
- package/dist/option.js +1 -1
- package/dist/{outlet-Bc4MC45j.js → outlet-BsrhXTEg.js} +44 -40
- package/dist/outlet-BsrhXTEg.js.map +1 -0
- package/dist/{outlet-BDkD7_9L.cjs → outlet-u1_Qa8Li.cjs} +4 -4
- package/dist/outlet-u1_Qa8Li.cjs.map +1 -0
- package/dist/{payment-card-form-BXq6Mxck.cjs → payment-card-form-B7tV2ttW.cjs} +2 -2
- package/dist/{payment-card-form-BXq6Mxck.cjs.map → payment-card-form-B7tV2ttW.cjs.map} +1 -1
- package/dist/{payment-card-form-yjKqadtl.js → payment-card-form-CTZsSGOB.js} +3 -3
- package/dist/{payment-card-form-yjKqadtl.js.map → payment-card-form-CTZsSGOB.js.map} +1 -1
- package/dist/{radio-group-SZ7LT0BI.js → radio-group-dN2lWcFu.js} +2 -2
- package/dist/{radio-group-SZ7LT0BI.js.map → radio-group-dN2lWcFu.js.map} +1 -1
- package/dist/{radio-group-B3jrTLIL.cjs → radio-group-m5Swl5cq.cjs} +2 -2
- package/dist/{radio-group-B3jrTLIL.cjs.map → radio-group-m5Swl5cq.cjs.map} +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/{scroll-BZXWpgyx.js → scroll-Bl-fR7Vv.js} +2 -2
- package/dist/{scroll-BZXWpgyx.js.map → scroll-Bl-fR7Vv.js.map} +1 -1
- package/dist/{scroll-DIBR9WHR.cjs → scroll-DnAxN1uS.cjs} +2 -2
- package/dist/{scroll-DIBR9WHR.cjs.map → scroll-DnAxN1uS.cjs.map} +1 -1
- package/dist/{select-Bfkeb6KP.cjs → select-Bzf5TEob.cjs} +2 -2
- package/dist/{select-Bfkeb6KP.cjs.map → select-Bzf5TEob.cjs.map} +1 -1
- package/dist/{select-0kZshsvW.js → select-CR2mQf_Q.js} +3 -3
- package/dist/{select-0kZshsvW.js.map → select-CR2mQf_Q.js.map} +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/sheet-B7UZL0S4.cjs +45 -0
- package/dist/sheet-B7UZL0S4.cjs.map +1 -0
- package/dist/sheet-Qm3DILOR.js +179 -0
- package/dist/sheet-Qm3DILOR.js.map +1 -0
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +5 -6
- package/dist/{slider-D4GAHeMx.js → slider-FTwWTvKi.js} +3 -3
- package/dist/{slider-D4GAHeMx.js.map → slider-FTwWTvKi.js.map} +1 -1
- package/dist/{slider-DEaQC5Qe.cjs → slider-ds6hnN7n.cjs} +2 -2
- package/dist/{slider-DEaQC5Qe.cjs.map → slider-ds6hnN7n.cjs.map} +1 -1
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +1 -1
- package/dist/{spinner-BJ5VG2fV.cjs → spinner-8GhT-bLm.cjs} +2 -2
- package/dist/{spinner-BJ5VG2fV.cjs.map → spinner-8GhT-bLm.cjs.map} +1 -1
- package/dist/{spinner-_aBya_Qc.js → spinner-zxOxMm7j.js} +3 -3
- package/dist/{spinner-_aBya_Qc.js.map → spinner-zxOxMm7j.js.map} +1 -1
- package/dist/surface-BzSJT7y7.cjs +10 -0
- package/dist/surface-BzSJT7y7.cjs.map +1 -0
- package/dist/surface-DdbqvBbW.js +43 -0
- package/dist/surface-DdbqvBbW.js.map +1 -0
- package/dist/surface.cjs +1 -1
- package/dist/surface.js +1 -1
- package/dist/{table-Ds0ivk4n.js → table-6bRKgCJ9.js} +2 -2
- package/dist/{table-Ds0ivk4n.js.map → table-6bRKgCJ9.js.map} +1 -1
- package/dist/{table-BmyyQrx8.cjs → table-BDIhXdSA.cjs} +2 -2
- package/dist/{table-BmyyQrx8.cjs.map → table-BDIhXdSA.cjs.map} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.js +1 -1
- package/dist/{tabs-group-2sFsKJxb.cjs → tabs-group-CHAAr7Wl.cjs} +2 -2
- package/dist/{tabs-group-2sFsKJxb.cjs.map → tabs-group-CHAAr7Wl.cjs.map} +1 -1
- package/dist/{tabs-group-OdIAitHN.js → tabs-group-DBybIi8n.js} +2 -2
- package/dist/{tabs-group-OdIAitHN.js.map → tabs-group-DBybIi8n.js.map} +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/{tailwind.mixin-wwBoa4Jw.js → tailwind.mixin-DtR4DQvn.js} +11 -11
- package/dist/{tailwind.mixin-wwBoa4Jw.js.map → tailwind.mixin-DtR4DQvn.js.map} +1 -1
- package/dist/{tailwind.mixin-mhYVlkxs.cjs → tailwind.mixin-_mD_GeAp.cjs} +2 -2
- package/dist/{tailwind.mixin-mhYVlkxs.cjs.map → tailwind.mixin-_mD_GeAp.cjs.map} +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/{teleport.component-J9cOCWCT.cjs → teleport.component-BXIGP3Vs.cjs} +2 -2
- package/dist/{teleport.component-J9cOCWCT.cjs.map → teleport.component-BXIGP3Vs.cjs.map} +1 -1
- package/dist/{teleport.component-CBMVwlTg.js → teleport.component-Cn1e_GQp.js} +35 -35
- package/dist/{teleport.component-CBMVwlTg.js.map → teleport.component-Cn1e_GQp.js.map} +1 -1
- package/dist/teleport.js +1 -1
- package/dist/{textarea-p0XofIBJ.js → textarea-BchwVUAo.js} +2 -2
- package/dist/{textarea-p0XofIBJ.js.map → textarea-BchwVUAo.js.map} +1 -1
- package/dist/{textarea-DE-5ySnu.cjs → textarea-CJhi4hDu.cjs} +2 -2
- package/dist/{textarea-DE-5ySnu.cjs.map → textarea-CJhi4hDu.cjs.map} +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{theme-button-HfAO7YLi.cjs → theme-button-DoIFEVSv.cjs} +2 -2
- package/dist/{theme-button-HfAO7YLi.cjs.map → theme-button-DoIFEVSv.cjs.map} +1 -1
- package/dist/{theme-button-BczCoNKk.js → theme-button-dxTV0k03.js} +2 -2
- package/dist/{theme-button-BczCoNKk.js.map → theme-button-dxTV0k03.js.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-Dhm3MpVW.cjs +3 -0
- package/dist/{theme.component-78M08LUD.cjs.map → theme.component-Dhm3MpVW.cjs.map} +1 -1
- package/dist/{theme.component-CKmrq6vY.js → theme.component-DwZx0sdk.js} +314 -307
- package/dist/{theme.component-CKmrq6vY.js.map → theme.component-DwZx0sdk.js.map} +1 -1
- package/dist/theme.js +1 -1
- package/dist/{tree-C0L22or-.cjs → tree-BkhYPaz6.cjs} +2 -2
- package/dist/{tree-C0L22or-.cjs.map → tree-BkhYPaz6.cjs.map} +1 -1
- package/dist/{tree-CJueZNtq.js → tree-C7GnGCWU.js} +2 -2
- package/dist/{tree-CJueZNtq.js.map → tree-C7GnGCWU.js.map} +1 -1
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/{typewriter-n3ITVaff.cjs → typewriter-DGIW1V_b.cjs} +2 -2
- package/dist/{typewriter-n3ITVaff.cjs.map → typewriter-DGIW1V_b.cjs.map} +1 -1
- package/dist/{typewriter-DOVBdtxY.js → typewriter-DfOKVMWh.js} +4 -4
- package/dist/{typewriter-DOVBdtxY.js.map → typewriter-DfOKVMWh.js.map} +1 -1
- package/dist/typewriter.cjs +1 -1
- package/dist/typewriter.js +1 -1
- package/dist/{typography-bMZIS2rJ.cjs → typography-DQHpwRFR.cjs} +2 -2
- package/dist/{typography-bMZIS2rJ.cjs.map → typography-DQHpwRFR.cjs.map} +1 -1
- package/dist/{typography-BRiJcJhp.js → typography-En0tk2d5.js} +2 -2
- package/dist/{typography-BRiJcJhp.js.map → typography-En0tk2d5.js.map} +1 -1
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +1 -1
- package/package.json +8 -8
- package/types/src/notification/$notification.d.ts +1 -0
- package/types/src/sheet/hook.d.ts +1 -1
- package/types/src/sheet/index.d.ts +0 -2
- package/types/src/surface/surface.d.ts +1 -0
- package/types/src/theme/theme.format.d.ts +7 -1
- package/dist/outlet-BDkD7_9L.cjs.map +0 -1
- package/dist/outlet-Bc4MC45j.js.map +0 -1
- package/dist/sheet-CJ6kO7WG.cjs +0 -48
- package/dist/sheet-CJ6kO7WG.cjs.map +0 -1
- package/dist/sheet-CoO8bSHc.js +0 -195
- package/dist/sheet-CoO8bSHc.js.map +0 -1
- package/dist/surface-DKrkxarv.cjs +0 -14
- package/dist/surface-DKrkxarv.cjs.map +0 -1
- package/dist/surface-DlwQilPV.js +0 -40
- package/dist/surface-DlwQilPV.js.map +0 -1
- package/dist/theme.component-78M08LUD.cjs +0 -3
package/dist/nav-drawer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as c, k as n, l as e, m, j as h, n as i, h as s } from "./teleport.component-
|
|
1
|
+
import { i as c, k as n, l as e, m, j as h, n as i, h as s } from "./teleport.component-Cn1e_GQp.js";
|
|
2
2
|
export {
|
|
3
3
|
c as SchmancyDrawerAppbar,
|
|
4
4
|
n as SchmancyDrawerNavbarMode,
|
package/dist/notification.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./outlet-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./outlet-u1_Qa8Li.cjs");exports.$notify=e.$notify,Object.defineProperty(exports,"SchmancyNotification",{enumerable:!0,get:()=>e.SchmancyNotification}),Object.defineProperty(exports,"SchmancyNotificationOutlet",{enumerable:!0,get:()=>e.SchmancyNotificationOutlet});
|
|
2
2
|
//# sourceMappingURL=notification.cjs.map
|
package/dist/notification.js
CHANGED
|
@@ -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-DtR4DQvn.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-CM24cDF6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-
|
|
1
|
+
{"version":3,"file":"option-CM24cDF6.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;"}
|
|
@@ -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-_mD_GeAp.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-DOBWmGE5.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-
|
|
1
|
+
{"version":3,"file":"option-DOBWmGE5.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"}
|
package/dist/option.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("./option-
|
|
1
|
+
"use strict";require("./option-DOBWmGE5.cjs");
|
|
2
2
|
//# sourceMappingURL=option.cjs.map
|
package/dist/option.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./option-
|
|
1
|
+
import "./option-CM24cDF6.js";
|
|
2
2
|
//# sourceMappingURL=option.js.map
|
|
@@ -1,42 +1,46 @@
|
|
|
1
|
-
import { Subject as
|
|
1
|
+
import { Subject as m, buffer as g, debounceTime as x, race as y, fromEvent as b, timer as w } from "rxjs";
|
|
2
2
|
import "lit/directives/class-map.js";
|
|
3
3
|
import "lit/directives/style-map.js";
|
|
4
|
-
import { T as
|
|
4
|
+
import { T as v } from "./tailwind.mixin-DtR4DQvn.js";
|
|
5
5
|
import { html as l } from "lit";
|
|
6
|
-
import { property as
|
|
7
|
-
function a(
|
|
8
|
-
const
|
|
9
|
-
return
|
|
6
|
+
import { property as k, customElement as f } from "lit/decorators.js";
|
|
7
|
+
function a(e, t) {
|
|
8
|
+
const n = document.createElement("schmancy-notification");
|
|
9
|
+
return n.setAttribute("type", t), n.innerHTML = e, n;
|
|
10
10
|
}
|
|
11
|
-
const r = new
|
|
12
|
-
const
|
|
13
|
-
return r.next({ component:
|
|
14
|
-
}, error: (
|
|
15
|
-
const
|
|
16
|
-
return r.next({ component:
|
|
17
|
-
}, warning: (
|
|
18
|
-
const
|
|
19
|
-
return r.next({ component:
|
|
20
|
-
}, info: (
|
|
21
|
-
const
|
|
22
|
-
return r.next({ component:
|
|
11
|
+
const r = new m(), h = new m(), j = { success: (e, t) => {
|
|
12
|
+
const n = a(e, "success");
|
|
13
|
+
return r.next({ component: n, config: t }), n;
|
|
14
|
+
}, error: (e, t) => {
|
|
15
|
+
const n = a(e, "error");
|
|
16
|
+
return r.next({ component: n, config: t }), n;
|
|
17
|
+
}, warning: (e, t) => {
|
|
18
|
+
const n = a(e, "warning");
|
|
19
|
+
return r.next({ component: n, config: t }), n;
|
|
20
|
+
}, info: (e, t) => {
|
|
21
|
+
const n = a(e, "info");
|
|
22
|
+
return r.next({ component: n, config: t }), n;
|
|
23
|
+
}, dismiss: (e) => {
|
|
24
|
+
h.next(e);
|
|
23
25
|
} };
|
|
24
|
-
r.pipe(
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
r.next({ component:
|
|
26
|
+
r.pipe(g(r.pipe(x(1e3)))).subscribe((e) => {
|
|
27
|
+
if (e.length > 1) {
|
|
28
|
+
const t = e[e.length - 1];
|
|
29
|
+
r.next({ component: t.component, config: t.config });
|
|
28
30
|
}
|
|
29
|
-
}), r.subscribe(({ component:
|
|
30
|
-
var
|
|
31
|
-
(
|
|
32
|
-
|
|
31
|
+
}), r.subscribe(({ component: e, config: t }) => {
|
|
32
|
+
var n;
|
|
33
|
+
(n = document.body) == null || n.appendChild(e), y(b(e, "close"), w((t == null ? void 0 : t.duration) ?? 3e3)).subscribe(() => {
|
|
34
|
+
e.remove();
|
|
33
35
|
});
|
|
36
|
+
}), h.subscribe((e) => {
|
|
37
|
+
e.dispatchEvent(new CustomEvent("close"));
|
|
34
38
|
});
|
|
35
|
-
var
|
|
36
|
-
for (var c,
|
|
37
|
-
return o &&
|
|
39
|
+
var E = Object.defineProperty, C = Object.getOwnPropertyDescriptor, p = (e, t, n, o) => {
|
|
40
|
+
for (var c, s = o > 1 ? void 0 : o ? C(t, n) : t, i = e.length - 1; i >= 0; i--) (c = e[i]) && (s = (o ? c(t, n, s) : c(s)) || s);
|
|
41
|
+
return o && s && E(t, n, s), s;
|
|
38
42
|
};
|
|
39
|
-
let
|
|
43
|
+
let d = class extends v() {
|
|
40
44
|
constructor() {
|
|
41
45
|
super(...arguments), this.type = "success";
|
|
42
46
|
}
|
|
@@ -90,7 +94,7 @@ let p = class extends m() {
|
|
|
90
94
|
<schmancy-icon-button
|
|
91
95
|
type="button"
|
|
92
96
|
@click=${() => {
|
|
93
|
-
this.dispatchEvent(new CustomEvent("close"));
|
|
97
|
+
j.dismiss(this), this.dispatchEvent(new CustomEvent("close"));
|
|
94
98
|
}}
|
|
95
99
|
>
|
|
96
100
|
<span class="sr-only">Close</span>
|
|
@@ -105,20 +109,20 @@ let p = class extends m() {
|
|
|
105
109
|
`;
|
|
106
110
|
}
|
|
107
111
|
};
|
|
108
|
-
|
|
109
|
-
var O = Object.defineProperty,
|
|
110
|
-
let u = class extends
|
|
112
|
+
p([k({ type: String })], d.prototype, "type", 2), d = p([f("schmancy-notification")], d);
|
|
113
|
+
var O = Object.defineProperty, M = Object.getOwnPropertyDescriptor;
|
|
114
|
+
let u = class extends v() {
|
|
111
115
|
render() {
|
|
112
116
|
return l` <slot></slot> `;
|
|
113
117
|
}
|
|
114
118
|
};
|
|
115
|
-
u = ((
|
|
116
|
-
for (var c,
|
|
117
|
-
return o &&
|
|
119
|
+
u = ((e, t, n, o) => {
|
|
120
|
+
for (var c, s = o > 1 ? void 0 : o ? M(t, n) : t, i = e.length - 1; i >= 0; i--) (c = e[i]) && (s = (o ? c(t, n, s) : c(s)) || s);
|
|
121
|
+
return o && s && O(t, n, s), s;
|
|
118
122
|
})([f("schmancy-notification-outlet")], u);
|
|
119
123
|
export {
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
j as $,
|
|
125
|
+
d as S,
|
|
122
126
|
u as a
|
|
123
127
|
};
|
|
124
|
-
//# sourceMappingURL=outlet-
|
|
128
|
+
//# sourceMappingURL=outlet-BsrhXTEg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlet-BsrhXTEg.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\taction?: typeof Function\n\tduration?: number\n}\n\n// Create a notification component and assign it the proper type.\nfunction createNotificationComponent(message: string, type: TNotification): SchmancyNotification {\n\tconst notificationComponent = document.createElement('schmancy-notification') as SchmancyNotification\n\tnotificationComponent.setAttribute('type', type)\n\tnotificationComponent.innerHTML = message\n\treturn notificationComponent\n}\n\n// Main notifications subject: each emission will schedule a notification.\nconst $notifications = new Subject<{\n\tcomponent: SchmancyNotification\n\tconfig?: TNotificationConfig\n}>()\n\n// New subject to handle explicit dismiss calls.\nconst $dismissNotification = new Subject<SchmancyNotification>()\n\n// Exported API for notifications\nexport const $notify = {\n\tsuccess: (message: string, config?: TNotificationConfig) => {\n\t\tconst component = createNotificationComponent(message, 'success')\n\t\t$notifications.next({ component, config })\n\t\treturn component\n\t},\n\terror: (message: string, config?: TNotificationConfig) => {\n\t\tconst component = createNotificationComponent(message, 'error')\n\t\t$notifications.next({ component, config })\n\t\treturn component\n\t},\n\twarning: (message: string, config?: TNotificationConfig) => {\n\t\tconst component = createNotificationComponent(message, 'warning')\n\t\t$notifications.next({ component, config })\n\t\treturn component\n\t},\n\tinfo: (message: string, config?: TNotificationConfig) => {\n\t\tconst component = createNotificationComponent(message, 'info')\n\t\t$notifications.next({ component, config })\n\t\treturn component\n\t},\n\t// New dismiss method: call this with a notification component to dismiss it early.\n\tdismiss: (component: SchmancyNotification) => {\n\t\t$dismissNotification.next(component)\n\t},\n}\n\n// Optional: If you want to collapse multiple notifications into a single one,\n// the same logic as before can be retained.\n$notifications.pipe(buffer($notifications.pipe(debounceTime(1000)))).subscribe(notifications => {\n\tif (notifications.length > 1) {\n\t\tconst notification = notifications[notifications.length - 1]\n\t\t// Re-emit the latest notification for display.\n\t\t$notifications.next({ component: notification.component, config: notification.config })\n\t}\n})\n\n// Whenever a notification is published, append it to the DOM and set up removal.\n$notifications.subscribe(({ component, config }) => {\n\tdocument.body?.appendChild(component)\n\n\t// Create a race: wait for either the component’s own 'close' event (or an external dismiss)\n\t// or a timeout based on the config's duration (default: 3000ms).\n\trace(fromEvent(component, 'close'), timer(config?.duration ?? 3000)).subscribe(() => {\n\t\tcomponent.remove()\n\t})\n})\n\n// Listen for explicit dismiss calls. When a notification is to be dismissed via $notify.dismiss(),\n// dispatch a 'close' event on it. This will trigger the race above.\n$dismissNotification.subscribe(component => {\n\t// You could also include any additional logic here if needed.\n\tcomponent.dispatchEvent(new CustomEvent('close'))\n})\n","import { TailwindElement } from '@mixins/index'\nimport { $notify } from '@schmancy/notification'\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\t$notify.dismiss(this)\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","$dismissNotification","$notify","success","config","component","next","error","warning","info","dismiss","pipe","buffer","debounceTime","subscribe","notifications","length","notification","body","appendChild","race","fromEvent","timer","duration","remove","dispatchEvent","CustomEvent","SchmancyNotification","TailwindElement","super","arguments","this","html","__decorateClass","property","String","prototype","customElement","SchmancyNotificationOutlet"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const a=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const p=require("./tailwind.mixin-
|
|
1
|
+
"use strict";const a=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const p=require("./tailwind.mixin-_mD_GeAp.cjs"),u=require("lit"),d=require("lit/decorators.js");function l(e,t){const n=document.createElement("schmancy-notification");return n.setAttribute("type",t),n.innerHTML=e,n}const s=new a.Subject,f=new a.Subject,v={success:(e,t)=>{const n=l(e,"success");return s.next({component:n,config:t}),n},error:(e,t)=>{const n=l(e,"error");return s.next({component:n,config:t}),n},warning:(e,t)=>{const n=l(e,"warning");return s.next({component:n,config:t}),n},info:(e,t)=>{const n=l(e,"info");return s.next({component:n,config:t}),n},dismiss:e=>{f.next(e)}};s.pipe(a.buffer(s.pipe(a.debounceTime(1e3)))).subscribe(e=>{if(e.length>1){const t=e[e.length-1];s.next({component:t.component,config:t.config})}}),s.subscribe(({component:e,config:t})=>{var n;(n=document.body)==null||n.appendChild(e),a.race(a.fromEvent(e,"close"),a.timer((t==null?void 0:t.duration)??3e3)).subscribe(()=>{e.remove()})}),f.subscribe(e=>{e.dispatchEvent(new CustomEvent("close"))});var h=Object.defineProperty,y=Object.getOwnPropertyDescriptor,m=(e,t,n,o)=>{for(var c,i=o>1?void 0:o?y(t,n):t,r=e.length-1;r>=0;r--)(c=e[r])&&(i=(o?c(t,n,i):c(i))||i);return o&&i&&h(t,n,i),i};exports.SchmancyNotification=class extends p.TailwindElement(){constructor(){super(...arguments),this.type="success"}render(){return u.html`
|
|
2
2
|
<div
|
|
3
3
|
aria-live="assertive"
|
|
4
4
|
class="pointer-events-none z-100 fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
<div class="ml-4 flex shrink-0">
|
|
47
47
|
<schmancy-icon-button
|
|
48
48
|
type="button"
|
|
49
|
-
@click=${()=>{this.dispatchEvent(new CustomEvent("close"))}}
|
|
49
|
+
@click=${()=>{v.dismiss(this),this.dispatchEvent(new CustomEvent("close"))}}
|
|
50
50
|
>
|
|
51
51
|
<span class="sr-only">Close</span>
|
|
52
52
|
close
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
</div>
|
|
58
58
|
</div>
|
|
59
59
|
</div>
|
|
60
|
-
`}},m([d.property({type:String})],exports.SchmancyNotification.prototype,"type",2),exports.SchmancyNotification=m([d.customElement("schmancy-notification")],exports.SchmancyNotification);var
|
|
61
|
-
//# sourceMappingURL=outlet-
|
|
60
|
+
`}},m([d.property({type:String})],exports.SchmancyNotification.prototype,"type",2),exports.SchmancyNotification=m([d.customElement("schmancy-notification")],exports.SchmancyNotification);var g=Object.defineProperty,b=Object.getOwnPropertyDescriptor;exports.SchmancyNotificationOutlet=class extends p.TailwindElement(){render(){return u.html` <slot></slot> `}},exports.SchmancyNotificationOutlet=((e,t,n,o)=>{for(var c,i=o>1?void 0:o?b(t,n):t,r=e.length-1;r>=0;r--)(c=e[r])&&(i=(o?c(t,n,i):c(i))||i);return o&&i&&g(t,n,i),i})([d.customElement("schmancy-notification-outlet")],exports.SchmancyNotificationOutlet),exports.$notify=v;
|
|
61
|
+
//# sourceMappingURL=outlet-u1_Qa8Li.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlet-u1_Qa8Li.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\taction?: typeof Function\n\tduration?: number\n}\n\n// Create a notification component and assign it the proper type.\nfunction createNotificationComponent(message: string, type: TNotification): SchmancyNotification {\n\tconst notificationComponent = document.createElement('schmancy-notification') as SchmancyNotification\n\tnotificationComponent.setAttribute('type', type)\n\tnotificationComponent.innerHTML = message\n\treturn notificationComponent\n}\n\n// Main notifications subject: each emission will schedule a notification.\nconst $notifications = new Subject<{\n\tcomponent: SchmancyNotification\n\tconfig?: TNotificationConfig\n}>()\n\n// New subject to handle explicit dismiss calls.\nconst $dismissNotification = new Subject<SchmancyNotification>()\n\n// Exported API for notifications\nexport const $notify = {\n\tsuccess: (message: string, config?: TNotificationConfig) => {\n\t\tconst component = createNotificationComponent(message, 'success')\n\t\t$notifications.next({ component, config })\n\t\treturn component\n\t},\n\terror: (message: string, config?: TNotificationConfig) => {\n\t\tconst component = createNotificationComponent(message, 'error')\n\t\t$notifications.next({ component, config })\n\t\treturn component\n\t},\n\twarning: (message: string, config?: TNotificationConfig) => {\n\t\tconst component = createNotificationComponent(message, 'warning')\n\t\t$notifications.next({ component, config })\n\t\treturn component\n\t},\n\tinfo: (message: string, config?: TNotificationConfig) => {\n\t\tconst component = createNotificationComponent(message, 'info')\n\t\t$notifications.next({ component, config })\n\t\treturn component\n\t},\n\t// New dismiss method: call this with a notification component to dismiss it early.\n\tdismiss: (component: SchmancyNotification) => {\n\t\t$dismissNotification.next(component)\n\t},\n}\n\n// Optional: If you want to collapse multiple notifications into a single one,\n// the same logic as before can be retained.\n$notifications.pipe(buffer($notifications.pipe(debounceTime(1000)))).subscribe(notifications => {\n\tif (notifications.length > 1) {\n\t\tconst notification = notifications[notifications.length - 1]\n\t\t// Re-emit the latest notification for display.\n\t\t$notifications.next({ component: notification.component, config: notification.config })\n\t}\n})\n\n// Whenever a notification is published, append it to the DOM and set up removal.\n$notifications.subscribe(({ component, config }) => {\n\tdocument.body?.appendChild(component)\n\n\t// Create a race: wait for either the component’s own 'close' event (or an external dismiss)\n\t// or a timeout based on the config's duration (default: 3000ms).\n\trace(fromEvent(component, 'close'), timer(config?.duration ?? 3000)).subscribe(() => {\n\t\tcomponent.remove()\n\t})\n})\n\n// Listen for explicit dismiss calls. When a notification is to be dismissed via $notify.dismiss(),\n// dispatch a 'close' event on it. This will trigger the race above.\n$dismissNotification.subscribe(component => {\n\t// You could also include any additional logic here if needed.\n\tcomponent.dispatchEvent(new CustomEvent('close'))\n})\n","import { TailwindElement } from '@mixins/index'\nimport { $notify } from '@schmancy/notification'\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\t$notify.dismiss(this)\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","$dismissNotification","$notify","success","config","component","next","error","warning","info","dismiss","pipe","buffer","debounceTime","subscribe","notifications","length","notification","body","appendChild","race","fromEvent","timer","duration","remove","dispatchEvent","CustomEvent","SchmancyNotification","TailwindElement","super","arguments","this","html","__decorateClass","property","String","prototype","customElement","SchmancyNotificationOutlet"],"mappings":"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"}
|
|
@@ -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-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
|
|
1
|
+
"use strict";require("rxjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const w=require("./litElement.mixin-DWxwPXWQ.cjs");require("./tailwind.mixin-_mD_GeAp.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-B7tV2ttW.cjs.map
|