@mhmo91/schmancy 0.2.112 → 0.2.113
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-CrZbI_E_.cjs → animated-text-B576YswO.cjs} +2 -2
- package/dist/{animated-text-CrZbI_E_.cjs.map → animated-text-B576YswO.cjs.map} +1 -1
- package/dist/{animated-text-CmvbdVJF.js → animated-text-BuRbVM-X.js} +3 -3
- package/dist/{animated-text-CmvbdVJF.js.map → animated-text-BuRbVM-X.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-D5Fb0wFU.cjs → area.component-BFj0Dvfb.cjs} +2 -2
- package/dist/{area.component-D5Fb0wFU.cjs.map → area.component-BFj0Dvfb.cjs.map} +1 -1
- package/dist/{area.component-Dzl8Iw9I.js → area.component-Bo5aB8BH.js} +3 -3
- package/dist/{area.component-Dzl8Iw9I.js.map → area.component-Bo5aB8BH.js.map} +1 -1
- package/dist/area.js +1 -1
- package/dist/{autocomplete-Bsx63fvs.cjs → autocomplete-Du2Jw0a2.cjs} +2 -2
- package/dist/{autocomplete-Bsx63fvs.cjs.map → autocomplete-Du2Jw0a2.cjs.map} +1 -1
- package/dist/{autocomplete-C7d1TghO.js → autocomplete-NL-c1Qp-.js} +3 -3
- package/dist/{autocomplete-C7d1TghO.js.map → autocomplete-NL-c1Qp-.js.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-Ddc3Nogy.js → checkbox-DQYRlKod.js} +2 -2
- package/dist/{checkbox-Ddc3Nogy.js.map → checkbox-DQYRlKod.js.map} +1 -1
- package/dist/{checkbox-D5Zw8R82.cjs → checkbox-FM06WS9G.cjs} +2 -2
- package/dist/{checkbox-D5Zw8R82.cjs.map → checkbox-FM06WS9G.cjs.map} +1 -1
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{chips-D5ADFFCU.cjs → chips-CJZbtp-O.cjs} +2 -2
- package/dist/{chips-D5ADFFCU.cjs.map → chips-CJZbtp-O.cjs.map} +1 -1
- package/dist/{chips-Bm_VYwr5.js → chips-Ctk7cxHI.js} +3 -3
- package/dist/{chips-Bm_VYwr5.js.map → chips-Ctk7cxHI.js.map} +1 -1
- package/dist/chips.cjs +1 -1
- package/dist/chips.js +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/date-range-CZiZR3OZ.js +447 -0
- package/dist/date-range-CZiZR3OZ.js.map +1 -0
- package/dist/date-range-FxAO_oqk.cjs +79 -0
- package/dist/date-range-FxAO_oqk.cjs.map +1 -0
- package/dist/date-range.cjs +1 -1
- package/dist/date-range.js +1 -1
- package/dist/{delay-DSBPkKzK.cjs → delay-NkgyZVcO.cjs} +2 -2
- package/dist/{delay-DSBPkKzK.cjs.map → delay-NkgyZVcO.cjs.map} +1 -1
- package/dist/{delay-Nnqipc2p.js → delay-gZOjfjX_.js} +2 -2
- package/dist/{delay-Nnqipc2p.js.map → delay-gZOjfjX_.js.map} +1 -1
- package/dist/delay.cjs +1 -1
- package/dist/delay.js +1 -1
- package/dist/{divider-C7JP4sSG.js → divider-B-JF8gre.js} +3 -3
- package/dist/{divider-C7JP4sSG.js.map → divider-B-JF8gre.js.map} +1 -1
- package/dist/{divider-CcTSaeAl.cjs → divider-nNk0E_jZ.cjs} +2 -2
- package/dist/{divider-CcTSaeAl.cjs.map → divider-nNk0E_jZ.cjs.map} +1 -1
- package/dist/divider.cjs +1 -1
- package/dist/divider.js +1 -1
- package/dist/{flex-P9rZBgGQ.js → flex-CieqpOUS.js} +2 -2
- package/dist/{flex-P9rZBgGQ.js.map → flex-CieqpOUS.js.map} +1 -1
- package/dist/{flex-B_mVCq18.cjs → flex-INEcbqBe.cjs} +2 -2
- package/dist/{flex-B_mVCq18.cjs.map → flex-INEcbqBe.cjs.map} +1 -1
- package/dist/{form-cxzC6GVM.cjs → form-CKMp4UzU.cjs} +2 -2
- package/dist/{form-cxzC6GVM.cjs.map → form-CKMp4UzU.cjs.map} +1 -1
- package/dist/{form-DPcVlChy.js → form-lcamXnkd.js} +2 -2
- package/dist/{form-DPcVlChy.js.map → form-lcamXnkd.js.map} +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.js +1 -1
- package/dist/{icon-BEKKW3-2.cjs → icon-BZqH7sp7.cjs} +2 -2
- package/dist/{icon-BEKKW3-2.cjs.map → icon-BZqH7sp7.cjs.map} +1 -1
- package/dist/{icon-BGWDEYcH.js → icon-CJrmUGTm.js} +3 -3
- package/dist/{icon-BGWDEYcH.js.map → icon-CJrmUGTm.js.map} +1 -1
- package/dist/{icon-button-DlC2-vLK.js → icon-button-BNn0qRfC.js} +3 -3
- package/dist/{icon-button-DlC2-vLK.js.map → icon-button-BNn0qRfC.js.map} +1 -1
- package/dist/{icon-button-ChOGnclR.cjs → icon-button-nMHz4MDw.cjs} +2 -2
- package/dist/{icon-button-ChOGnclR.cjs.map → icon-button-nMHz4MDw.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 +33 -33
- package/dist/{input-C7C9t_rb.cjs → input-CszLZ81k.cjs} +2 -2
- package/dist/{input-C7C9t_rb.cjs.map → input-CszLZ81k.cjs.map} +1 -1
- package/dist/{input-CIRYUKIL.js → input-CwWLOBMF.js} +2 -2
- package/dist/{input-CIRYUKIL.js.map → input-CwWLOBMF.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-Bzx4a2RJ.js → list-CjrF4M5H.js} +2 -2
- package/dist/{list-Bzx4a2RJ.js.map → list-CjrF4M5H.js.map} +1 -1
- package/dist/{list-D1kS-XDO.cjs → list-D4y-Mkap.cjs} +2 -2
- package/dist/{list-D1kS-XDO.cjs.map → list-D4y-Mkap.cjs.map} +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/{litElement.mixin-Dx9_p_nV.js → litElement.mixin-NzkxESus.js} +2 -2
- package/dist/{litElement.mixin-Dx9_p_nV.js.map → litElement.mixin-NzkxESus.js.map} +1 -1
- package/dist/{litElement.mixin-PVEJyATw.cjs → litElement.mixin-djlKJ0lX.cjs} +2 -2
- package/dist/{litElement.mixin-PVEJyATw.cjs.map → litElement.mixin-djlKJ0lX.cjs.map} +1 -1
- package/dist/{menu-CzcGpZXF.js → menu-Cb5kUAvU.js} +3 -3
- package/dist/{menu-CzcGpZXF.js.map → menu-Cb5kUAvU.js.map} +1 -1
- package/dist/{menu-D30w9YPg.cjs → menu-DAtFS31a.cjs} +2 -2
- package/dist/{menu-D30w9YPg.cjs.map → menu-DAtFS31a.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-x_W6-_iT.cjs → option-0le6-QeS.cjs} +2 -2
- package/dist/{option-x_W6-_iT.cjs.map → option-0le6-QeS.cjs.map} +1 -1
- package/dist/{option-igpxXgTd.js → option-_1gW48HB.js} +2 -2
- package/dist/{option-igpxXgTd.js.map → option-_1gW48HB.js.map} +1 -1
- package/dist/option.cjs +1 -1
- package/dist/option.js +1 -1
- package/dist/{outlet-DzAi4iKo.js → outlet-6HZp4fo1.js} +3 -3
- package/dist/outlet-6HZp4fo1.js.map +1 -0
- package/dist/{outlet-DqRiezsh.cjs → outlet-DofHDlGH.cjs} +3 -3
- package/dist/outlet-DofHDlGH.cjs.map +1 -0
- package/dist/{payment-card-form-IamvKqiN.cjs → payment-card-form-Bi3yNg4b.cjs} +2 -2
- package/dist/{payment-card-form-IamvKqiN.cjs.map → payment-card-form-Bi3yNg4b.cjs.map} +1 -1
- package/dist/{payment-card-form-CwqKB8Tm.js → payment-card-form-C8FxRlh4.js} +3 -3
- package/dist/{payment-card-form-CwqKB8Tm.js.map → payment-card-form-C8FxRlh4.js.map} +1 -1
- package/dist/{radio-group-zGJIFNCR.cjs → radio-group-A5QxSGOr.cjs} +2 -2
- package/dist/{radio-group-zGJIFNCR.cjs.map → radio-group-A5QxSGOr.cjs.map} +1 -1
- package/dist/{radio-group-C9UaGgCL.js → radio-group-BapuNl8y.js} +2 -2
- package/dist/{radio-group-C9UaGgCL.js.map → radio-group-BapuNl8y.js.map} +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/{select-5ob4WHTf.js → select-8AjN6LbM.js} +3 -3
- package/dist/{select-5ob4WHTf.js.map → select-8AjN6LbM.js.map} +1 -1
- package/dist/{select-B194j_5a.cjs → select-BdU6KcPX.cjs} +2 -2
- package/dist/{select-B194j_5a.cjs.map → select-BdU6KcPX.cjs.map} +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.js +1 -1
- package/dist/{sheet-CHFHgh29.cjs → sheet-CQFdHSwJ.cjs} +6 -6
- package/dist/sheet-CQFdHSwJ.cjs.map +1 -0
- package/dist/{sheet-C2RxblaX.js → sheet-xR13xD2A.js} +11 -11
- package/dist/sheet-xR13xD2A.js.map +1 -0
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +1 -1
- package/dist/{slider-BgNoOOeQ.cjs → slider-B4OCBlQg.cjs} +2 -2
- package/dist/{slider-BgNoOOeQ.cjs.map → slider-B4OCBlQg.cjs.map} +1 -1
- package/dist/{slider-BOTY8Lhv.js → slider-BakU-Bdw.js} +3 -3
- package/dist/{slider-BOTY8Lhv.js.map → slider-BakU-Bdw.js.map} +1 -1
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +1 -1
- package/dist/{spinner-Vwv-mKip.js → spinner-BDx3SZsl.js} +4 -4
- package/dist/spinner-BDx3SZsl.js.map +1 -0
- package/dist/{spinner-vBTOD2N0.cjs → spinner-C3VJtLgk.cjs} +3 -3
- package/dist/spinner-C3VJtLgk.cjs.map +1 -0
- package/dist/{surface-CryISDFd.js → surface-YiaJJQ5m.js} +2 -2
- package/dist/{surface-CryISDFd.js.map → surface-YiaJJQ5m.js.map} +1 -1
- package/dist/{surface-Csc8YLks.cjs → surface-kjOrb8TO.cjs} +2 -2
- package/dist/{surface-Csc8YLks.cjs.map → surface-kjOrb8TO.cjs.map} +1 -1
- package/dist/surface.cjs +1 -1
- package/dist/surface.js +1 -1
- package/dist/{table-DHHo5etf.cjs → table-BZV2dBD5.cjs} +2 -2
- package/dist/{table-DHHo5etf.cjs.map → table-BZV2dBD5.cjs.map} +1 -1
- package/dist/{table-DRL3oAjo.js → table-BguYeeBH.js} +2 -2
- package/dist/{table-DRL3oAjo.js.map → table-BguYeeBH.js.map} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.js +1 -1
- package/dist/{tabs-group-BRVzKIRX.cjs → tabs-group-BZFBZ1_G.cjs} +2 -2
- package/dist/{tabs-group-BRVzKIRX.cjs.map → tabs-group-BZFBZ1_G.cjs.map} +1 -1
- package/dist/{tabs-group-BcXgpxUw.js → tabs-group-H3C6ZnQn.js} +2 -2
- package/dist/{tabs-group-BcXgpxUw.js.map → tabs-group-H3C6ZnQn.js.map} +1 -1
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/{tailwind.mixin-BM-bjRjT.cjs → tailwind.mixin-CBhPue3q.cjs} +2 -2
- package/dist/{tailwind.mixin-BM-bjRjT.cjs.map → tailwind.mixin-CBhPue3q.cjs.map} +1 -1
- package/dist/{tailwind.mixin-YEy_iITN.js → tailwind.mixin-DklgfhB4.js} +2 -2
- package/dist/{tailwind.mixin-YEy_iITN.js.map → tailwind.mixin-DklgfhB4.js.map} +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/{teleport.component-BVj_m_Kl.cjs → teleport.component-CF-USarR.cjs} +2 -2
- package/dist/{teleport.component-BVj_m_Kl.cjs.map → teleport.component-CF-USarR.cjs.map} +1 -1
- package/dist/{teleport.component-K6cmr5Tr.js → teleport.component-D8DXijGl.js} +35 -35
- package/dist/{teleport.component-K6cmr5Tr.js.map → teleport.component-D8DXijGl.js.map} +1 -1
- package/dist/teleport.js +1 -1
- package/dist/{textarea-CUi2u7J7.cjs → textarea-BCWPb0Sn.cjs} +2 -2
- package/dist/{textarea-CUi2u7J7.cjs.map → textarea-BCWPb0Sn.cjs.map} +1 -1
- package/dist/{textarea-BzI6HMKy.js → textarea-D7bTMerW.js} +2 -2
- package/dist/{textarea-BzI6HMKy.js.map → textarea-D7bTMerW.js.map} +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{theme-button-DhD5GksO.js → theme-button-CP2_aq__.js} +2 -2
- package/dist/{theme-button-DhD5GksO.js.map → theme-button-CP2_aq__.js.map} +1 -1
- package/dist/{theme-button-BJe1x0Cs.cjs → theme-button-DHuXg7vh.cjs} +2 -2
- package/dist/{theme-button-BJe1x0Cs.cjs.map → theme-button-DHuXg7vh.cjs.map} +1 -1
- package/dist/theme-button.cjs +1 -1
- package/dist/theme-button.js +1 -1
- package/dist/theme.cjs +1 -1
- package/dist/{theme.component-D4WBav-_.js → theme.component-BtBosXb1.js} +2 -2
- package/dist/{theme.component-D4WBav-_.js.map → theme.component-BtBosXb1.js.map} +1 -1
- package/dist/{theme.component-BI2OGjYG.cjs → theme.component-Ly2C_fQ8.cjs} +2 -2
- package/dist/{theme.component-BI2OGjYG.cjs.map → theme.component-Ly2C_fQ8.cjs.map} +1 -1
- package/dist/theme.js +1 -1
- package/dist/{tree-8ORo7bDg.cjs → tree-CG9B3uQP.cjs} +2 -2
- package/dist/{tree-8ORo7bDg.cjs.map → tree-CG9B3uQP.cjs.map} +1 -1
- package/dist/{tree-D42tswgB.js → tree-Y2B7yK7L.js} +2 -2
- package/dist/{tree-D42tswgB.js.map → tree-Y2B7yK7L.js.map} +1 -1
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/{typewriter-JuHIja1a.cjs → typewriter-CzV1O28F.cjs} +2 -2
- package/dist/{typewriter-JuHIja1a.cjs.map → typewriter-CzV1O28F.cjs.map} +1 -1
- package/dist/{typewriter-BwNXbsZp.js → typewriter-bnkFoDFz.js} +4 -4
- package/dist/{typewriter-BwNXbsZp.js.map → typewriter-bnkFoDFz.js.map} +1 -1
- package/dist/typewriter.cjs +1 -1
- package/dist/typewriter.js +1 -1
- package/dist/{typography-CaOb3D3z.js → typography-CSQByhJF.js} +2 -2
- package/dist/{typography-CaOb3D3z.js.map → typography-CSQByhJF.js.map} +1 -1
- package/dist/{typography-BMkQ3cH-.cjs → typography-D-a-z23R.cjs} +2 -2
- package/dist/{typography-BMkQ3cH-.cjs.map → typography-D-a-z23R.cjs.map} +1 -1
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +1 -1
- package/package.json +2 -2
- package/types/src/date-range/date-range.d.ts +2 -2
- package/dist/date-range-CH-IKoMW.cjs +0 -72
- package/dist/date-range-CH-IKoMW.cjs.map +0 -1
- package/dist/date-range-LMnnBclq.js +0 -166
- package/dist/date-range-LMnnBclq.js.map +0 -1
- package/dist/outlet-DqRiezsh.cjs.map +0 -1
- package/dist/outlet-DzAi4iKo.js.map +0 -1
- package/dist/sheet-C2RxblaX.js.map +0 -1
- package/dist/sheet-CHFHgh29.cjs.map +0 -1
- package/dist/spinner-Vwv-mKip.js.map +0 -1
- package/dist/spinner-vBTOD2N0.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-
|
|
1
|
+
{"version":3,"file":"menu-DAtFS31a.cjs","sources":["../src/menu/menu-item.ts","../src/menu/menu.ts"],"sourcesContent":["import { $LitElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement } from 'lit/decorators.js'\nimport { fromEvent, takeUntil } from 'rxjs'\n\n@customElement('schmancy-menu-item')\nexport default class SchmancyMenuItem extends $LitElement(css`\n\t:host {\n\t\tdisplay: block;\n\t}\n`) {\n\tconnectedCallback(): void {\n\t\tsuper.connectedCallback()\n\t\tfromEvent(this, 'click')\n\t\t\t.pipe(takeUntil(this.disconnecting))\n\t\t\t.subscribe(e => {\n\t\t\t\te.stopPropagation()\n\t\t\t\tthis.dispatchEvent(\n\t\t\t\t\tnew CustomEvent('schmancy-menu-item-click', {\n\t\t\t\t\t\tbubbles: true,\n\t\t\t\t\t\tcomposed: true,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t})\n\t}\n\tprotected render(): unknown {\n\t\treturn html`\n\t\t\t<schmancy-list-item>\n\t\t\t\t<slot></slot>\n\t\t\t</schmancy-list-item>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-menu-item': SchmancyMenuItem\n\t}\n}\n","import { autoUpdate, computePosition, flip, offset, shift, size } from '@floating-ui/dom'\nimport { TailwindElement } from '@mixins/index'\nimport { css, html } from 'lit'\nimport { customElement, query, queryAssignedElements } from 'lit/decorators.js'\nimport { filter, fromEvent, takeUntil, tap } from 'rxjs'\n\n@customElement('schmancy-menu')\nexport default class SchmancyMenu extends TailwindElement(css`\n\t:host {\n\t\tposition: relative;\n\t\tdisplay: inline-block;\n\t}\n\n\t#menu {\n\t\tdisplay: none;\n\t}\n\n\t#menu[data-show='true'] {\n\t\tdisplay: block;\n\t}\n`) {\n\t@queryAssignedElements({ flatten: true, slot: 'button' })\n\tbuttonElement!: Array<HTMLElement>\n\n\t@query('#menu') menuElement!: HTMLElement\n\n\tprivate cleanup?: any\n\n\tprivate getMiddleware() {\n\t\treturn [\n\t\t\toffset(5),\n\t\t\tflip(),\n\t\t\tshift({ padding: 5 }),\n\t\t\tsize({\n\t\t\t\tapply({ availableHeight, elements }) {\n\t\t\t\t\telements.floating.style.maxHeight = `${availableHeight}px`\n\t\t\t\t},\n\t\t\t}),\n\t\t]\n\t}\n\n\tasync updatePosition() {\n\t\tif (!this.buttonElement[0] || !this.menuElement) {\n\t\t\treturn\n\t\t}\n\n\t\tawait computePosition(this.buttonElement[0], this.menuElement, {\n\t\t\tplacement: 'bottom-start',\n\t\t\tmiddleware: this.getMiddleware(),\n\t\t}).then(({ x, y }) => {\n\t\t\tObject.assign(this.menuElement.style, {\n\t\t\t\tleft: `${x}px`,\n\t\t\t\ttop: `${y}px`,\n\t\t\t})\n\t\t})\n\t}\n\n\tprivate showMenu() {\n\t\tif (!this.buttonElement[0] || !this.menuElement) return\n\n\t\tthis.menuElement.dataset.show = 'true'\n\n\t\tthis.cleanup = autoUpdate(this.buttonElement[0], this.menuElement, () => {\n\t\t\tcomputePosition(this.buttonElement[0], this.menuElement, {\n\t\t\t\tplacement: 'bottom-start',\n\t\t\t\tmiddleware: this.getMiddleware(),\n\t\t\t}).then(({ x, y, strategy }) => {\n\t\t\t\tObject.assign(this.menuElement.style, {\n\t\t\t\t\tleft: `${x}px`,\n\t\t\t\t\ttop: `${y}px`,\n\t\t\t\t\tposition: strategy,\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\n\t\tconst animation = this.menuElement.animate(\n\t\t\t[\n\t\t\t\t{ opacity: 0, transform: 'scale(0.95)' },\n\t\t\t\t{ opacity: 1, transform: 'scale(1)' },\n\t\t\t],\n\t\t\t{\n\t\t\t\tduration: 100,\n\t\t\t\teasing: 'cubic-bezier(0.55, 0.085, 0.68, 0.53)',\n\t\t\t},\n\t\t)\n\n\t\tanimation.onfinish = () => {}\n\t}\n\n\tprivate async hideMenu() {\n\t\t// Make hideMenu async\n\t\tif (this.cleanup) {\n\t\t\tawait this.cleanup() // Await the cleanup!\n\t\t\tthis.cleanup = undefined\n\t\t}\n\t\tthis.menuElement.dataset.show = 'false'\n\n\t\tconst animation = this.menuElement.animate(\n\t\t\t[\n\t\t\t\t{ opacity: 1, transform: 'scale(1)' },\n\t\t\t\t{ opacity: 0, transform: 'scale(0.95)' },\n\t\t\t],\n\t\t\t{\n\t\t\t\tduration: 75,\n\t\t\t\teasing: 'cubic-bezier(0.55, 0.085, 0.68, 0.53)',\n\t\t\t},\n\t\t)\n\t\tanimation.onfinish = () => {} // No need for a promise now\n\t}\n\n\tfirstUpdated(): void {\n\t\tfromEvent(this.buttonElement, 'click')\n\t\t\t.pipe(\n\t\t\t\ttap(e => e.stopPropagation()),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(() => {\n\t\t\t\tthis.showMenu()\n\t\t\t})\n\n\t\tfromEvent(this, 'schmancy-menu-item-click')\n\t\t\t.pipe(\n\t\t\t\ttap(e => e.stopPropagation()),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t)\n\t\t\t.subscribe(() => {\n\t\t\t\tthis.hideMenu()\n\t\t\t})\n\n\t\tfromEvent(document, 'click')\n\t\t\t.pipe(\n\t\t\t\tfilter((e: Event) => !this.contains(e.target as Node)),\n\t\t\t\ttakeUntil(this.disconnecting),\n\t\t\t\ttap(() => {\n\t\t\t\t\tif (this.menuElement.dataset.show === 'true') {\n\t\t\t\t\t\tthis.hideMenu()\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t)\n\t\t\t.subscribe()\n\t}\n\n\trender() {\n\t\treturn html`\n\t\t\t<slot name=\"button\">\n\t\t\t\t<schmancy-icon-button> more_vert </schmancy-icon-button>\n\t\t\t</slot>\n\t\t\t<ul\n\t\t\t\tid=\"menu\"\n\t\t\t\tclass=\"absolute z-50 border-outlineVariant rounded-md min-w-[160px] max-w-[320px] w-max bg-surface-default max-h-[90vh] shadow-1 overflow-y-auto\"\n\t\t\t\trole=\"menu\"\n\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\taria-labelledby=\"options-menu-4-button\"\n\t\t\t>\n\t\t\t\t<slot></slot>\n\t\t\t</ul>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-menu': SchmancyMenu\n\t}\n}\n"],"names":["SchmancyMenuItem","$LitElement","css","super","connectedCallback","fromEvent","this","pipe","takeUntil","disconnecting","subscribe","e","stopPropagation","dispatchEvent","CustomEvent","bubbles","composed","html","customElement","SchmancyMenu","TailwindElement","offset","flip","shift","padding","size","apply","availableHeight","elements","floating","style","maxHeight","updatePosition","buttonElement","menuElement","computePosition","placement","middleware","getMiddleware","then","x","y","Object","assign","left","top","dataset","show","cleanup","autoUpdate","strategy","position","animate","opacity","transform","duration","easing","onfinish","tap","showMenu","hideMenu","document","filter","contains","target","__decorateClass","queryAssignedElements","flatten","slot","prototype","query"],"mappings":"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"}
|
package/dist/menu.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("./menu-
|
|
1
|
+
"use strict";require("./menu-DAtFS31a.cjs");
|
|
2
2
|
//# sourceMappingURL=menu.cjs.map
|
package/dist/menu.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./menu-
|
|
1
|
+
import "./menu-Cb5kUAvU.js";
|
|
2
2
|
//# sourceMappingURL=menu.js.map
|
package/dist/nav-drawer.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./teleport.component-CF-USarR.cjs");exports.$drawer=e.$drawer,Object.defineProperty(exports,"SchmancyDrawerAppbar",{enumerable:!0,get:()=>e.SchmancyDrawerAppbar}),exports.SchmancyDrawerNavbarMode=e.SchmancyDrawerNavbarMode,exports.SchmancyDrawerNavbarState=e.SchmancyDrawerNavbarState,Object.defineProperty(exports,"SchmancyNavigationDrawer",{enumerable:!0,get:()=>e.SchmancyNavigationDrawer}),Object.defineProperty(exports,"SchmancyNavigationDrawerContent",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerContent}),Object.defineProperty(exports,"SchmancyNavigationDrawerSidebar",{enumerable:!0,get:()=>e.SchmancyNavigationDrawerSidebar}),exports.schmancyNavDrawer=e.schmancyNavDrawer;
|
|
2
2
|
//# sourceMappingURL=nav-drawer.cjs.map
|
package/dist/nav-drawer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as c, i as e, k as n, l as m, m as s, j as h, n as i, h as t } from "./teleport.component-
|
|
1
|
+
import { $ as c, i as e, k as n, l as m, m as s, j as h, n as i, h as t } from "./teleport.component-D8DXijGl.js";
|
|
2
2
|
export {
|
|
3
3
|
c as $drawer,
|
|
4
4
|
e as SchmancyDrawerAppbar,
|
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-DofHDlGH.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,4 +1,4 @@
|
|
|
1
|
-
"use strict";require("rxjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const p=require("./tailwind.mixin-
|
|
1
|
+
"use strict";require("rxjs"),require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const p=require("./tailwind.mixin-CBhPue3q.cjs"),u=require("lit"),r=require("lit/decorators.js");var d=Object.defineProperty,y=Object.getOwnPropertyDescriptor,l=(t,e,n,i)=>{for(var a,o=i>1?void 0:i?y(e,n):e,c=t.length-1;c>=0;c--)(a=t[c])&&(o=(i?a(e,n,o):a(o))||o);return i&&o&&d(e,n,o),o};let s=class extends p.TailwindElement(){constructor(){super(...arguments),this.value="",this.selected=!1}handleOptionClick(){var t;this.dispatchEvent(new CustomEvent("click",{detail:{value:this.value,label:this.label??((t=this.textContent)==null?void 0:t.trim())??""},bubbles:!0,composed:!0}))}focus(){var t,e;(e=(t=this.shadowRoot)==null?void 0:t.querySelector("li"))==null||e.focus()}render(){const t={"outline-secondary-default focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 rounded-md focus-visible:outline-secondary-default":!0,"font-semibold relative cursor-pointer py-2 px-3":!0,"bg-secondary-container text-secondery-onContainer":this.selected};return u.html`
|
|
2
2
|
<li
|
|
3
3
|
tabindex="0"
|
|
4
4
|
class="${this.classMap(t)}"
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
</sch-flex>
|
|
16
16
|
</li>
|
|
17
17
|
`}};l([r.property({type:String,reflect:!0})],s.prototype,"value",2),l([r.property({type:String,reflect:!0})],s.prototype,"label",2),l([r.property({type:Boolean})],s.prototype,"selected",2),s=l([r.customElement("schmancy-option")],s);
|
|
18
|
-
//# sourceMappingURL=option-
|
|
18
|
+
//# sourceMappingURL=option-0le6-QeS.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-
|
|
1
|
+
{"version":3,"file":"option-0le6-QeS.cjs","sources":["../src/option/option.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nexport type SchmancyOptionChangeEvent = CustomEvent<{\n\tvalue: string\n\tlabel: string\n}>\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\tprivate handleOptionClick() {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent<SchmancyOptionChangeEvent['detail']>('click', {\n\t\t\t\tdetail: {\n\t\t\t\t\tvalue: this.value,\n\t\t\t\t\tlabel: this.label ?? this.textContent?.trim() ?? '',\n\t\t\t\t},\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\t// override focus method to focus the native element\n\tfocus() {\n\t\tthis.shadowRoot?.querySelector('li')?.focus()\n\t}\n\n\tprotected render() {\n\t\t// Apply highlight styles if `this.selected` is true\n\t\tconst classes = {\n\t\t\t'outline-secondary-default focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 rounded-md focus-visible:outline-secondary-default':\n\t\t\t\ttrue,\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`\n\t\t\t<li\n\t\t\t\ttabindex=\"0\"\n\t\t\t\tclass=\"${this.classMap(classes)}\"\n\t\t\t\trole=\"option\"\n\t\t\t\t@click=${(e: MouseEvent) => {\n\t\t\t\t\te.stopPropagation()\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\tthis.handleOptionClick()\n\t\t\t\t}}\n\t\t\t\t@keydown=${(e: KeyboardEvent) => {\n\t\t\t\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\tthis.handleOptionClick()\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div class=\"${this.classMap(stateLayerClasses)}\"></div>\n\t\t\t\t<sch-flex class=\"text-start\" align=\"center\" justify=\"between\" flow=\"row\">\n\t\t\t\t\t<slot class=\"self-start\"></slot>\n\t\t\t\t\t<slot name=\"support\">\n\t\t\t\t\t\t<span></span>\n\t\t\t\t\t</slot>\n\t\t\t\t</sch-flex>\n\t\t\t</li>\n\t\t`\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'schmancy-option': SchmancyOption\n\t}\n}\n"],"names":["SchmancyOption","TailwindElement","constructor","super","arguments","this","value","selected","handleOptionClick","dispatchEvent","CustomEvent","detail","label","textContent","trim","bubbles","composed","focus","shadowRoot","querySelector","classes","html","classMap","e","stopPropagation","preventDefault","key","__decorateClass","property","type","String","reflect","prototype","Boolean","customElement"],"mappings":"4YAUA,IAAqBA,EAArB,cAA4CC,EAAAA,gBAAAA,CAAAA,CAA5C,aAAAC,CAAAC,MAAAC,GAAAA,SAAAA,EAC4DC,KAAAC,MAAA,GAEVD,KAAAE,SAAAA,EAAA,CAEzC,mBAAAC,OACFH,KAAAI,cACJ,IAAIC,YAAiD,QAAS,CAC7DC,OAAQ,CACPL,MAAOD,KAAKC,MACZM,MAAOP,KAAKO,SAASP,EAAAA,KAAKQ,cAALR,YAAAA,EAAkBS,SAAU,EAElDC,EAAAA,QAAAA,GACAC,SAAAA,EAEF,CAAA,CAAA,CAAA,CAID,OAAAC,UACCZ,GAAAA,EAAAA,KAAKa,aAALb,YAAAA,EAAiBc,cAAc,QAA/Bd,MAAAA,EAAsCY,OAAM,CAGnC,QAET,CAAA,MAAMG,EAAU,CACf,mKACC,GACD,kDAAmD,GACnD,oDAAqDf,KAAKE,QAOpD,EAAA,OAAAc,EAAAA;AAAAA;AAAAA;AAAAA,aAGIhB,KAAKiB,SAASF,CAAAA,CAAAA;AAAAA;AAAAA,aAEbG,GAAAA,CACTA,EAAEC,gBAAAA,EACFD,EAAEE,eAAAA,EACFpB,KAAKG,kBAAkB,CAAA,CAAA;AAAA,eAEZe,GACG,CAAVA,EAAEG,MAAQ,SAAWH,EAAEG,MAAQ,MAClCH,EAAEC,gBACFD,EAAAA,EAAEE,eACFpB,EAAAA,KAAKG,kBAAkB,EAAA,CAAA;AAAA;AAAA,kBAIXH,KAAKiB,SAvBK,CACzB,kCAAmC,GACnC,qEAAsE,EAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAqBvB,CAAA,EArDNK,EAAA,CAA1CC,EAAAA,SAAS,CAAEC,KAAMC,OAAQC,QAAS,EAAA,CAAA,CAAA,EADf/B,EACuBgC,UAAA,QAAA,GACAL,EAAA,CAA1CC,EAAAA,SAAS,CAAEC,KAAMC,OAAQC,QAAAA,EAFN/B,CAAAA,CAAAA,EAAAA,EAEuBgC,UAAA,QAAA,CAAA,EACdL,EAAA,CAA5BC,WAAS,CAAEC,KAAMI,WAHEjC,EAGSgC,UAAA,WAAA,CAHThC,EAAAA,EAArB2B,EAAA,CADCO,EAAAA,cAAc,iBACMlC,CAAAA,EAAAA,CAAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "rxjs";
|
|
2
2
|
import "lit/directives/class-map.js";
|
|
3
3
|
import "lit/directives/style-map.js";
|
|
4
|
-
import { T as p } from "./tailwind.mixin-
|
|
4
|
+
import { T as p } from "./tailwind.mixin-DklgfhB4.js";
|
|
5
5
|
import { html as u } from "lit";
|
|
6
6
|
import { property as c, customElement as d } from "lit/decorators.js";
|
|
7
7
|
var f = Object.defineProperty, h = Object.getOwnPropertyDescriptor, l = (e, t, r, i) => {
|
|
@@ -46,4 +46,4 @@ let s = class extends p() {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
l([c({ type: String, reflect: !0 })], s.prototype, "value", 2), l([c({ type: String, reflect: !0 })], s.prototype, "label", 2), l([c({ type: Boolean })], s.prototype, "selected", 2), s = l([d("schmancy-option")], s);
|
|
49
|
-
//# sourceMappingURL=option-
|
|
49
|
+
//# sourceMappingURL=option-_1gW48HB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-
|
|
1
|
+
{"version":3,"file":"option-_1gW48HB.js","sources":["../src/option/option.ts"],"sourcesContent":["import { TailwindElement } from '@mixins/index'\nimport { html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nexport type SchmancyOptionChangeEvent = CustomEvent<{\n\tvalue: string\n\tlabel: string\n}>\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\tprivate handleOptionClick() {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent<SchmancyOptionChangeEvent['detail']>('click', {\n\t\t\t\tdetail: {\n\t\t\t\t\tvalue: this.value,\n\t\t\t\t\tlabel: this.label ?? this.textContent?.trim() ?? '',\n\t\t\t\t},\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t}),\n\t\t)\n\t}\n\n\t// override focus method to focus the native element\n\tfocus() {\n\t\tthis.shadowRoot?.querySelector('li')?.focus()\n\t}\n\n\tprotected render() {\n\t\t// Apply highlight styles if `this.selected` is true\n\t\tconst classes = {\n\t\t\t'outline-secondary-default focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 rounded-md focus-visible:outline-secondary-default':\n\t\t\t\ttrue,\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`\n\t\t\t<li\n\t\t\t\ttabindex=\"0\"\n\t\t\t\tclass=\"${this.classMap(classes)}\"\n\t\t\t\trole=\"option\"\n\t\t\t\t@click=${(e: MouseEvent) => {\n\t\t\t\t\te.stopPropagation()\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\tthis.handleOptionClick()\n\t\t\t\t}}\n\t\t\t\t@keydown=${(e: KeyboardEvent) => {\n\t\t\t\t\tif (e.key === 'Enter' || e.key === ' ') {\n\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\te.preventDefault()\n\t\t\t\t\t\tthis.handleOptionClick()\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div class=\"${this.classMap(stateLayerClasses)}\"></div>\n\t\t\t\t<sch-flex class=\"text-start\" align=\"center\" justify=\"between\" flow=\"row\">\n\t\t\t\t\t<slot class=\"self-start\"></slot>\n\t\t\t\t\t<slot name=\"support\">\n\t\t\t\t\t\t<span></span>\n\t\t\t\t\t</slot>\n\t\t\t\t</sch-flex>\n\t\t\t</li>\n\t\t`\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","handleOptionClick","dispatchEvent","CustomEvent","detail","label","textContent","trim","bubbles","composed","shadowRoot","querySelector","focus","classes","html","classMap","e","stopPropagation","preventDefault","key","__decorateClass","property","type","String","reflect","prototype","Boolean","customElement"],"mappings":";;;;;;;;;;AAUA,IAAqBA,IAArB,cAA4CC,EAA5C,EAAA;AAAA,EAAA,cAAAC;AAAAA,UAAAA,GAAAC,SAC4DC,GAAAA,KAAAC,QAAA,IAEVD,KAAAE,WAAAA;AAAAA,EAAA;AAAA,EAEzC,oBAAAC;;AACFH,SAAAI,cACJ,IAAIC,YAAiD,SAAS,EAC7DC,QAAQ,EACPL,OAAOD,KAAKC,OACZM,OAAOP,KAAKO,WAASP,IAAAA,KAAKQ,gBAALR,gBAAAA,EAAkBS,WAAU,GAAA,GAElDC,SAAS,IACTC,UAAU,GAAA,CAAA,CAAA;AAAA,EAEZ;AAAA,EAID,QACCX;;AAAAA,KAAAA,KAAAA,IAAAA,KAAKY,eAALZ,gBAAAA,EAAiBa,cAAc,UAA/Bb,QAAAA,EAAsCc;AAAAA,EAAM;AAAA,EAGnC,SAET;AAAA,UAAMC,IAAU,EACf,oKACC,IACD,mDAAmD,IACnD,qDAAqDf,KAAKE,SAOpD;AAAA,WAAAc;AAAAA;AAAAA;AAAAA,aAGIhB,KAAKiB,SAASF,CAAAA,CAAAA;AAAAA;AAAAA,aAEbG,OAAAA;AACTA,QAAEC,gBAAAA,GACFD,EAAEE,eAAAA,GACFpB,KAAKG,kBAAkB;AAAA,IAAA,CAAA;AAAA,eAEZe,OACG;AAAA,MAAVA,EAAEG,QAAQ,WAAWH,EAAEG,QAAQ,QAClCH,EAAEC,gBACFD,GAAAA,EAAEE,eACFpB,GAAAA,KAAKG,kBAAkB;AAAA,IAAA,CAAA;AAAA;AAAA,kBAIXH,KAAKiB,SAvBK,EACzB,mCAAmC,IACnC,sEAAsE,GAAA,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBvB;AAAA;AArDNK,EAAA,CAA1CC,EAAS,EAAEC,MAAMC,QAAQC,SAAS,GAAA,CAAA,CAAA,GADf9B,EACuB+B,WAAA,SAAA,CACAL,GAAAA,EAAA,CAA1CC,EAAS,EAAEC,MAAMC,QAAQC,SAAAA,GAFN9B,CAAAA,CAAAA,GAAAA,EAEuB+B,WAAA,SAAA,CAAA,GACdL,EAAA,CAA5BC,EAAS,EAAEC,MAAMI,QAHEhC,CAAAA,CAAAA,GAAAA,EAGS+B,WAAA,YAAA,CAAA,GAHT/B,IAArB0B,EAAA,CADCO,EAAc,iBACMjC,CAAAA,GAAAA,CAAAA;"}
|
package/dist/option.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("./option-
|
|
1
|
+
"use strict";require("./option-0le6-QeS.cjs");
|
|
2
2
|
//# sourceMappingURL=option.cjs.map
|
package/dist/option.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./option-
|
|
1
|
+
import "./option-_1gW48HB.js";
|
|
2
2
|
//# sourceMappingURL=option.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Subject as m, buffer as g, debounceTime as x, race as w, fromEvent as y, timer as b } from "rxjs";
|
|
2
2
|
import "lit/directives/class-map.js";
|
|
3
3
|
import "lit/directives/style-map.js";
|
|
4
|
-
import { T as v } from "./tailwind.mixin-
|
|
4
|
+
import { T as v } from "./tailwind.mixin-DklgfhB4.js";
|
|
5
5
|
import { html as l } from "lit";
|
|
6
6
|
import { property as k, customElement as f } from "lit/decorators.js";
|
|
7
7
|
function a(e, t) {
|
|
@@ -48,7 +48,7 @@ let d = class extends v() {
|
|
|
48
48
|
return l`
|
|
49
49
|
<div
|
|
50
50
|
aria-live="assertive"
|
|
51
|
-
class="pointer-events-none z-
|
|
51
|
+
class="pointer-events-none z-[999999] fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6"
|
|
52
52
|
>
|
|
53
53
|
<div class="flex w-full flex-col items-center space-y-4 sm:items-end">
|
|
54
54
|
<div
|
|
@@ -125,4 +125,4 @@ export {
|
|
|
125
125
|
d as S,
|
|
126
126
|
u as a
|
|
127
127
|
};
|
|
128
|
-
//# sourceMappingURL=outlet-
|
|
128
|
+
//# sourceMappingURL=outlet-6HZp4fo1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlet-6HZp4fo1.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-[999999] 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,7 +1,7 @@
|
|
|
1
|
-
"use strict";const r=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const p=require("./tailwind.mixin-
|
|
1
|
+
"use strict";const r=require("rxjs");require("lit/directives/class-map.js"),require("lit/directives/style-map.js");const p=require("./tailwind.mixin-CBhPue3q.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 r.Subject,f=new r.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(r.buffer(s.pipe(r.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),r.race(r.fromEvent(e,"close"),r.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 a,i=o>1?void 0:o?y(t,n):t,c=e.length-1;c>=0;c--)(a=e[c])&&(i=(o?a(t,n,i):a(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
|
-
class="pointer-events-none z-
|
|
4
|
+
class="pointer-events-none z-[999999] fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6"
|
|
5
5
|
>
|
|
6
6
|
<div class="flex w-full flex-col items-center space-y-4 sm:items-end">
|
|
7
7
|
<div
|
|
@@ -58,4 +58,4 @@
|
|
|
58
58
|
</div>
|
|
59
59
|
</div>
|
|
60
60
|
`}},m([d.property({type:String})],exports.SchmancyNotification.prototype,"type",2),exports.SchmancyNotification=m([d.customElement("schmancy-notification")],exports.SchmancyNotification);var g=Object.getOwnPropertyDescriptor;exports.SchmancyNotificationOutlet=class extends p.TailwindElement(){render(){return u.html` <slot></slot> `}},exports.SchmancyNotificationOutlet=((e,t,n,o)=>{for(var a,i=o>1?void 0:o?g(t,n):t,c=e.length-1;c>=0;c--)(a=e[c])&&(i=a(i)||i);return i})([d.customElement("schmancy-notification-outlet")],exports.SchmancyNotificationOutlet),exports.$notify=v;
|
|
61
|
-
//# sourceMappingURL=outlet-
|
|
61
|
+
//# sourceMappingURL=outlet-DofHDlGH.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlet-DofHDlGH.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-[999999] 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-PVEJyATw.cjs");require("./tailwind.mixin-BM-bjRjT.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-djlKJ0lX.cjs");require("./tailwind.mixin-CBhPue3q.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-Bi3yNg4b.cjs.map
|