@justifi/webcomponents 4.2.2 → 4.4.0
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/LICENSE +21 -0
- package/dist/cjs/{Api-11362403.js → Api-7303478d.js} +3 -2
- package/dist/cjs/Api-7303478d.js.map +1 -0
- package/dist/cjs/business-form-schema-63b311b2.js +132 -0
- package/dist/cjs/business-form-schema-63b311b2.js.map +1 -0
- package/dist/cjs/form-control-select_2.cjs.entry.js +61 -0
- package/dist/cjs/form-control-select_2.cjs.entry.js.map +1 -0
- package/dist/cjs/{index-34312a38.js → index-83b2ec02.js} +136 -20
- package/dist/cjs/index-83b2ec02.js.map +1 -0
- package/dist/cjs/{index.esm-bcf90c56.js → index.esm-7e12ce07.js} +301 -14
- package/dist/cjs/index.esm-7e12ce07.js.map +1 -0
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +8 -3
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js.map +1 -1
- package/dist/cjs/justifi-billing-form_2.cjs.entry.js +5 -5
- package/dist/cjs/justifi-billing-form_2.cjs.entry.js.map +1 -1
- package/dist/cjs/justifi-business-address-form.cjs.entry.js +37 -0
- package/dist/cjs/justifi-business-address-form.cjs.entry.js.map +1 -0
- package/dist/cjs/justifi-business-form.cjs.entry.js +751 -0
- package/dist/cjs/justifi-business-form.cjs.entry.js.map +1 -0
- package/dist/cjs/justifi-business-generic-info_3.cjs.entry.js +148 -0
- package/dist/cjs/justifi-business-generic-info_3.cjs.entry.js.map +1 -0
- package/dist/cjs/justifi-card-form.cjs.entry.js +8 -3
- package/dist/cjs/justifi-card-form.cjs.entry.js.map +1 -1
- package/dist/cjs/justifi-payment-form.cjs.entry.js +24 -7
- package/dist/cjs/justifi-payment-form.cjs.entry.js.map +1 -1
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js +22 -17
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js.map +1 -1
- package/dist/cjs/justifi-payments-list.cjs.entry.js +75 -4038
- package/dist/cjs/justifi-payments-list.cjs.entry.js.map +1 -1
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +113 -0
- package/dist/cjs/justifi-payouts-list.cjs.entry.js.map +1 -0
- package/dist/cjs/loader.cjs.js +3 -12
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/select-input_2.cjs.entry.js +6 -6
- package/dist/cjs/select-input_2.cjs.entry.js.map +1 -1
- package/dist/cjs/{state-options-efeaa587.js → state-options-83b52cd1.js} +1 -1
- package/dist/{esm/state-options-188acc34.js.map → cjs/state-options-83b52cd1.js.map} +1 -1
- package/dist/cjs/utils-4ee7e080.js +3979 -0
- package/dist/cjs/utils-4ee7e080.js.map +1 -0
- package/dist/cjs/webcomponents.cjs.js +3 -6
- package/dist/cjs/webcomponents.cjs.js.map +1 -1
- package/dist/collection/api/Api.js +3 -2
- package/dist/collection/api/Api.js.map +1 -1
- package/dist/collection/api/Payout.js +33 -0
- package/dist/collection/api/Payout.js.map +1 -0
- package/dist/collection/api/index.js +1 -0
- package/dist/collection/api/index.js.map +1 -1
- package/dist/collection/api/mockData/MockPayments.js +1 -1
- package/dist/collection/collection-manifest.json +18 -12
- package/dist/collection/components/bank-account-form/bank-account-form.js +38 -10
- package/dist/collection/components/bank-account-form/bank-account-form.js.map +1 -1
- package/dist/collection/components/bank-account-form/bank-account-form.stories.js +2 -0
- package/dist/collection/components/bank-account-form/bank-account-form.stories.js.map +1 -1
- package/dist/collection/components/bank-account-form/test/bank-account-form.e2e.js +1 -1
- package/dist/collection/components/bank-account-form/test/bank-account-form.spec.js +3 -3
- package/dist/collection/components/billing-form/billing-form-schema.js +1 -1
- package/dist/collection/components/billing-form/billing-form.css +212 -39
- package/dist/collection/components/billing-form/billing-form.js +16 -10
- package/dist/collection/components/billing-form/billing-form.js.map +1 -1
- package/dist/collection/components/billing-form/test/billing-form.spec.js +51 -24
- package/dist/collection/components/billing-form/test/billing-form.spec.js.map +1 -1
- package/dist/collection/components/{business-address/business-address-schema.js → business-form/business-address/business-address-form-schema.js} +2 -2
- package/dist/collection/components/business-form/business-address/business-address-form-schema.js.map +1 -0
- package/dist/collection/components/business-form/business-address/business-address-form.css +2532 -0
- package/dist/collection/components/business-form/business-address/business-address-form.js +98 -0
- package/dist/collection/components/business-form/business-address/business-address-form.js.map +1 -0
- package/dist/collection/components/business-form/business-address/test/business-address.e2e.js +10 -0
- package/dist/collection/components/business-form/business-address/test/business-address.e2e.js.map +1 -0
- package/dist/collection/components/business-form/business-address/test/business-address.spec.js +72 -0
- package/dist/collection/components/business-form/business-address/test/business-address.spec.js.map +1 -0
- package/dist/collection/components/business-form/business-form-schema.js +149 -0
- package/dist/collection/components/business-form/business-form-schema.js.map +1 -0
- package/dist/collection/components/business-form/business-form.css +2532 -0
- package/dist/collection/components/business-form/business-form.js +76 -0
- package/dist/collection/components/business-form/business-form.js.map +1 -0
- package/dist/collection/components/{business-info/business-info.css → business-form/business-generic-info/business-generic-info.css} +745 -530
- package/dist/collection/components/business-form/business-generic-info/business-generic-info.js +79 -0
- package/dist/collection/components/business-form/business-generic-info/business-generic-info.js.map +1 -0
- package/dist/collection/components/business-form/business-owners/business-owners.css +2489 -0
- package/dist/collection/components/business-form/business-owners/business-owners.js +120 -0
- package/dist/collection/components/business-form/business-owners/business-owners.js.map +1 -0
- package/dist/collection/components/business-form/business-representative/business-representative-schema.js +2 -0
- package/dist/collection/components/business-form/business-representative/business-representative-schema.js.map +1 -0
- package/dist/collection/components/business-form/business-representative/business-representative.css +2489 -0
- package/dist/collection/components/business-form/business-representative/business-representative.js +76 -0
- package/dist/collection/components/business-form/business-representative/business-representative.js.map +1 -0
- package/dist/collection/components/business-form/businessForm.stories.js +115 -0
- package/dist/collection/components/business-form/businessForm.stories.js.map +1 -0
- package/dist/collection/components/card-form/card-form.js +38 -10
- package/dist/collection/components/card-form/card-form.js.map +1 -1
- package/dist/collection/components/card-form/card-form.stories.js +5 -2
- package/dist/collection/components/card-form/card-form.stories.js.map +1 -1
- package/dist/collection/components/card-form/test/card-form.e2e.js +1 -1
- package/dist/collection/components/card-form/test/card-form.spec.js +3 -3
- package/dist/collection/components/{business-address/business-address.css → form/form-control-select.css} +344 -1212
- package/dist/collection/components/form/form-control-select.js +168 -0
- package/dist/collection/components/form/form-control-select.js.map +1 -0
- package/dist/collection/components/form/form-control-text.css +1794 -0
- package/dist/collection/components/form/form-control-text.js +152 -0
- package/dist/collection/components/form/form-control-text.js.map +1 -0
- package/dist/collection/components/form/form.js +85 -0
- package/dist/collection/components/form/form.js.map +1 -0
- package/dist/collection/components/payment-form/payment-form.css +220 -45
- package/dist/collection/components/payment-form/payment-form.js +47 -7
- package/dist/collection/components/payment-form/payment-form.js.map +1 -1
- package/dist/collection/components/payment-form/payment-form.stories.js +3 -2
- package/dist/collection/components/payment-form/payment-form.stories.js.map +1 -1
- package/dist/collection/components/payment-form/payment-method-selector.css +348 -145
- package/dist/collection/components/payment-form/payment-method-selector.js +5 -3
- package/dist/collection/components/payment-form/payment-method-selector.js.map +1 -1
- package/dist/collection/components/payment-form/test/payment-form.e2e.js +1 -1
- package/dist/collection/components/payment-form/test/payment-form.spec.js +4 -3
- package/dist/collection/components/payment-form/test/payment-form.spec.js.map +1 -1
- package/dist/collection/components/payment-method-form/get-computed-theme.js +2 -0
- package/dist/collection/components/payment-method-form/get-computed-theme.js.map +1 -1
- package/dist/collection/components/payment-method-form/payment-method-form.js +19 -11
- package/dist/collection/components/payment-method-form/payment-method-form.js.map +1 -1
- package/dist/collection/components/payment-method-form/test/payment-method-form.e2e.js +1 -1
- package/dist/collection/components/payment-method-form/test/payment-method-form.spec.js +3 -3
- package/dist/collection/components/payment-method-form/theme.js.map +1 -1
- package/dist/collection/components/payments-list/example.js +12 -0
- package/dist/collection/components/payments-list/payments-list.css +7954 -1
- package/dist/collection/components/payments-list/payments-list.js +104 -27
- package/dist/collection/components/payments-list/payments-list.js.map +1 -1
- package/dist/collection/components/payments-list/payments-list.stories.js +78 -0
- package/dist/collection/components/payments-list/payments-list.stories.js.map +1 -0
- package/dist/collection/components/payments-list/test/payments-list.spec.js +82 -18
- package/dist/collection/components/payments-list/test/payments-list.spec.js.map +1 -1
- package/dist/collection/components/payouts-list/payouts-list.css +7983 -0
- package/dist/collection/components/payouts-list/payouts-list.js +181 -0
- package/dist/collection/components/payouts-list/payouts-list.js.map +1 -0
- package/dist/collection/components/payouts-list/payouts-list.stories.js +69 -0
- package/dist/collection/components/payouts-list/payouts-list.stories.js.map +1 -0
- package/dist/collection/components/select-input/select-input.css +344 -141
- package/dist/collection/components/select-input/select-input.js +5 -4
- package/dist/collection/components/select-input/select-input.js.map +1 -1
- package/dist/collection/components/select-input/test/select-input.spec.js +72 -28
- package/dist/collection/components/select-input/test/select-input.spec.js.map +1 -1
- package/dist/collection/components/text-input/test/text-input.spec.js +47 -5
- package/dist/collection/components/text-input/test/text-input.spec.js.map +1 -1
- package/dist/collection/components/text-input/text-input.css +344 -141
- package/dist/collection/components/text-input/text-input.js +2 -2
- package/dist/collection/components/text-input/text-input.js.map +1 -1
- package/dist/collection/utils/utils.js +7 -2
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/Api.js +2 -1
- package/dist/components/Api.js.map +1 -1
- package/dist/components/billing-form.js +2 -2
- package/dist/components/billing-form.js.map +1 -1
- package/dist/components/business-address-form.js +65 -0
- package/dist/components/business-address-form.js.map +1 -0
- package/dist/components/business-generic-info.js +190 -0
- package/dist/components/business-generic-info.js.map +1 -0
- package/dist/components/business-owners.js +102 -0
- package/dist/components/business-owners.js.map +1 -0
- package/dist/components/business-representative.js +75 -0
- package/dist/components/business-representative.js.map +1 -0
- package/dist/components/{justifi-business-info.d.ts → form-control-select.d.ts} +4 -4
- package/dist/components/form-control-select.js +8 -0
- package/dist/components/form-control-select.js.map +1 -0
- package/dist/components/form-control-select2.js +53 -0
- package/dist/components/form-control-select2.js.map +1 -0
- package/dist/components/form-control-text.d.ts +11 -0
- package/dist/components/form-control-text.js +8 -0
- package/dist/components/form-control-text.js.map +1 -0
- package/dist/components/form-control-text2.js +51 -0
- package/dist/components/form-control-text2.js.map +1 -0
- package/dist/components/index.esm.js +298 -14
- package/dist/components/index.esm.js.map +1 -1
- package/dist/components/justifi-bank-account-form.js +7 -2
- package/dist/components/justifi-bank-account-form.js.map +1 -1
- package/dist/components/justifi-business-address-form.d.ts +11 -0
- package/dist/components/justifi-business-address-form.js +8 -0
- package/dist/components/justifi-business-address-form.js.map +1 -0
- package/dist/components/justifi-business-form.d.ts +11 -0
- package/dist/components/justifi-business-form.js +802 -0
- package/dist/components/justifi-business-form.js.map +1 -0
- package/dist/components/justifi-business-generic-info.d.ts +11 -0
- package/dist/components/justifi-business-generic-info.js +8 -0
- package/dist/components/justifi-business-generic-info.js.map +1 -0
- package/dist/components/justifi-business-owners.d.ts +11 -0
- package/dist/components/justifi-business-owners.js +8 -0
- package/dist/components/justifi-business-owners.js.map +1 -0
- package/dist/components/justifi-business-representative.d.ts +11 -0
- package/dist/components/justifi-business-representative.js +8 -0
- package/dist/components/justifi-business-representative.js.map +1 -0
- package/dist/components/justifi-card-form.js +7 -2
- package/dist/components/justifi-card-form.js.map +1 -1
- package/dist/components/justifi-payment-form.js +23 -4
- package/dist/components/justifi-payment-form.js.map +1 -1
- package/dist/components/justifi-payments-list.js +78 -4038
- package/dist/components/justifi-payments-list.js.map +1 -1
- package/dist/components/justifi-payouts-list.d.ts +11 -0
- package/dist/components/justifi-payouts-list.js +134 -0
- package/dist/components/justifi-payouts-list.js.map +1 -0
- package/dist/components/payment-method-form.js +21 -16
- package/dist/components/payment-method-form.js.map +1 -1
- package/dist/components/payment-method-selector.js +1 -1
- package/dist/components/payment-method-selector.js.map +1 -1
- package/dist/components/select-input2.js +3 -3
- package/dist/components/select-input2.js.map +1 -1
- package/dist/components/state-options.js.map +1 -1
- package/dist/components/text-input2.js +2 -2
- package/dist/components/text-input2.js.map +1 -1
- package/dist/components/utils.js +3972 -0
- package/dist/components/utils.js.map +1 -0
- package/dist/esm/{Api-a07f0057.js → Api-436dfa09.js} +3 -2
- package/dist/esm/Api-436dfa09.js.map +1 -0
- package/dist/esm/business-form-schema-30c48693.js +128 -0
- package/dist/esm/business-form-schema-30c48693.js.map +1 -0
- package/dist/esm/form-control-select_2.entry.js +56 -0
- package/dist/esm/form-control-select_2.entry.js.map +1 -0
- package/dist/esm/{index-044f93fc.js → index-c8f391de.js} +136 -20
- package/dist/esm/index-c8f391de.js.map +1 -0
- package/dist/esm/{index.esm-5624a5ed.js → index.esm-be2cd327.js} +299 -15
- package/dist/esm/index.esm-be2cd327.js.map +1 -0
- package/dist/esm/justifi-bank-account-form.entry.js +8 -3
- package/dist/esm/justifi-bank-account-form.entry.js.map +1 -1
- package/dist/esm/justifi-billing-form_2.entry.js +5 -5
- package/dist/esm/justifi-billing-form_2.entry.js.map +1 -1
- package/dist/esm/justifi-business-address-form.entry.js +33 -0
- package/dist/esm/justifi-business-address-form.entry.js.map +1 -0
- package/dist/esm/justifi-business-form.entry.js +747 -0
- package/dist/esm/justifi-business-form.entry.js.map +1 -0
- package/dist/esm/justifi-business-generic-info_3.entry.js +142 -0
- package/dist/esm/justifi-business-generic-info_3.entry.js.map +1 -0
- package/dist/esm/justifi-card-form.entry.js +8 -3
- package/dist/esm/justifi-card-form.entry.js.map +1 -1
- package/dist/esm/justifi-payment-form.entry.js +21 -4
- package/dist/esm/justifi-payment-form.entry.js.map +1 -1
- package/dist/esm/justifi-payment-method-form.entry.js +22 -17
- package/dist/esm/justifi-payment-method-form.entry.js.map +1 -1
- package/dist/esm/justifi-payments-list.entry.js +75 -4038
- package/dist/esm/justifi-payments-list.entry.js.map +1 -1
- package/dist/esm/justifi-payouts-list.entry.js +109 -0
- package/dist/esm/justifi-payouts-list.entry.js.map +1 -0
- package/dist/esm/loader.js +4 -13
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/select-input_2.entry.js +6 -6
- package/dist/esm/select-input_2.entry.js.map +1 -1
- package/dist/esm/{state-options-188acc34.js → state-options-ece00aa2.js} +1 -1
- package/dist/esm/state-options-ece00aa2.js.map +1 -0
- package/dist/esm/utils-e7782126.js +3972 -0
- package/dist/esm/utils-e7782126.js.map +1 -0
- package/dist/esm/webcomponents.js +4 -7
- package/dist/esm/webcomponents.js.map +1 -1
- package/dist/types/api/Payout.d.ts +62 -0
- package/dist/types/api/index.d.ts +1 -0
- package/dist/types/components/business-form/business-address/business-address-form.d.ts +9 -0
- package/dist/types/components/{business-info/business-info-schema.d.ts → business-form/business-form-schema.d.ts} +55 -4
- package/dist/types/components/business-form/business-form.d.ts +14 -0
- package/dist/types/components/business-form/business-generic-info/business-generic-info.d.ts +16 -0
- package/dist/types/components/business-form/business-owners/business-owners.d.ts +32 -0
- package/dist/types/components/business-form/business-representative/business-representative-schema.d.ts +15 -0
- package/dist/types/components/business-form/business-representative/business-representative.d.ts +12 -0
- package/dist/types/components/business-form/businessForm.stories.d.ts +21 -0
- package/dist/types/components/form/form-control-select.d.ts +16 -0
- package/dist/types/components/form/form-control-text.d.ts +12 -0
- package/dist/types/components/form/form.d.ts +21 -0
- package/dist/types/components/payment-form/payment-form.d.ts +2 -0
- package/dist/types/components/payment-method-form/theme.d.ts +2 -0
- package/dist/types/components/payments-list/payments-list.d.ts +38 -5
- package/dist/types/components/payments-list/payments-list.stories.d.ts +17 -0
- package/dist/types/components/payouts-list/payouts-list.d.ts +45 -0
- package/dist/types/components/payouts-list/payouts-list.stories.d.ts +16 -0
- package/dist/types/components.d.ts +339 -26
- package/dist/types/stencil-public-runtime.d.ts +14 -2
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/webcomponents/p-0fd4aae2.js +2 -0
- package/dist/webcomponents/p-0fd4aae2.js.map +1 -0
- package/dist/webcomponents/p-1953797f.entry.js +2 -0
- package/dist/webcomponents/p-1953797f.entry.js.map +1 -0
- package/dist/webcomponents/p-1a1f2196.js +2 -0
- package/dist/webcomponents/p-1a1f2196.js.map +1 -0
- package/dist/webcomponents/p-23e9c7d4.entry.js +2 -0
- package/dist/webcomponents/p-23e9c7d4.entry.js.map +1 -0
- package/dist/webcomponents/p-309a886f.entry.js +2 -0
- package/dist/webcomponents/p-309a886f.entry.js.map +1 -0
- package/dist/webcomponents/p-33d69eb5.entry.js +2 -0
- package/dist/webcomponents/p-33d69eb5.entry.js.map +1 -0
- package/dist/webcomponents/p-3a80a2ec.entry.js +2 -0
- package/dist/webcomponents/p-3a80a2ec.entry.js.map +1 -0
- package/dist/webcomponents/p-45fea6a8.entry.js +2 -0
- package/dist/webcomponents/p-45fea6a8.entry.js.map +1 -0
- package/dist/webcomponents/{p-0ea23153.js → p-47bc59b5.js} +1 -1
- package/dist/webcomponents/p-47bc59b5.js.map +1 -0
- package/dist/webcomponents/p-7041a637.entry.js +2 -0
- package/dist/webcomponents/p-7041a637.entry.js.map +1 -0
- package/dist/webcomponents/p-79456add.js +2 -0
- package/dist/webcomponents/p-79456add.js.map +1 -0
- package/dist/webcomponents/{p-1f151d49.js → p-af080b21.js} +2 -2
- package/dist/webcomponents/p-af080b21.js.map +1 -0
- package/dist/webcomponents/p-bc969904.js +3 -0
- package/dist/webcomponents/p-bc969904.js.map +1 -0
- package/dist/webcomponents/p-cd097ce9.entry.js +2 -0
- package/dist/webcomponents/p-cd097ce9.entry.js.map +1 -0
- package/dist/webcomponents/p-d5bc9f22.entry.js +2 -0
- package/dist/webcomponents/p-d5bc9f22.entry.js.map +1 -0
- package/dist/webcomponents/p-d5cadc78.entry.js +2 -0
- package/dist/webcomponents/p-d5cadc78.entry.js.map +1 -0
- package/dist/webcomponents/p-dd1ebc0b.entry.js +2 -0
- package/dist/webcomponents/p-dd1ebc0b.entry.js.map +1 -0
- package/dist/webcomponents/p-e05e0c6b.entry.js +2 -0
- package/dist/webcomponents/p-e05e0c6b.entry.js.map +1 -0
- package/dist/webcomponents/webcomponents.css +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/dist/webcomponents/webcomponents.esm.js.map +1 -1
- package/loader/index.d.ts +1 -1
- package/package.json +12 -14
- package/CHANGELOG.md +0 -208
- package/changelog-template.hbs +0 -10
- package/dist/cjs/Api-11362403.js.map +0 -1
- package/dist/cjs/Payment-ac4dea02.js +0 -73
- package/dist/cjs/Payment-ac4dea02.js.map +0 -1
- package/dist/cjs/index-34312a38.js.map +0 -1
- package/dist/cjs/index.esm-bcf90c56.js.map +0 -1
- package/dist/cjs/justifi-business-address.cjs.entry.js +0 -69
- package/dist/cjs/justifi-business-address.cjs.entry.js.map +0 -1
- package/dist/cjs/justifi-business-info.cjs.entry.js +0 -174
- package/dist/cjs/justifi-business-info.cjs.entry.js.map +0 -1
- package/dist/cjs/state-options-efeaa587.js.map +0 -1
- package/dist/collection/components/business-address/business-address-schema.js.map +0 -1
- package/dist/collection/components/business-address/business-address.js +0 -100
- package/dist/collection/components/business-address/business-address.js.map +0 -1
- package/dist/collection/components/business-address/test/business-address.e2e.js +0 -10
- package/dist/collection/components/business-address/test/business-address.e2e.js.map +0 -1
- package/dist/collection/components/business-address/test/business-address.spec.js +0 -18
- package/dist/collection/components/business-address/test/business-address.spec.js.map +0 -1
- package/dist/collection/components/business-info/business-info-schema.js +0 -94
- package/dist/collection/components/business-info/business-info-schema.js.map +0 -1
- package/dist/collection/components/business-info/business-info.js +0 -168
- package/dist/collection/components/business-info/business-info.js.map +0 -1
- package/dist/components/Payment.js +0 -71
- package/dist/components/Payment.js.map +0 -1
- package/dist/components/justifi-business-address.d.ts +0 -11
- package/dist/components/justifi-business-address.js +0 -99
- package/dist/components/justifi-business-address.js.map +0 -1
- package/dist/components/justifi-business-info.js +0 -207
- package/dist/components/justifi-business-info.js.map +0 -1
- package/dist/esm/Api-a07f0057.js.map +0 -1
- package/dist/esm/Payment-c86e1e84.js +0 -71
- package/dist/esm/Payment-c86e1e84.js.map +0 -1
- package/dist/esm/index-044f93fc.js.map +0 -1
- package/dist/esm/index.esm-5624a5ed.js.map +0 -1
- package/dist/esm/justifi-business-address.entry.js +0 -65
- package/dist/esm/justifi-business-address.entry.js.map +0 -1
- package/dist/esm/justifi-business-info.entry.js +0 -170
- package/dist/esm/justifi-business-info.entry.js.map +0 -1
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/types/components/bank-account-form/bank-account-form.d.ts +0 -56
- package/dist/types/components/business-address/business-address.d.ts +0 -11
- package/dist/types/components/business-info/business-info.d.ts +0 -20
- package/dist/types/components/card-form/card-form.d.ts +0 -62
- package/dist/webcomponents/p-0969db8f.entry.js +0 -2
- package/dist/webcomponents/p-0969db8f.entry.js.map +0 -1
- package/dist/webcomponents/p-0ea23153.js.map +0 -1
- package/dist/webcomponents/p-1ca0646b.js +0 -2
- package/dist/webcomponents/p-1ca0646b.js.map +0 -1
- package/dist/webcomponents/p-1f151d49.js.map +0 -1
- package/dist/webcomponents/p-255b1284.entry.js +0 -2
- package/dist/webcomponents/p-255b1284.entry.js.map +0 -1
- package/dist/webcomponents/p-3aa91155.js +0 -3
- package/dist/webcomponents/p-3aa91155.js.map +0 -1
- package/dist/webcomponents/p-4ecc9860.entry.js +0 -2
- package/dist/webcomponents/p-4ecc9860.entry.js.map +0 -1
- package/dist/webcomponents/p-90c0d9e1.entry.js +0 -2
- package/dist/webcomponents/p-90c0d9e1.entry.js.map +0 -1
- package/dist/webcomponents/p-bd5352d6.entry.js +0 -2
- package/dist/webcomponents/p-bd5352d6.entry.js.map +0 -1
- package/dist/webcomponents/p-c903cc5a.entry.js +0 -2
- package/dist/webcomponents/p-c903cc5a.entry.js.map +0 -1
- package/dist/webcomponents/p-d87b0711.entry.js +0 -2
- package/dist/webcomponents/p-d87b0711.entry.js.map +0 -1
- package/dist/webcomponents/p-dbf7100f.entry.js +0 -2
- package/dist/webcomponents/p-dbf7100f.entry.js.map +0 -1
- package/dist/webcomponents/p-e0054bc3.js +0 -2
- package/dist/webcomponents/p-e0054bc3.js.map +0 -1
- package/dist/webcomponents/p-f30d1567.entry.js +0 -2
- package/dist/webcomponents/p-f30d1567.entry.js.map +0 -1
- /package/dist/types/components/{business-address/business-address-schema.d.ts → business-form/business-address/business-address-form-schema.d.ts} +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
export class TextInput {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.label = undefined;
|
|
5
|
+
this.name = undefined;
|
|
6
|
+
this.error = undefined;
|
|
7
|
+
this.defaultValue = undefined;
|
|
8
|
+
this.inputHandler = undefined;
|
|
9
|
+
}
|
|
10
|
+
handleFormControlInput(event) {
|
|
11
|
+
const target = event.target;
|
|
12
|
+
const name = target.getAttribute('name');
|
|
13
|
+
this.inputHandler(name, target.value);
|
|
14
|
+
}
|
|
15
|
+
;
|
|
16
|
+
render() {
|
|
17
|
+
return (h(Host, { exportparts: "label,input,input-invalid" }, h("label", { part: "label", class: "form-label", htmlFor: this.name }, this.label), h("input", { id: this.name, name: this.name, onInput: (event) => this.handleFormControlInput(event), onBlur: () => this.formControlBlur.emit(), part: `input ${this.error && 'input-invalid'}`, class: this.error ? 'form-control is-invalid' : 'form-control', type: "text" }), this.error && h("div", { class: "invalid-feedback" }, this.error)));
|
|
18
|
+
}
|
|
19
|
+
static get is() { return "form-control-text"; }
|
|
20
|
+
static get encapsulation() { return "shadow"; }
|
|
21
|
+
static get originalStyleUrls() {
|
|
22
|
+
return {
|
|
23
|
+
"$": ["form-control-text.scss"]
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
static get styleUrls() {
|
|
27
|
+
return {
|
|
28
|
+
"$": ["form-control-text.css"]
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
static get properties() {
|
|
32
|
+
return {
|
|
33
|
+
"label": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"mutable": false,
|
|
36
|
+
"complexType": {
|
|
37
|
+
"original": "string",
|
|
38
|
+
"resolved": "string",
|
|
39
|
+
"references": {}
|
|
40
|
+
},
|
|
41
|
+
"required": false,
|
|
42
|
+
"optional": false,
|
|
43
|
+
"docs": {
|
|
44
|
+
"tags": [],
|
|
45
|
+
"text": ""
|
|
46
|
+
},
|
|
47
|
+
"attribute": "label",
|
|
48
|
+
"reflect": false
|
|
49
|
+
},
|
|
50
|
+
"name": {
|
|
51
|
+
"type": "any",
|
|
52
|
+
"mutable": false,
|
|
53
|
+
"complexType": {
|
|
54
|
+
"original": "any",
|
|
55
|
+
"resolved": "any",
|
|
56
|
+
"references": {}
|
|
57
|
+
},
|
|
58
|
+
"required": false,
|
|
59
|
+
"optional": false,
|
|
60
|
+
"docs": {
|
|
61
|
+
"tags": [],
|
|
62
|
+
"text": ""
|
|
63
|
+
},
|
|
64
|
+
"attribute": "name",
|
|
65
|
+
"reflect": false
|
|
66
|
+
},
|
|
67
|
+
"error": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"mutable": false,
|
|
70
|
+
"complexType": {
|
|
71
|
+
"original": "string",
|
|
72
|
+
"resolved": "string",
|
|
73
|
+
"references": {}
|
|
74
|
+
},
|
|
75
|
+
"required": false,
|
|
76
|
+
"optional": false,
|
|
77
|
+
"docs": {
|
|
78
|
+
"tags": [],
|
|
79
|
+
"text": ""
|
|
80
|
+
},
|
|
81
|
+
"attribute": "error",
|
|
82
|
+
"reflect": false
|
|
83
|
+
},
|
|
84
|
+
"defaultValue": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"mutable": false,
|
|
87
|
+
"complexType": {
|
|
88
|
+
"original": "string",
|
|
89
|
+
"resolved": "string",
|
|
90
|
+
"references": {}
|
|
91
|
+
},
|
|
92
|
+
"required": false,
|
|
93
|
+
"optional": false,
|
|
94
|
+
"docs": {
|
|
95
|
+
"tags": [],
|
|
96
|
+
"text": ""
|
|
97
|
+
},
|
|
98
|
+
"attribute": "default-value",
|
|
99
|
+
"reflect": false
|
|
100
|
+
},
|
|
101
|
+
"inputHandler": {
|
|
102
|
+
"type": "unknown",
|
|
103
|
+
"mutable": false,
|
|
104
|
+
"complexType": {
|
|
105
|
+
"original": "(name: string, value: string) => void",
|
|
106
|
+
"resolved": "(name: string, value: string) => void",
|
|
107
|
+
"references": {}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": ""
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
static get events() {
|
|
119
|
+
return [{
|
|
120
|
+
"method": "formControlInput",
|
|
121
|
+
"name": "formControlInput",
|
|
122
|
+
"bubbles": true,
|
|
123
|
+
"cancelable": true,
|
|
124
|
+
"composed": true,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": ""
|
|
128
|
+
},
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "any",
|
|
131
|
+
"resolved": "any",
|
|
132
|
+
"references": {}
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
"method": "formControlBlur",
|
|
136
|
+
"name": "formControlBlur",
|
|
137
|
+
"bubbles": true,
|
|
138
|
+
"cancelable": true,
|
|
139
|
+
"composed": true,
|
|
140
|
+
"docs": {
|
|
141
|
+
"tags": [],
|
|
142
|
+
"text": ""
|
|
143
|
+
},
|
|
144
|
+
"complexType": {
|
|
145
|
+
"original": "any",
|
|
146
|
+
"resolved": "any",
|
|
147
|
+
"references": {}
|
|
148
|
+
}
|
|
149
|
+
}];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=form-control-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-control-text.js","sourceRoot":"","sources":["../../../../src/components/form/form-control-text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAO9E,MAAM,OAAO,SAAS;;;;;;;;EASpB,sBAAsB,CAAC,KAAU;IAC/B,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACzC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;EACxC,CAAC;EAAA,CAAC;EAEF,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,IAAC,WAAW,EAAC,2BAA2B;MAC3C,aAAO,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,YAAY,EAAC,OAAO,EAAE,IAAI,CAAC,IAAI,IACtD,IAAI,CAAC,KAAK,CACL;MACR,aACE,EAAE,EAAE,IAAI,CAAC,IAAI,EACb,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,OAAO,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,EAC3D,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,EACzC,IAAI,EAAE,SAAS,IAAI,CAAC,KAAK,IAAI,eAAe,EAAE,EAC9C,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,cAAc,EAC9D,IAAI,EAAC,MAAM,GACX;MACD,IAAI,CAAC,KAAK,IAAI,WAAK,KAAK,EAAC,kBAAkB,IAAE,IAAI,CAAC,KAAK,CAAO,CAC1D,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop, Event, EventEmitter } from '@stencil/core';\n\n@Component({\n tag: 'form-control-text',\n styleUrl: 'form-control-text.scss',\n shadow: true,\n})\nexport class TextInput {\n @Prop() label: string;\n @Prop() name: any;\n @Prop() error: string;\n @Prop() defaultValue: string;\n @Prop() inputHandler: (name: string, value: string) => void;\n @Event() formControlInput: EventEmitter<any>;\n @Event() formControlBlur: EventEmitter<any>;\n\n handleFormControlInput(event: any) {\n const target = event.target;\n const name = target.getAttribute('name');\n this.inputHandler(name, target.value);\n };\n\n render() {\n return (\n <Host exportparts=\"label,input,input-invalid\">\n <label part=\"label\" class=\"form-label\" htmlFor={this.name}>\n {this.label}\n </label>\n <input\n id={this.name}\n name={this.name}\n onInput={(event: any) => this.handleFormControlInput(event)}\n onBlur={() => this.formControlBlur.emit()}\n part={`input ${this.error && 'input-invalid'}`}\n class={this.error ? 'form-control is-invalid' : 'form-control'}\n type=\"text\"\n />\n {this.error && <div class=\"invalid-feedback\">{this.error}</div>}\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { BehaviorSubject } from "rxjs";
|
|
2
|
+
export class FormController {
|
|
3
|
+
constructor(schema, defaultValues = {}) {
|
|
4
|
+
this.defaultValues = new BehaviorSubject({});
|
|
5
|
+
this.values = new BehaviorSubject({});
|
|
6
|
+
this.errors = new BehaviorSubject({});
|
|
7
|
+
this._defaultValues = {};
|
|
8
|
+
this._values = {};
|
|
9
|
+
this._errors = {};
|
|
10
|
+
this._isValid = true;
|
|
11
|
+
this._schema = schema;
|
|
12
|
+
this._defaultValues = defaultValues;
|
|
13
|
+
}
|
|
14
|
+
processArrayError(obj, property, remainingProperties, message) {
|
|
15
|
+
// Extract array name and index from the property string
|
|
16
|
+
const [arrayName, indexStr] = property.match(/^([a-zA-Z0-9]+)\[(\d+)\]/).slice(1);
|
|
17
|
+
const index = parseInt(indexStr, 10);
|
|
18
|
+
// Ensure the array exists and has an entry at the given index
|
|
19
|
+
obj[arrayName] = obj[arrayName] || [];
|
|
20
|
+
obj[arrayName][index] = obj[arrayName][index] || {};
|
|
21
|
+
// Recursively set the error if there are remaining properties, else set the error message
|
|
22
|
+
if (remainingProperties.length) {
|
|
23
|
+
this.setNestedError(obj[arrayName][index], remainingProperties, message);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
obj[arrayName][index] = message;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
processRegularError(obj, property, remainingProperties, message) {
|
|
30
|
+
// Ensure the property exists
|
|
31
|
+
obj[property] = obj[property] || {};
|
|
32
|
+
// Recursively set the error if there are remaining properties, else set the error message
|
|
33
|
+
if (remainingProperties.length) {
|
|
34
|
+
this.setNestedError(obj[property], remainingProperties, message);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
obj[property] = message;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
setNestedError(obj, properties, message) {
|
|
41
|
+
const property = properties.shift();
|
|
42
|
+
const isArrayError = property.includes('[');
|
|
43
|
+
if (isArrayError) {
|
|
44
|
+
this.processArrayError(obj, property, properties, message);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.processRegularError(obj, property, properties, message);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
setError(obj, path, message) {
|
|
51
|
+
// Convert path to properties array
|
|
52
|
+
const properties = Array.isArray(path) ? path : path.split('.');
|
|
53
|
+
this.setNestedError(obj, properties, message);
|
|
54
|
+
}
|
|
55
|
+
async validate() {
|
|
56
|
+
this._isValid = true;
|
|
57
|
+
this._errors = {};
|
|
58
|
+
try {
|
|
59
|
+
await this._schema.validate(this._values, { abortEarly: false });
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
this._isValid = false;
|
|
63
|
+
err.inner.forEach((item) => {
|
|
64
|
+
this.setError(this._errors, item.path, item.message);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
this.errors.next(this._errors);
|
|
68
|
+
return this._isValid;
|
|
69
|
+
}
|
|
70
|
+
async validateAndSubmit(submitHandler) {
|
|
71
|
+
const isValid = await this.validate();
|
|
72
|
+
if (isValid) {
|
|
73
|
+
submitHandler();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
setValues(values) {
|
|
77
|
+
this._values = Object.assign(Object.assign({}, this._values), values);
|
|
78
|
+
this.values.next(this._values);
|
|
79
|
+
}
|
|
80
|
+
setDefaultValues(values) {
|
|
81
|
+
this._defaultValues = Object.assign(Object.assign({}, this._defaultValues), values);
|
|
82
|
+
this.defaultValues.next(this._defaultValues);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../../../src/components/form/form.ts"],"names":[],"mappings":"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","sourcesContent":["import { BehaviorSubject } from 'rxjs';\nimport { ObjectSchema, ValidationError } from 'yup';\n\nexport class FormController {\n public defaultValues = new BehaviorSubject<any>({});\n public values = new BehaviorSubject<any>({});\n public errors = new BehaviorSubject<any>({});\n\n private _schema: ObjectSchema<any>;\n private _defaultValues: any = {};\n private _values: any = {};\n private _errors: any = {};\n private _isValid = true;\n\n constructor(schema: ObjectSchema<any>, defaultValues: any = {}) {\n this._schema = schema;\n this._defaultValues = defaultValues;\n }\n\n private processArrayError(obj: any, property: string, remainingProperties: string[], message: string): void {\n // Extract array name and index from the property string\n const [arrayName, indexStr] = property.match(/^([a-zA-Z0-9]+)\\[(\\d+)\\]/).slice(1);\n const index = parseInt(indexStr, 10);\n\n // Ensure the array exists and has an entry at the given index\n obj[arrayName] = obj[arrayName] || [];\n obj[arrayName][index] = obj[arrayName][index] || {};\n\n // Recursively set the error if there are remaining properties, else set the error message\n if (remainingProperties.length) {\n this.setNestedError(obj[arrayName][index], remainingProperties, message);\n } else {\n obj[arrayName][index] = message;\n }\n }\n\n private processRegularError(obj: any, property: string, remainingProperties: string[], message: string): void {\n // Ensure the property exists\n obj[property] = obj[property] || {};\n\n // Recursively set the error if there are remaining properties, else set the error message\n if (remainingProperties.length) {\n this.setNestedError(obj[property], remainingProperties, message);\n } else {\n obj[property] = message;\n }\n }\n\n private setNestedError(obj: any, properties: string[], message: string): void {\n const property = properties.shift();\n const isArrayError = property.includes('[');\n\n if (isArrayError) {\n this.processArrayError(obj, property, properties, message);\n } else {\n this.processRegularError(obj, property, properties, message);\n }\n }\n\n private setError(obj: any, path: string, message: string): void {\n // Convert path to properties array\n const properties = Array.isArray(path) ? path : path.split('.');\n this.setNestedError(obj, properties, message);\n }\n\n private async validate(): Promise<boolean> {\n this._isValid = true;\n this._errors = {};\n\n try {\n await this._schema.validate(this._values, { abortEarly: false });\n } catch (err) {\n this._isValid = false;\n err.inner.forEach((item: ValidationError) => {\n this.setError(this._errors, item.path, item.message);\n });\n }\n\n this.errors.next(this._errors);\n return this._isValid;\n }\n\n public async validateAndSubmit(submitHandler: () => void): Promise<void> {\n const isValid = await this.validate();\n if (isValid) {\n submitHandler();\n }\n }\n\n public setValues(values: any): void {\n this._values = { ...this._values, ...values };\n this.values.next(this._values);\n }\n\n public setDefaultValues(values: any): void {\n this._defaultValues = { ...this._defaultValues, ...values };\n this.defaultValues.next(this._defaultValues);\n }\n}\n"]}
|