@internetarchive/elements 1.9.0 → 1.9.2
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/README.md +17 -0
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.d.ts.map +1 -1
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.js +7 -7
- package/dist/src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.js.map +1 -1
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.d.ts.map +1 -1
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.js +6 -6
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.js.map +1 -1
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-summary.d.ts.map +1 -1
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-summary.js +5 -4
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-summary.js.map +1 -1
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-total-amount.d.ts.map +1 -1
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-total-amount.js +5 -4
- package/dist/src/elements/ia-donation-form/form-elements/ia-donation-total-amount.js.map +1 -1
- package/dist/src/elements/ia-donation-form/localized-format.d.ts +20 -0
- package/dist/src/elements/ia-donation-form/localized-format.d.ts.map +1 -0
- package/dist/src/elements/ia-donation-form/localized-format.js +73 -0
- package/dist/src/elements/ia-donation-form/localized-format.js.map +1 -0
- package/dist/src/elements/ia-donation-form/modals/ia-donation-confirm-modal.d.ts.map +1 -1
- package/dist/src/elements/ia-donation-form/modals/ia-donation-confirm-modal.js +6 -2
- package/dist/src/elements/ia-donation-form/modals/ia-donation-confirm-modal.js.map +1 -1
- package/dist/src/elements/ia-donation-thermometer/ia-donation-thermometer.d.ts +12 -1
- package/dist/src/elements/ia-donation-thermometer/ia-donation-thermometer.d.ts.map +1 -1
- package/dist/src/elements/ia-donation-thermometer/ia-donation-thermometer.js +21 -9
- package/dist/src/elements/ia-donation-thermometer/ia-donation-thermometer.js.map +1 -1
- package/dist/src/locales/es.d.ts +249 -0
- package/dist/src/locales/es.d.ts.map +1 -1
- package/dist/src/locales/es.js +288 -0
- package/dist/src/locales/es.js.map +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -342,6 +342,23 @@ export const templates = { ...elements, ...app };
|
|
|
342
342
|
|
|
343
343
|
The XLIFF in `xliff/` is where translations are edited. It isn't published.
|
|
344
344
|
|
|
345
|
+
#### Drafting and reviewing translations
|
|
346
|
+
|
|
347
|
+
`pnpm run i18n:status` lists each locale's missing translations and the drafts still waiting on a native speaker. CI runs it on every PR and only warns.
|
|
348
|
+
|
|
349
|
+
To fill the gaps:
|
|
350
|
+
|
|
351
|
+
```zsh
|
|
352
|
+
pnpm run i18n:draft --locale es --export pending.es.json # extract, then write {id: text} for the missing strings
|
|
353
|
+
pnpm run i18n:draft --locale es --from translations.es.json # write translations of the same shape
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
`{0}` tokens are placeholders and have to stay in the translation. A unit that loses one is skipped and reported. Written translations are drafts, saved as `<target state="needs-review-translation">`.
|
|
357
|
+
|
|
358
|
+
A native speaker reviews each draft, fixes the `<target>` if needed, and sets `state="final"` (or deletes the attribute). Don't ship a language to everyone before its drafts have been reviewed.
|
|
359
|
+
|
|
360
|
+
To add a language, add its code to `targetLocales` in `lit-localize.json`, run `pnpm run strings:extract` to create `xliff/<locale>.xlf`, draft it as above, then run `pnpm run strings:build`.
|
|
361
|
+
|
|
345
362
|
## Icons
|
|
346
363
|
|
|
347
364
|
SVG sources live in `icons/<kebab-name>.svg`. To add one, drop the file in that folder and run `pnpm run icons` (`build`, `dev`, `typecheck` and `test` run it for you). The root `<svg>` needs a `viewBox`. The build fails on a name that isn't kebab-case, a duplicate, or a missing `viewBox`. It writes `src/icons/` (gitignored), one `.ts` and one `.svg` per icon.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-contact-form.d.ts","sourceRoot":"","sources":["../../../../../../src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAMb,OAAO,EACL,WAAW,EACX,YAAY,EACZ,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"ia-donation-contact-form.d.ts","sourceRoot":"","sources":["../../../../../../src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAMb,OAAO,EACL,WAAW,EACX,YAAY,EACZ,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,6BAA6B,CAAC;AAMrC;;;;;;;GAOG;AACH,qBAEa,qBAAsB,SAAQ,UAAU;IAEnD,gBAAgB,EAAG,qBAAqB,CAAC;IACF,UAAU,EAAG,gBAAgB,CAAC;IAGrE,oBAAoB,EAAG,qBAAqB,CAAC;IACD,cAAc,EAAG,gBAAgB,CAAC;IAG9E,mBAAmB,EAAG,qBAAqB,CAAC;IACD,aAAa,EAAG,gBAAgB,CAAC;IAG5E,iBAAiB,EAAG,qBAAqB,CAAC;IAE1C,eAAe,EAAG,gBAAgB,CAAC;IAGnC,wBAAwB,EAAG,qBAAqB,CAAC;IAEjD,kBAAkB,EAAG,gBAAgB,CAAC;IAGtC,mBAAmB,EAAG,qBAAqB,CAAC;IACF,aAAa,EAAG,gBAAgB,CAAC;IAG3E,iBAAiB,EAAG,qBAAqB,CAAC;IACF,WAAW,EAAG,gBAAgB,CAAC;IAGvE,sBAAsB,EAAG,iBAAiB,CAAC;IAEI,YAAY,EAAG,cAAc,CAAC;IAC9D,IAAI,EAAG,eAAe,CAAC;IAEtC,yEAAyE;IAC7C,eAAe,SAAQ;IAEnD,uDAAuD;IAC3B,UAAU,SAAM;IAE5C,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAMtC,mFAAmF;IACnF,cAAc,IAAI,OAAO;IAKzB,OAAO,CAAC,kBAAkB;IAwB1B,OAAO,CAAC,YAAY;IAUpB,KAAK,IAAI,IAAI;IAIb,6CAA6C;IAC7C,OAAO,CAAC,iBAAiB,CAAiB;IAC1C,OAAO,KAAK,2BAA2B,GAEtC;IAED,uFAAuF;IACvF,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,KAAK,8BAA8B,GAEzC;IAED,qCAAqC;IACrC,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,KAAK,0BAA0B,GAErC;IAED,MAAM,IAAI,cAAc;IAgGxB,OAAO,KAAK,2BAA2B,GAEtC;IAED,OAAO,KAAK,uBAAuB,GAkClC;IAED,0DAA0D;IAC1D,gBAAgB,IAAI,IAAI;IAIxB,kEAAkE;IAClE,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,aAAa;IA6CrB,IAAI,gBAAgB,IAAI,gBAAgB,CAKvC;IAED,IAAI,WAAW,IAAI,WAAW,CAQ7B;IAED,IAAI,WAAW,IAAI,YAAY,CAM9B;IAED;;;;OAIG;IACH,OAAO,KAAK,SAAS,GA6IpB;CACF"}
|
package/dist/src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.js
CHANGED
|
@@ -3,11 +3,13 @@ import { css, html, LitElement, nothing, } from 'lit';
|
|
|
3
3
|
import { property, query } from 'lit/decorators.js';
|
|
4
4
|
import { customElement } from '../../../../utils/custom-element.js';
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
|
-
import { msg } from '@lit/localize';
|
|
6
|
+
import { localized, msg } from '@lit/localize';
|
|
7
7
|
import { BillingInfo, CustomerInfo, DonorContactInfo, } from '../../models/donor-contact-info.js';
|
|
8
8
|
import { SpacerOption, } from '../ia-donation-badged-input.js';
|
|
9
9
|
import '../ia-donation-badged-input.js';
|
|
10
10
|
import { countries } from './countries.js';
|
|
11
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
12
|
+
import { localizedCountries } from '../../localized-format.js';
|
|
11
13
|
/**
|
|
12
14
|
* The donor's name, email and billing address.
|
|
13
15
|
*
|
|
@@ -199,14 +201,11 @@ let IADonationContactForm = class IADonationContactForm extends LitElement {
|
|
|
199
201
|
this.selectedCountry = newValue;
|
|
200
202
|
}}
|
|
201
203
|
>
|
|
202
|
-
${
|
|
203
|
-
const name = countries[key];
|
|
204
|
-
return html `
|
|
204
|
+
${repeat(localizedCountries(), ([key]) => key, ([key, name]) => html `
|
|
205
205
|
<option value=${key} ?selected=${key === this.selectedCountry}>
|
|
206
206
|
${name}
|
|
207
207
|
</option>
|
|
208
|
-
|
|
209
|
-
})}
|
|
208
|
+
`)}
|
|
210
209
|
</select>
|
|
211
210
|
</ia-donation-badged-input>
|
|
212
211
|
</div>
|
|
@@ -483,7 +482,8 @@ __decorate([
|
|
|
483
482
|
property({ type: String })
|
|
484
483
|
], IADonationContactForm.prototype, "donorEmail", void 0);
|
|
485
484
|
IADonationContactForm = __decorate([
|
|
486
|
-
customElement('ia-donation-contact-form')
|
|
485
|
+
customElement('ia-donation-contact-form'),
|
|
486
|
+
localized()
|
|
487
487
|
], IADonationContactForm);
|
|
488
488
|
export { IADonationContactForm };
|
|
489
489
|
//# sourceMappingURL=ia-donation-contact-form.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-contact-form.js","sourceRoot":"","sources":["../../../../../../src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IA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,qBAAqB,CA8djC","sourcesContent":["import {\n css,\n html,\n LitElement,\n nothing,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { msg } from '@lit/localize';\n\nimport {\n BillingInfo,\n CustomerInfo,\n DonorContactInfo,\n} from '../../models/donor-contact-info';\nimport {\n SpacerOption,\n type IADonationBadgedInput,\n} from '../ia-donation-badged-input';\nimport '../ia-donation-badged-input';\nimport type { AutoCompleteFieldOptions } from './autocomplete-field-options';\nimport { countries } from './countries';\n\n/**\n * The donor's name, email and billing address.\n *\n * This renders into the light DOM, not a shadow root: browser autofill\n * doesn't reach into shadow DOM, and autofill matters a lot on a donation\n * form. So its styles are a `<style>` block with every selector prefixed by\n * the tag name, and its field ids are unique across the page.\n */\n@customElement('ia-donation-contact-form')\nexport class IADonationContactForm extends LitElement {\n @query('ia-donation-badged-input.donation-contact-form-email')\n emailBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-email') emailField!: HTMLInputElement;\n\n @query('ia-donation-badged-input.donation-contact-form-first-name')\n firstNameBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-first-name') firstNameField!: HTMLInputElement;\n\n @query('ia-donation-badged-input.donation-contact-form-last-name')\n lastNameBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-last-name') lastNameField!: HTMLInputElement;\n\n @query('ia-donation-badged-input.donation-contact-form-postal-code')\n postalBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-postal-code')\n postalCodeField!: HTMLInputElement;\n\n @query('ia-donation-badged-input.donation-contact-form-street-address')\n streetAddressBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-street-address')\n streetAddressField!: HTMLInputElement;\n\n @query('ia-donation-badged-input.donation-contact-form-locality')\n localityBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-locality') localityField!: HTMLInputElement;\n\n @query('ia-donation-badged-input.donation-contact-form-region')\n regionBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-region') regionField!: HTMLInputElement;\n\n @query('#donation-contact-form-countryCodeAlpha2')\n countryCodeAlpha2Field!: HTMLSelectElement;\n\n @query('#donation-contact-form-error-message') errorMessage!: HTMLDivElement;\n @query('form') form!: HTMLFormElement;\n\n /** A key of `countries`. US addresses require a state and a zip code. */\n @property({ type: String }) selectedCountry = 'US';\n\n /** Pre-fills the email field, for a logged-in donor */\n @property({ type: String }) donorEmail = '';\n\n updated(changed: PropertyValues): void {\n if (changed.has('donorEmail')) {\n this.emailField.value = this.donorEmail ?? '';\n }\n }\n\n /** Validates every field, marks the bad ones, and shows the browser's messages. */\n reportValidity(): boolean {\n this.validateFormFields();\n return this.validateForm();\n }\n\n private validateFormFields(): void {\n const fields: {\n badgedInput: IADonationBadgedInput;\n inputField: HTMLInputElement;\n }[] = [\n { badgedInput: this.emailBadgedInput, inputField: this.emailField },\n {\n badgedInput: this.firstNameBadgedInput,\n inputField: this.firstNameField,\n },\n { badgedInput: this.lastNameBadgedInput, inputField: this.lastNameField },\n {\n badgedInput: this.streetAddressBadgedInput,\n inputField: this.streetAddressField,\n },\n { badgedInput: this.localityBadgedInput, inputField: this.localityField },\n { badgedInput: this.regionBadgedInput, inputField: this.regionField },\n { badgedInput: this.postalBadgedInput, inputField: this.postalCodeField },\n ];\n fields.forEach(({ badgedInput, inputField }) => {\n badgedInput.error = !inputField.checkValidity();\n });\n }\n\n private validateForm(): boolean {\n const isValid = this.form.reportValidity();\n\n this.errorMessage.textContent = isValid\n ? ''\n : msg('Please enter any missing or invalid contact information below');\n\n return isValid;\n }\n\n focus(): void {\n this.emailField.focus();\n }\n\n /** At least two non-whitespace characters */\n private minTwoCharPattern = '.*\\\\S{2,}.*';\n private get minTwoCharValidationMessage(): string {\n return msg('Enter at least two characters');\n }\n\n /** At least two non-whitespace characters with at least two characters between them */\n private streetAddressPattern = '.*?\\\\S.{2,}\\\\S.*?';\n private get streetAddressValidationMessage(): string {\n return msg('Enter at least four characters');\n }\n\n /** 12345, 12345-6789 or 123456789 */\n private usZipCodePattern = '^\\\\d{5}(-?\\\\d{4})?$';\n private get usZipCodeValidationMessage(): string {\n return msg('Enter a valid 5 or 9 digit zip/postal code');\n }\n\n render(): TemplateResult {\n return html`\n <div id=\"donation-contact-form-error-message\"></div>\n <form>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-email',\n label: msg('Email'),\n required: true,\n fieldType: 'email',\n name: 'email',\n autocomplete: 'email',\n minlength: 5,\n maxlength: 255,\n })}\n </div>\n\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-first-name',\n label: msg('First name'),\n name: 'fname',\n required: true,\n validationPattern: this.minTwoCharPattern,\n validationMessage: this.minTwoCharValidationMessage,\n maxlength: 255,\n autocomplete: 'given-name',\n })}\n ${this.generateInput({\n id: 'donation-contact-form-last-name',\n label: msg('Last name'),\n name: 'lname',\n autocomplete: 'family-name',\n required: true,\n validationPattern: this.minTwoCharPattern,\n validationMessage: this.minTwoCharValidationMessage,\n maxlength: 255,\n })}\n </div>\n\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-street-address',\n label: msg('Address'),\n required: true,\n autocomplete: 'address-line1',\n name: 'street-address',\n validationPattern: this.streetAddressPattern,\n validationMessage: this.streetAddressValidationMessage,\n })}\n </div>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-locality',\n label: msg('City'),\n autocomplete: 'address-level2',\n required: true,\n name: 'locality',\n validationPattern: this.minTwoCharPattern,\n validationMessage: this.minTwoCharValidationMessage,\n })}\n </div>\n <div class=\"row\">${this.countrySelectorTemplate}</div>\n <div class=\"row region-postal-row\">\n ${this.generateInput({\n id: 'donation-contact-form-region',\n label: msg('State / Province'),\n autocomplete: 'address-level1',\n required: this.regionAndPostalCodeRequired,\n name: 'region',\n validationPattern: this.regionAndPostalCodeRequired\n ? this.minTwoCharPattern\n : undefined,\n validationMessage: this.regionAndPostalCodeRequired\n ? this.minTwoCharValidationMessage\n : undefined,\n })}\n ${this.generateInput({\n id: 'donation-contact-form-postal-code',\n label: msg('Zip / Postal Code'),\n autocomplete: 'postal-code',\n required: this.regionAndPostalCodeRequired,\n name: 'postal',\n validationPattern: this.regionAndPostalCodeRequired\n ? this.usZipCodePattern\n : undefined,\n validationMessage: this.regionAndPostalCodeRequired\n ? this.usZipCodeValidationMessage\n : undefined,\n })}\n </div>\n </form>\n ${this.getStyles}\n `;\n }\n\n private get regionAndPostalCodeRequired(): boolean {\n return this.selectedCountry === 'US';\n }\n\n private get countrySelectorTemplate(): TemplateResult {\n return html`\n <div class=\"field\">\n <label\n for=\"donation-contact-form-countryCodeAlpha2\"\n class=\"field-label\"\n >\n ${msg('Country')}<span class=\"required-asterisk\"> *</span>\n </label>\n <ia-donation-badged-input\n .iconSpaceOption=${SpacerOption.CompressSpace}\n >\n <select\n id=\"donation-contact-form-countryCodeAlpha2\"\n name=\"country\"\n autocomplete=\"country\"\n @change=${(e: Event) => {\n const newValue = (e.target as HTMLSelectElement).value;\n if (countries[newValue]) this.selectedCountry = newValue;\n }}\n >\n ${Object.keys(countries).map((key) => {\n const name = countries[key];\n return html`\n <option value=${key} ?selected=${key === this.selectedCountry}>\n ${name}\n </option>\n `;\n })}\n </select>\n </ia-donation-badged-input>\n </div>\n `;\n }\n\n /** Light DOM, so browser autofill can reach the fields */\n createRenderRoot(): this {\n return this;\n }\n\n /** Clears the error state once the donor starts fixing a field */\n private inputChanged(e: Event): void {\n this.errorMessage.textContent = '';\n const input = e.target as HTMLInputElement;\n const badgedInput = this.querySelector<IADonationBadgedInput>(\n `ia-donation-badged-input.${input.id}`,\n );\n if (badgedInput) badgedInput.error = false;\n }\n\n private generateInput(options: {\n id: string;\n label: string;\n required?: boolean;\n fieldType?: 'text' | 'email';\n autocomplete?: AutoCompleteFieldOptions;\n minlength?: number;\n maxlength?: number;\n name: string;\n validationPattern?: string;\n validationMessage?: string;\n }): TemplateResult {\n const required = options.required ?? true;\n const fieldType = options.fieldType ?? 'text';\n\n return html`\n <div class=\"field ${options.id}\">\n <label for=${options.id} class=\"field-label\">\n ${options.label}${required\n ? html`<span class=\"required-asterisk\"> *</span>`\n : nothing}\n </label>\n <ia-donation-badged-input\n class=${options.id}\n .iconSpaceOption=${SpacerOption.CompressSpace}\n .requiredIndicatorSpaceOption=${SpacerOption.CompressSpace}\n >\n <input\n type=${fieldType}\n id=${options.id}\n class=\"donation-contact-form-input\"\n name=${options.name}\n maxlength=${ifDefined(options.maxlength)}\n minlength=${ifDefined(options.minlength)}\n autocomplete=${options.autocomplete ?? 'on'}\n pattern=${ifDefined(options.validationPattern)}\n title=${ifDefined(options.validationMessage)}\n @input=${this.inputChanged}\n ?required=${required}\n />\n </ia-donation-badged-input>\n </div>\n `;\n }\n\n get donorContactInfo(): DonorContactInfo {\n return new DonorContactInfo({\n billing: this.billingInfo,\n customer: this.contactInfo,\n });\n }\n\n get billingInfo(): BillingInfo {\n return new BillingInfo({\n streetAddress: this.streetAddressField.value,\n locality: this.localityField.value,\n region: this.regionField.value,\n postalCode: this.postalCodeField.value,\n countryCodeAlpha2: this.countryCodeAlpha2Field.value,\n });\n }\n\n get contactInfo(): CustomerInfo {\n return new CustomerInfo({\n email: this.emailField.value,\n firstName: this.firstNameField.value,\n lastName: this.lastNameField.value,\n });\n }\n\n /**\n * The element renders into the light DOM, so instead of a `styles` block\n * it writes its own `<style>` tag, with every selector prefixed by the tag\n * name so nothing leaks onto the rest of the page.\n */\n private get getStyles(): TemplateResult {\n const noIconSpacerWidth = css`var(--ia-donation-badged-input-no-icon-spacer-width, calc(var(--donation-contact-base-font-size--) * 3))`;\n\n return html`\n <style>\n ia-donation-contact-form {\n --donation-contact-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n --donation-contact-row-gap--: var(\n --ia-donation-field-row-gap,\n calc(var(--donation-contact-base-font-size--) * 0.5)\n );\n --donation-contact-field-font-family--: var(\n --ia-theme-base-font-family,\n 'Helvetica Neue',\n Helvetica,\n Arial,\n sans-serif\n );\n --donation-contact-field-font-size--: var(\n --ia-donation-contact-field-font-size,\n calc(var(--donation-contact-base-font-size--) * 1.4)\n );\n --donation-contact-field-font-color--: var(\n --ia-donation-form-input-font-color,\n #2c2c2c\n );\n --donation-contact-label-font-family--: var(\n --ia-donation-field-label-font-family,\n var(--donation-contact-field-font-family--)\n );\n --donation-contact-label-font-size--: var(\n --ia-donation-field-label-font-size,\n calc(var(--donation-contact-base-font-size--) * 1.4)\n );\n --donation-contact-label-color--: var(\n --ia-donation-field-label-color,\n #2c2c2c\n );\n --donation-contact-label-margin-bottom--: var(\n --ia-donation-field-label-margin-bottom,\n calc(var(--donation-contact-base-font-size--) * 0.5)\n );\n --donation-contact-required-color--: var(\n --ia-donation-badged-input-required-color,\n var(--ia-theme-color-danger, #e51c23)\n );\n --donation-contact-error-color--: var(\n --ia-theme-color-danger,\n #e51c23\n );\n --donation-contact-no-icon-field-width--: calc(\n 100% - ${noIconSpacerWidth}\n );\n }\n\n /*\n A grid, so a label that wraps to two lines in one column doesn't push\n that column's input out of line with its siblings. All labels share\n row line 1 and all inputs share row line 2, each sized to the tallest\n content on its line.\n */\n ia-donation-contact-form .row {\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 1fr;\n grid-template-rows: auto auto;\n column-gap: var(--donation-contact-row-gap--);\n }\n\n /*\n State / Province gives up room to Zip / Postal Code so the\n \"Zip / Postal Code *\" label stays on one line.\n */\n ia-donation-contact-form .row.region-postal-row {\n grid-template-columns:\n calc(60% - var(--donation-contact-base-font-size--) * 3)\n calc(40% + var(--donation-contact-base-font-size--) * 3);\n }\n\n ia-donation-contact-form .row + .row {\n margin-top: var(--donation-contact-row-gap--);\n }\n\n ia-donation-contact-form .field {\n display: contents;\n }\n\n ia-donation-contact-form .field-label {\n display: block;\n font-family: var(--donation-contact-label-font-family--);\n font-size: var(--donation-contact-label-font-size--);\n font-weight: bold;\n color: var(--donation-contact-label-color--);\n margin-bottom: var(--donation-contact-label-margin-bottom--);\n }\n\n ia-donation-contact-form .required-asterisk {\n color: var(--donation-contact-required-color--);\n }\n\n ia-donation-contact-form\n ia-donation-badged-input.donation-contact-form-region,\n ia-donation-contact-form\n ia-donation-badged-input.donation-contact-form-postal-code {\n width: 100%;\n }\n\n ia-donation-contact-form #donation-contact-form-error-message {\n color: var(--donation-contact-error-color--);\n font-size: calc(var(--donation-contact-base-font-size--) * 1.4);\n margin-bottom: calc(var(--donation-contact-base-font-size--) * 0.6);\n }\n\n ia-donation-contact-form .donation-contact-form-input {\n width: var(--donation-contact-no-icon-field-width--);\n border: 0;\n outline: 0;\n background: transparent;\n font-weight: bold;\n color: var(--donation-contact-field-font-color--);\n font-size: var(--donation-contact-field-font-size--);\n padding: 0;\n font-family: var(--donation-contact-field-font-family--);\n }\n\n ia-donation-contact-form #donation-contact-form-countryCodeAlpha2 {\n width: var(--donation-contact-no-icon-field-width--);\n height: 100%;\n box-sizing: border-box;\n font-weight: bold;\n font-size: var(--donation-contact-field-font-size--);\n color: var(--donation-contact-field-font-color--);\n font-family: var(--donation-contact-field-font-family--);\n border: 0;\n background: #fff;\n }\n </style>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ia-donation-contact-form.js","sourceRoot":"","sources":["../../../../../../src/elements/ia-donation-form/form-elements/contact-form/ia-donation-contact-form.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EACL,WAAW,EACX,YAAY,EACZ,gBAAgB,GACj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CACF,CAAA;AA7dC;IADC,KAAK,CAAC,sDAAsD,CAAC;+DACrB;AACF;IAAtC,KAAK,CAAC,8BAA8B,CAAC;yDAA+B;AAGrE;IADC,KAAK,CAAC,2DAA2D,CAAC;mEACtB;AACD;IAA3C,KAAK,CAAC,mCAAmC,CAAC;6DAAmC;AAG9E;IADC,KAAK,CAAC,0DAA0D,CAAC;kEACtB;AACD;IAA1C,KAAK,CAAC,kCAAkC,CAAC;4DAAkC;AAG5E;IADC,KAAK,CAAC,4DAA4D,CAAC;gEAC1B;AAE1C;IADC,KAAK,CAAC,oCAAoC,CAAC;8DACT;AAGnC;IADC,KAAK,CAAC,+DAA+D,CAAC;uEACtB;AAEjD;IADC,KAAK,CAAC,uCAAuC,CAAC;iEACT;AAGtC;IADC,KAAK,CAAC,yDAAyD,CAAC;kEACrB;AACF;IAAzC,KAAK,CAAC,iCAAiC,CAAC;4DAAkC;AAG3E;IADC,KAAK,CAAC,uDAAuD,CAAC;gEACrB;AACF;IAAvC,KAAK,CAAC,+BAA+B,CAAC;0DAAgC;AAGvE;IADC,KAAK,CAAC,0CAA0C,CAAC;qEACP;AAEI;IAA9C,KAAK,CAAC,sCAAsC,CAAC;2DAA+B;AAC9D;IAAd,KAAK,CAAC,MAAM,CAAC;mDAAwB;AAGV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAwB;AAGvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAiB;AAzCjC,qBAAqB;IAFjC,aAAa,CAAC,0BAA0B,CAAC;IACzC,SAAS,EAAE;GACC,qBAAqB,CA+djC","sourcesContent":["import {\n css,\n html,\n LitElement,\n nothing,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { localized, msg } from '@lit/localize';\n\nimport {\n BillingInfo,\n CustomerInfo,\n DonorContactInfo,\n} from '../../models/donor-contact-info';\nimport {\n SpacerOption,\n type IADonationBadgedInput,\n} from '../ia-donation-badged-input';\nimport '../ia-donation-badged-input';\nimport type { AutoCompleteFieldOptions } from './autocomplete-field-options';\nimport { countries } from './countries';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { localizedCountries } from '../../localized-format';\n\n/**\n * The donor's name, email and billing address.\n *\n * This renders into the light DOM, not a shadow root: browser autofill\n * doesn't reach into shadow DOM, and autofill matters a lot on a donation\n * form. So its styles are a `<style>` block with every selector prefixed by\n * the tag name, and its field ids are unique across the page.\n */\n@customElement('ia-donation-contact-form')\n@localized()\nexport class IADonationContactForm extends LitElement {\n @query('ia-donation-badged-input.donation-contact-form-email')\n emailBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-email') emailField!: HTMLInputElement;\n\n @query('ia-donation-badged-input.donation-contact-form-first-name')\n firstNameBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-first-name') firstNameField!: HTMLInputElement;\n\n @query('ia-donation-badged-input.donation-contact-form-last-name')\n lastNameBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-last-name') lastNameField!: HTMLInputElement;\n\n @query('ia-donation-badged-input.donation-contact-form-postal-code')\n postalBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-postal-code')\n postalCodeField!: HTMLInputElement;\n\n @query('ia-donation-badged-input.donation-contact-form-street-address')\n streetAddressBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-street-address')\n streetAddressField!: HTMLInputElement;\n\n @query('ia-donation-badged-input.donation-contact-form-locality')\n localityBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-locality') localityField!: HTMLInputElement;\n\n @query('ia-donation-badged-input.donation-contact-form-region')\n regionBadgedInput!: IADonationBadgedInput;\n @query('#donation-contact-form-region') regionField!: HTMLInputElement;\n\n @query('#donation-contact-form-countryCodeAlpha2')\n countryCodeAlpha2Field!: HTMLSelectElement;\n\n @query('#donation-contact-form-error-message') errorMessage!: HTMLDivElement;\n @query('form') form!: HTMLFormElement;\n\n /** A key of `countries`. US addresses require a state and a zip code. */\n @property({ type: String }) selectedCountry = 'US';\n\n /** Pre-fills the email field, for a logged-in donor */\n @property({ type: String }) donorEmail = '';\n\n updated(changed: PropertyValues): void {\n if (changed.has('donorEmail')) {\n this.emailField.value = this.donorEmail ?? '';\n }\n }\n\n /** Validates every field, marks the bad ones, and shows the browser's messages. */\n reportValidity(): boolean {\n this.validateFormFields();\n return this.validateForm();\n }\n\n private validateFormFields(): void {\n const fields: {\n badgedInput: IADonationBadgedInput;\n inputField: HTMLInputElement;\n }[] = [\n { badgedInput: this.emailBadgedInput, inputField: this.emailField },\n {\n badgedInput: this.firstNameBadgedInput,\n inputField: this.firstNameField,\n },\n { badgedInput: this.lastNameBadgedInput, inputField: this.lastNameField },\n {\n badgedInput: this.streetAddressBadgedInput,\n inputField: this.streetAddressField,\n },\n { badgedInput: this.localityBadgedInput, inputField: this.localityField },\n { badgedInput: this.regionBadgedInput, inputField: this.regionField },\n { badgedInput: this.postalBadgedInput, inputField: this.postalCodeField },\n ];\n fields.forEach(({ badgedInput, inputField }) => {\n badgedInput.error = !inputField.checkValidity();\n });\n }\n\n private validateForm(): boolean {\n const isValid = this.form.reportValidity();\n\n this.errorMessage.textContent = isValid\n ? ''\n : msg('Please enter any missing or invalid contact information below');\n\n return isValid;\n }\n\n focus(): void {\n this.emailField.focus();\n }\n\n /** At least two non-whitespace characters */\n private minTwoCharPattern = '.*\\\\S{2,}.*';\n private get minTwoCharValidationMessage(): string {\n return msg('Enter at least two characters');\n }\n\n /** At least two non-whitespace characters with at least two characters between them */\n private streetAddressPattern = '.*?\\\\S.{2,}\\\\S.*?';\n private get streetAddressValidationMessage(): string {\n return msg('Enter at least four characters');\n }\n\n /** 12345, 12345-6789 or 123456789 */\n private usZipCodePattern = '^\\\\d{5}(-?\\\\d{4})?$';\n private get usZipCodeValidationMessage(): string {\n return msg('Enter a valid 5 or 9 digit zip/postal code');\n }\n\n render(): TemplateResult {\n return html`\n <div id=\"donation-contact-form-error-message\"></div>\n <form>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-email',\n label: msg('Email'),\n required: true,\n fieldType: 'email',\n name: 'email',\n autocomplete: 'email',\n minlength: 5,\n maxlength: 255,\n })}\n </div>\n\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-first-name',\n label: msg('First name'),\n name: 'fname',\n required: true,\n validationPattern: this.minTwoCharPattern,\n validationMessage: this.minTwoCharValidationMessage,\n maxlength: 255,\n autocomplete: 'given-name',\n })}\n ${this.generateInput({\n id: 'donation-contact-form-last-name',\n label: msg('Last name'),\n name: 'lname',\n autocomplete: 'family-name',\n required: true,\n validationPattern: this.minTwoCharPattern,\n validationMessage: this.minTwoCharValidationMessage,\n maxlength: 255,\n })}\n </div>\n\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-street-address',\n label: msg('Address'),\n required: true,\n autocomplete: 'address-line1',\n name: 'street-address',\n validationPattern: this.streetAddressPattern,\n validationMessage: this.streetAddressValidationMessage,\n })}\n </div>\n <div class=\"row\">\n ${this.generateInput({\n id: 'donation-contact-form-locality',\n label: msg('City'),\n autocomplete: 'address-level2',\n required: true,\n name: 'locality',\n validationPattern: this.minTwoCharPattern,\n validationMessage: this.minTwoCharValidationMessage,\n })}\n </div>\n <div class=\"row\">${this.countrySelectorTemplate}</div>\n <div class=\"row region-postal-row\">\n ${this.generateInput({\n id: 'donation-contact-form-region',\n label: msg('State / Province'),\n autocomplete: 'address-level1',\n required: this.regionAndPostalCodeRequired,\n name: 'region',\n validationPattern: this.regionAndPostalCodeRequired\n ? this.minTwoCharPattern\n : undefined,\n validationMessage: this.regionAndPostalCodeRequired\n ? this.minTwoCharValidationMessage\n : undefined,\n })}\n ${this.generateInput({\n id: 'donation-contact-form-postal-code',\n label: msg('Zip / Postal Code'),\n autocomplete: 'postal-code',\n required: this.regionAndPostalCodeRequired,\n name: 'postal',\n validationPattern: this.regionAndPostalCodeRequired\n ? this.usZipCodePattern\n : undefined,\n validationMessage: this.regionAndPostalCodeRequired\n ? this.usZipCodeValidationMessage\n : undefined,\n })}\n </div>\n </form>\n ${this.getStyles}\n `;\n }\n\n private get regionAndPostalCodeRequired(): boolean {\n return this.selectedCountry === 'US';\n }\n\n private get countrySelectorTemplate(): TemplateResult {\n return html`\n <div class=\"field\">\n <label\n for=\"donation-contact-form-countryCodeAlpha2\"\n class=\"field-label\"\n >\n ${msg('Country')}<span class=\"required-asterisk\"> *</span>\n </label>\n <ia-donation-badged-input\n .iconSpaceOption=${SpacerOption.CompressSpace}\n >\n <select\n id=\"donation-contact-form-countryCodeAlpha2\"\n name=\"country\"\n autocomplete=\"country\"\n @change=${(e: Event) => {\n const newValue = (e.target as HTMLSelectElement).value;\n if (countries[newValue]) this.selectedCountry = newValue;\n }}\n >\n ${repeat(\n localizedCountries(),\n ([key]) => key,\n ([key, name]) => html`\n <option value=${key} ?selected=${key === this.selectedCountry}>\n ${name}\n </option>\n `,\n )}\n </select>\n </ia-donation-badged-input>\n </div>\n `;\n }\n\n /** Light DOM, so browser autofill can reach the fields */\n createRenderRoot(): this {\n return this;\n }\n\n /** Clears the error state once the donor starts fixing a field */\n private inputChanged(e: Event): void {\n this.errorMessage.textContent = '';\n const input = e.target as HTMLInputElement;\n const badgedInput = this.querySelector<IADonationBadgedInput>(\n `ia-donation-badged-input.${input.id}`,\n );\n if (badgedInput) badgedInput.error = false;\n }\n\n private generateInput(options: {\n id: string;\n label: string;\n required?: boolean;\n fieldType?: 'text' | 'email';\n autocomplete?: AutoCompleteFieldOptions;\n minlength?: number;\n maxlength?: number;\n name: string;\n validationPattern?: string;\n validationMessage?: string;\n }): TemplateResult {\n const required = options.required ?? true;\n const fieldType = options.fieldType ?? 'text';\n\n return html`\n <div class=\"field ${options.id}\">\n <label for=${options.id} class=\"field-label\">\n ${options.label}${required\n ? html`<span class=\"required-asterisk\"> *</span>`\n : nothing}\n </label>\n <ia-donation-badged-input\n class=${options.id}\n .iconSpaceOption=${SpacerOption.CompressSpace}\n .requiredIndicatorSpaceOption=${SpacerOption.CompressSpace}\n >\n <input\n type=${fieldType}\n id=${options.id}\n class=\"donation-contact-form-input\"\n name=${options.name}\n maxlength=${ifDefined(options.maxlength)}\n minlength=${ifDefined(options.minlength)}\n autocomplete=${options.autocomplete ?? 'on'}\n pattern=${ifDefined(options.validationPattern)}\n title=${ifDefined(options.validationMessage)}\n @input=${this.inputChanged}\n ?required=${required}\n />\n </ia-donation-badged-input>\n </div>\n `;\n }\n\n get donorContactInfo(): DonorContactInfo {\n return new DonorContactInfo({\n billing: this.billingInfo,\n customer: this.contactInfo,\n });\n }\n\n get billingInfo(): BillingInfo {\n return new BillingInfo({\n streetAddress: this.streetAddressField.value,\n locality: this.localityField.value,\n region: this.regionField.value,\n postalCode: this.postalCodeField.value,\n countryCodeAlpha2: this.countryCodeAlpha2Field.value,\n });\n }\n\n get contactInfo(): CustomerInfo {\n return new CustomerInfo({\n email: this.emailField.value,\n firstName: this.firstNameField.value,\n lastName: this.lastNameField.value,\n });\n }\n\n /**\n * The element renders into the light DOM, so instead of a `styles` block\n * it writes its own `<style>` tag, with every selector prefixed by the tag\n * name so nothing leaks onto the rest of the page.\n */\n private get getStyles(): TemplateResult {\n const noIconSpacerWidth = css`var(--ia-donation-badged-input-no-icon-spacer-width, calc(var(--donation-contact-base-font-size--) * 3))`;\n\n return html`\n <style>\n ia-donation-contact-form {\n --donation-contact-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n --donation-contact-row-gap--: var(\n --ia-donation-field-row-gap,\n calc(var(--donation-contact-base-font-size--) * 0.5)\n );\n --donation-contact-field-font-family--: var(\n --ia-theme-base-font-family,\n 'Helvetica Neue',\n Helvetica,\n Arial,\n sans-serif\n );\n --donation-contact-field-font-size--: var(\n --ia-donation-contact-field-font-size,\n calc(var(--donation-contact-base-font-size--) * 1.4)\n );\n --donation-contact-field-font-color--: var(\n --ia-donation-form-input-font-color,\n #2c2c2c\n );\n --donation-contact-label-font-family--: var(\n --ia-donation-field-label-font-family,\n var(--donation-contact-field-font-family--)\n );\n --donation-contact-label-font-size--: var(\n --ia-donation-field-label-font-size,\n calc(var(--donation-contact-base-font-size--) * 1.4)\n );\n --donation-contact-label-color--: var(\n --ia-donation-field-label-color,\n #2c2c2c\n );\n --donation-contact-label-margin-bottom--: var(\n --ia-donation-field-label-margin-bottom,\n calc(var(--donation-contact-base-font-size--) * 0.5)\n );\n --donation-contact-required-color--: var(\n --ia-donation-badged-input-required-color,\n var(--ia-theme-color-danger, #e51c23)\n );\n --donation-contact-error-color--: var(\n --ia-theme-color-danger,\n #e51c23\n );\n --donation-contact-no-icon-field-width--: calc(\n 100% - ${noIconSpacerWidth}\n );\n }\n\n /*\n A grid, so a label that wraps to two lines in one column doesn't push\n that column's input out of line with its siblings. All labels share\n row line 1 and all inputs share row line 2, each sized to the tallest\n content on its line.\n */\n ia-donation-contact-form .row {\n display: grid;\n grid-auto-flow: column;\n grid-auto-columns: 1fr;\n grid-template-rows: auto auto;\n column-gap: var(--donation-contact-row-gap--);\n }\n\n /*\n State / Province gives up room to Zip / Postal Code so the\n \"Zip / Postal Code *\" label stays on one line.\n */\n ia-donation-contact-form .row.region-postal-row {\n grid-template-columns:\n calc(60% - var(--donation-contact-base-font-size--) * 3)\n calc(40% + var(--donation-contact-base-font-size--) * 3);\n }\n\n ia-donation-contact-form .row + .row {\n margin-top: var(--donation-contact-row-gap--);\n }\n\n ia-donation-contact-form .field {\n display: contents;\n }\n\n ia-donation-contact-form .field-label {\n display: block;\n font-family: var(--donation-contact-label-font-family--);\n font-size: var(--donation-contact-label-font-size--);\n font-weight: bold;\n color: var(--donation-contact-label-color--);\n margin-bottom: var(--donation-contact-label-margin-bottom--);\n }\n\n ia-donation-contact-form .required-asterisk {\n color: var(--donation-contact-required-color--);\n }\n\n ia-donation-contact-form\n ia-donation-badged-input.donation-contact-form-region,\n ia-donation-contact-form\n ia-donation-badged-input.donation-contact-form-postal-code {\n width: 100%;\n }\n\n ia-donation-contact-form #donation-contact-form-error-message {\n color: var(--donation-contact-error-color--);\n font-size: calc(var(--donation-contact-base-font-size--) * 1.4);\n margin-bottom: calc(var(--donation-contact-base-font-size--) * 0.6);\n }\n\n ia-donation-contact-form .donation-contact-form-input {\n width: var(--donation-contact-no-icon-field-width--);\n border: 0;\n outline: 0;\n background: transparent;\n font-weight: bold;\n color: var(--donation-contact-field-font-color--);\n font-size: var(--donation-contact-field-font-size--);\n padding: 0;\n font-family: var(--donation-contact-field-font-family--);\n }\n\n ia-donation-contact-form #donation-contact-form-countryCodeAlpha2 {\n width: var(--donation-contact-no-icon-field-width--);\n height: 100%;\n box-sizing: border-box;\n font-weight: bold;\n font-size: var(--donation-contact-field-font-size--);\n color: var(--donation-contact-field-font-color--);\n font-family: var(--donation-contact-field-font-family--);\n border: 0;\n background: #fff;\n }\n </style>\n `;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-edit-donation.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"ia-donation-edit-donation.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEV,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AASb,OAAO,EACL,mBAAmB,EAGpB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,uBAAuB,CAAC;AAE/B,6DAA6D;AAC7D,eAAO,MAAM,0BAA0B;;;CAG7B,CAAC;AAEX,MAAM,MAAM,0BAA0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, query, state } from 'lit/decorators.js';
|
|
4
4
|
import { customElement } from '../../../utils/custom-element.js';
|
|
5
|
-
import { msg, str } from '@lit/localize';
|
|
5
|
+
import { localized, msg, str } from '@lit/localize';
|
|
6
6
|
import currency from 'currency.js';
|
|
7
|
+
import { formatUsd } from '../localized-format.js';
|
|
7
8
|
import themeStyles from '../../../themes/theme-styles.js';
|
|
8
9
|
import { CurrencyValidator } from '../currency-validator.js';
|
|
9
10
|
import { DonationPaymentInfo, defaultDonationAmounts, defaultSelectedDonationInfo, } from '../models/donation-payment-info.js';
|
|
@@ -267,9 +268,7 @@ let IADonationEditDonation = class IADonationEditDonation extends LitElement {
|
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
270
|
get coverFeesText() {
|
|
270
|
-
const feeAmountString =
|
|
271
|
-
symbol: '$',
|
|
272
|
-
}).format();
|
|
271
|
+
const feeAmountString = formatUsd(this.donationInfo.fee);
|
|
273
272
|
return msg(str `I'll generously add ${feeAmountString} to cover fees.`);
|
|
274
273
|
}
|
|
275
274
|
/**
|
|
@@ -278,7 +277,7 @@ let IADonationEditDonation = class IADonationEditDonation extends LitElement {
|
|
|
278
277
|
*/
|
|
279
278
|
formatShortenedAmount(dollars) {
|
|
280
279
|
const precision = dollars % 1 === 0 ? 0 : 2;
|
|
281
|
-
return
|
|
280
|
+
return formatUsd(dollars, precision);
|
|
282
281
|
}
|
|
283
282
|
get frequencyTemplate() {
|
|
284
283
|
return html `
|
|
@@ -768,7 +767,8 @@ __decorate([
|
|
|
768
767
|
query('#custom-amount-input')
|
|
769
768
|
], IADonationEditDonation.prototype, "customAmountInput", void 0);
|
|
770
769
|
IADonationEditDonation = __decorate([
|
|
771
|
-
customElement('ia-donation-edit-donation')
|
|
770
|
+
customElement('ia-donation-edit-donation'),
|
|
771
|
+
localized()
|
|
772
772
|
], IADonationEditDonation);
|
|
773
773
|
export { IADonationEditDonation };
|
|
774
774
|
//# sourceMappingURL=ia-donation-edit-donation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-edit-donation.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,OAAO,GAIR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,uBAAuB,CAAC;AAE/B,6DAA6D;AAC7D,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;CAClB,CAAC;AAKX,2CAA2C;AAC3C,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,YAAY,EAAE,cAAc;IAC5B,MAAM,EAAE,QAAQ;CACR,CAAC;AAKX,kFAAkF;AAClF,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,mBAAmB,EAAE,uBAAuB;IAC5C,qBAAqB,EAAE,yBAAyB;IAChD,eAAe,EAAE,mBAAmB;IACpC,cAAc,EAAE,kBAAkB;CAC1B,CAAC;AAKX,sDAAsD;AACtD,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAChD,MAAM,EAAE,QAAQ;IAChB,QA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;;;;;;;;;;;;;;;;;OAiNF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA7wBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DACqC;AAGhE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAEc;AAMb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAAgC;AAEhC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;6DAAkD;AAG5E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAEmB;AAG9C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sEAEE;AAED;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gEAEnB;AAEoB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qEAEnB;AAGoB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sEAEnB;AAEN;IAAhB,KAAK,EAAE;qDAAgC;AAEvB;IAAhB,KAAK,EAAE;oEAAsC;AAEN;IAAvC,KAAK,CAAC,uBAAuB,CAAC;kEAA+C;AAEvC;IAAtC,KAAK,CAAC,sBAAsB,CAAC;iEAA8C;AA3CjE,sBAAsB;IADlC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,sBAAsB,CA+wBlC","sourcesContent":["import {\n css,\n html,\n LitElement,\n nothing,\n type CSSResultGroup,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport { msg, str } from '@lit/localize';\nimport currency from 'currency.js';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport { CurrencyValidator } from '../currency-validator';\nimport {\n DonationPaymentInfo,\n defaultDonationAmounts,\n defaultSelectedDonationInfo,\n} from '../models/donation-payment-info';\nimport { DonationType } from '../models/donation-type';\nimport { DonationSectionBadgeMode } from './ia-donation-section';\nimport './ia-donation-section';\n\n/** Whether the numbered step badges show on the sections. */\nexport const EditDonationStepNumberMode = {\n HideNumbers: 'hidenumbers',\n ShowNumbers: 'shownumbers',\n} as const;\n\nexport type EditDonationStepNumberMode =\n (typeof EditDonationStepNumberMode)[keyof typeof EditDonationStepNumberMode];\n\n/** The radio button groups in the form. */\nexport const EditDonationSelectionGroup = {\n DonationType: 'donationType',\n Amount: 'amount',\n} as const;\n\nexport type EditDonationSelectionGroup =\n (typeof EditDonationSelectionGroup)[keyof typeof EditDonationSelectionGroup];\n\n/** The outcome of validating an amount. Sent in the `editDonationError` event. */\nexport const EditDonationInfoStatus = {\n ValidDonationAmount: 'valid_donation_amount',\n InvalidDonationAmount: 'invalid_donation_amount',\n DonationTooHigh: 'donation_too_high',\n DonationTooLow: 'donation_too_low',\n} as const;\n\nexport type EditDonationInfoStatus =\n (typeof EditDonationInfoStatus)[keyof typeof EditDonationInfoStatus];\n\n/** How the one-time / monthly choice is presented. */\nexport const EditDonationFrequencySelectionMode = {\n Button: 'button',\n Checkbox: 'checkbox',\n Hide: 'hide',\n} as const;\n\nexport type EditDonationFrequencySelectionMode =\n (typeof EditDonationFrequencySelectionMode)[keyof typeof EditDonationFrequencySelectionMode];\n\n/** Whether the amount buttons wrap onto several lines or stay on one. */\nexport const EditDonationAmountSelectionLayout = {\n SingleLine: 'single-line',\n MultiLine: 'multi-line',\n} as const;\n\nexport type EditDonationAmountSelectionLayout =\n (typeof EditDonationAmountSelectionLayout)[keyof typeof EditDonationAmountSelectionLayout];\n\n/**\n * The part of the donation form where the donor picks a frequency, an amount\n * (preset or custom) and whether to cover the processing fee. Fires\n * `donationInfoChanged` with the new `DonationPaymentInfo` on every change\n * and `editDonationError` when a custom amount is out of range.\n *\n * The petabox donation banner uses this on its own, without the rest of the\n * form.\n */\n@customElement('ia-donation-edit-donation')\nexport class IADonationEditDonation extends LitElement {\n @property({ type: Object })\n donationInfo: DonationPaymentInfo = defaultSelectedDonationInfo;\n\n @property({ type: String })\n stepNumberMode: EditDonationStepNumberMode =\n EditDonationStepNumberMode.ShowNumbers;\n\n /**\n * A convenience for setting the selected amount from plain HTML. When\n * present it wins over `donationInfo`.\n */\n @property({ type: Number }) defaultSelectedAmount?: number;\n\n @property({ type: Array }) amountOptions: number[] = defaultDonationAmounts;\n\n @property({ type: String })\n amountSelectionLayout: EditDonationAmountSelectionLayout =\n EditDonationAmountSelectionLayout.MultiLine;\n\n @property({ type: String, reflect: true })\n frequencySelectionMode: EditDonationFrequencySelectionMode =\n EditDonationFrequencySelectionMode.Button;\n\n @property({ type: String, reflect: true }) customAmountMode:\n | 'display'\n | 'hide' = 'display';\n\n @property({ type: String, reflect: true }) coverFeesCheckboxMode:\n | 'display'\n | 'hide' = 'display';\n\n /** `slot` renders the `edit-donation-amount-title` slot in place of the default headline. */\n @property({ type: String, reflect: true }) amountTitleDisplayMode:\n | 'default'\n | 'slot' = 'default';\n\n @state() private error?: TemplateResult;\n\n @state() private customAmountSelected = false;\n\n @query('#custom-amount-button') private customAmountButton!: HTMLInputElement;\n\n @query('#custom-amount-input') private customAmountInput!: HTMLInputElement;\n\n private currencyValidator: CurrencyValidator = new CurrencyValidator();\n\n render(): TemplateResult {\n const amountTitle =\n this.amountTitleDisplayMode === 'default'\n ? msg('Choose an amount (USD)')\n : '';\n return html`\n ${this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Button\n ? this.frequencyButtonsTemplate\n : nothing}\n\n <ia-donation-section\n sectionBadge=\"${this.amountSelectionSectionNumber}\"\n headline=${amountTitle}\n badgeMode=${this.formSectionNumberMode}\n >\n ${this.amountTitleDisplayMode === 'slot'\n ? html`<slot name=\"edit-donation-amount-title\"></slot>`\n : nothing}\n <ul class=\"amount-selector\">\n ${this.presetAmountsTemplate}\n ${this.customAmountMode === 'display'\n ? html`<li class=\"custom-amount\">${this.customAmountTemplate}</li>`\n : nothing}\n </ul>\n\n <div class=\"errors\" id=\"amount-errors\" aria-live=\"polite\">\n ${this.error}\n </div>\n\n ${this.coverFeesCheckboxMode === 'display'\n ? html`<div class=\"checkbox-options\">\n ${this.coverFeesCheckboxTemplate}\n ${this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Checkbox\n ? this.frequencyCheckboxTemplate\n : nothing}\n </div>`\n : nothing}\n </ia-donation-section>\n `;\n }\n\n updated(changedProperties: PropertyValues): void {\n if (changedProperties.has('customAmountSelected')) {\n if (this.customAmountButton) {\n this.customAmountButton.checked = this.customAmountSelected;\n }\n }\n if (changedProperties.has('amountOptions')) {\n this.customAmountSelected = false;\n this.updateSelectedDonationInfo();\n this.setupAmountColumnsLayoutConfig();\n }\n if (changedProperties.has('amountSelectionLayout')) {\n this.setupAmountColumnsLayoutConfig();\n }\n if (changedProperties.has('donationInfo')) {\n this.updateSelectedDonationInfo();\n }\n if (\n changedProperties.has('defaultSelectedAmount') &&\n this.defaultSelectedAmount !== undefined\n ) {\n this.customAmountSelected = false;\n this.donationInfo = new DonationPaymentInfo({\n donationType: this.donationInfo.donationType,\n amount: this.defaultSelectedAmount,\n coverFees: this.donationInfo.coverFees,\n });\n }\n }\n\n private get frequencyButtonsTemplate(): TemplateResult {\n return html`\n <ia-donation-section\n sectionBadge=\"1\"\n headline=${msg('Choose a frequency')}\n badgeMode=${this.formSectionNumberMode}\n >\n <ul class=\"frequency-selector\">\n ${this.frequencyTemplate}\n </ul>\n </ia-donation-section>\n `;\n }\n\n private get frequencyCheckboxTemplate(): TemplateResult {\n return html`\n <div class=\"checkbox-option-container\">\n <input\n type=\"checkbox\"\n id=\"make-this-monthly\"\n @input=${this.monthlyCheckboxChecked}\n .checked=${this.donationInfo.donationType === DonationType.Monthly}\n tabindex=\"0\"\n />\n <label for=\"make-this-monthly\">${msg('Make this monthly')}</label>\n </div>\n `;\n }\n\n private get coverFeesCheckboxTemplate(): TemplateResult {\n return html`\n <div class=\"checkbox-option-container\">\n <input\n type=\"checkbox\"\n id=\"cover-fees\"\n @input=${this.coverFeesChecked}\n .checked=${this.donationInfo.coverFees}\n tabindex=\"0\"\n />\n <label for=\"cover-fees\">${this.coverFeesText}</label>\n </div>\n `;\n }\n\n /** The amount step is 2 when the frequency buttons come first, otherwise 1. */\n private get amountSelectionSectionNumber(): number {\n return this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Button\n ? 2\n : 1;\n }\n\n private get formSectionNumberMode(): DonationSectionBadgeMode {\n switch (this.stepNumberMode) {\n case EditDonationStepNumberMode.ShowNumbers:\n return DonationSectionBadgeMode.ShowBadge;\n case EditDonationStepNumberMode.HideNumbers:\n return DonationSectionBadgeMode.HideBadge;\n }\n }\n\n /**\n * Picks the amount grid's column count, and how many columns the custom\n * amount field spans, from how many preset amounts there are.\n */\n private setupAmountColumnsLayoutConfig(): void {\n const minimalView =\n this.customAmountMode === 'hide' &&\n this.coverFeesCheckboxMode === 'hide' &&\n this.frequencySelectionMode === EditDonationFrequencySelectionMode.Hide;\n const amountCount = this.amountOptions.length;\n let columnCount = 5;\n let customAmountSpan = 3;\n switch (amountCount) {\n case 7:\n columnCount = 5;\n customAmountSpan = 3;\n break;\n case 6:\n columnCount = 4;\n customAmountSpan = 2;\n break;\n case 5:\n columnCount = 4;\n customAmountSpan = 3;\n break;\n case 4:\n if (minimalView) {\n columnCount = 4;\n customAmountSpan = 0;\n break;\n }\n columnCount = 3;\n customAmountSpan = 2;\n break;\n case 3:\n columnCount = 2;\n customAmountSpan = 1;\n break;\n }\n\n if (\n this.amountSelectionLayout ===\n EditDonationAmountSelectionLayout.SingleLine\n ) {\n columnCount = amountCount + 3;\n customAmountSpan = 3;\n }\n\n this.style.setProperty(\n '--ia-donation-edit-amount-column-count',\n `${columnCount}`,\n );\n this.style.setProperty(\n '--ia-donation-edit-custom-amount-col-span',\n `${customAmountSpan}`,\n );\n }\n\n /**\n * Syncs the radios and the custom field with `donationInfo`. A preset\n * amount checks its radio and clears the custom field; anything else\n * selects the custom field and formats the amount into it.\n */\n private updateSelectedDonationInfo(): void {\n // Keep the custom amount selected while the donor is typing in it, even\n // if the value matches a preset, so the selection doesn't jump to the\n // preset radio mid-keystroke.\n // With the custom field hidden both sides would be null, so guard on it\n // existing first.\n const typingInCustomAmount =\n !!this.customAmountInput &&\n this.shadowRoot?.activeElement === this.customAmountInput;\n if (\n !this.isCustomAmount &&\n !(this.customAmountSelected && typingInCustomAmount)\n ) {\n const radioButton = this.shadowRoot?.querySelector<HTMLInputElement>(\n `input[type=\"radio\"][name=\"${EditDonationSelectionGroup.Amount}\"][value=\"${this.donationInfo.amount}\"]`,\n );\n if (radioButton) radioButton.checked = true;\n this.customAmountSelected = false;\n this.error = undefined;\n if (this.customAmountInput) {\n this.customAmountInput.value = '';\n }\n } else {\n this.customAmountSelected = true;\n // Leave the field alone while it has focus, the donor may be typing\n if (!typingInCustomAmount && this.customAmountInput) {\n this.customAmountInput.value = this.customAmountDisplayValue;\n const donationInfoStatus = this.getDonationInfoStatus(\n this.donationInfo.amount,\n );\n this.handleDonationInfoStatus(donationInfoStatus);\n }\n }\n }\n\n private get coverFeesText(): string {\n const feeAmountString = currency(this.donationInfo.fee, {\n symbol: '$',\n }).format();\n\n return msg(str`I'll generously add ${feeAmountString} to cover fees.`);\n }\n\n /**\n * Formats a dollar amount without cents when it's a whole number and with\n * them when it isn't: `$5` and `$5.50`.\n */\n private formatShortenedAmount(dollars: number): string {\n const precision = dollars % 1 === 0 ? 0 : 2;\n return currency(dollars, { symbol: '$', precision }).format();\n }\n\n private get frequencyTemplate(): TemplateResult {\n return html`\n <li>\n ${this.getRadioButton({\n group: EditDonationSelectionGroup.DonationType,\n value: DonationType.OneTime,\n displayText: msg('One time'),\n checked: this.donationInfo.donationType === DonationType.OneTime,\n })}\n </li>\n\n <li>\n ${this.getRadioButton({\n group: EditDonationSelectionGroup.DonationType,\n value: DonationType.Monthly,\n displayText: msg('Monthly'),\n checked: this.donationInfo.donationType === DonationType.Monthly,\n })}\n </li>\n `;\n }\n\n private get presetAmountsTemplate(): TemplateResult {\n return html`\n ${this.amountOptions.map((amount) => {\n const checked =\n !this.customAmountSelected && amount === this.donationInfo.amount;\n\n return html`\n <li>\n ${this.getRadioButton({\n group: EditDonationSelectionGroup.Amount,\n value: `${amount}`,\n displayText: this.formatShortenedAmount(amount),\n checked,\n })}\n </li>\n `;\n })}\n `;\n }\n\n private getRadioButton(options: {\n group: EditDonationSelectionGroup;\n value: string;\n displayText: string;\n checked: boolean;\n }): TemplateResult {\n const radioId = `${options.group}-${options.value}-option`;\n return html`\n <div class=\"selection-button\">\n <input\n type=\"radio\"\n name=${options.group}\n value=${options.value}\n id=${radioId}\n tabindex=\"0\"\n .checked=${options.checked}\n @change=${this.radioSelected}\n @click=${(e: Event): void => {\n // `change` doesn't fire when the checked radio is clicked again,\n // so re-selecting the current amount is caught here. It matters\n // after a custom amount, which unchecks the presets visually.\n const isAmountSelection =\n options.group === EditDonationSelectionGroup.Amount;\n if (isAmountSelection) {\n const isSameValue =\n parseFloat(options.value) === this.donationInfo.amount;\n if (isSameValue) {\n this.radioSelected(e);\n }\n }\n }}\n />\n <label for=${radioId}>${options.displayText}</label>\n </div>\n `;\n }\n\n private get isCustomAmount(): boolean {\n return !this.amountOptions.includes(this.donationInfo.amount);\n }\n\n private get customAmountDisplayValue(): string {\n if (!this.isCustomAmount) return '';\n return currency(this.donationInfo.amount, { symbol: '' }).format();\n }\n\n private get customAmountTemplate(): TemplateResult {\n return html`\n <div class=\"selection-button\">\n <input\n type=\"radio\"\n name=${EditDonationSelectionGroup.Amount}\n value=\"custom\"\n id=\"custom-amount-button\"\n tabindex=\"0\"\n @change=${this.customRadioSelected}\n />\n\n <label for=\"custom-amount-button\">\n <span class=\"custom-amount-text\">${msg('Custom: $')}</span\n ><input\n type=\"text\"\n id=\"custom-amount-input\"\n tabindex=\"-1\"\n aria-label=${msg('Custom amount in dollars')}\n aria-describedby=\"amount-errors\"\n value=${this.customAmountDisplayValue}\n @input=${this.customAmountChanged}\n @keydown=${this.currencyValidator.keydown}\n @focus=${this.customAmountFocused}\n @blur=${this.customAmountBlurred}\n />\n </label>\n </div>\n `;\n }\n\n private customRadioSelected(): void {\n this.customAmountInput.focus();\n }\n\n private customAmountFocused(e: Event): void {\n const target = e.target as HTMLInputElement;\n this.customAmountSelected = true;\n this.handleCustomAmountInput(target.value);\n }\n\n /**\n * Once focus leaves the custom field the mid-keystroke protection is over,\n * so the UI re-syncs with `donationInfo`: a typed amount equal to a preset\n * moves to that preset, anything else gets re-formatted in place.\n */\n private customAmountBlurred(): void {\n this.updateSelectedDonationInfo();\n }\n\n private coverFeesChecked(e: Event): void {\n const target = e.target as HTMLInputElement;\n this.updateDonationInfo({ coverFees: target.checked });\n }\n\n private customAmountChanged(e: Event): void {\n const target = e.target as HTMLInputElement;\n this.customAmountSelected = true;\n this.handleCustomAmountInput(target.value);\n }\n\n private handleCustomAmountInput(value: string): void {\n const amount = parseFloat(value);\n if (isNaN(amount)) {\n this.dispatchEditDonationError(\n EditDonationInfoStatus.InvalidDonationAmount,\n );\n } else {\n this.amountChanged(amount);\n }\n }\n\n private handleDonationInfoStatus(status: EditDonationInfoStatus): void {\n switch (status) {\n case EditDonationInfoStatus.ValidDonationAmount:\n this.error = undefined;\n break;\n case EditDonationInfoStatus.DonationTooHigh:\n this.error = msg(html`\n To make a donation of $10,000 or more, please contact our philanthropy\n department at\n <a href=\"mailto:donations@archive.org\">donations@archive.org</a>\n `);\n this.dispatchEditDonationError(status);\n break;\n case EditDonationInfoStatus.DonationTooLow:\n if (this.customAmountInput.value.length > 0) {\n this.error = html`${msg('Please select an amount (minimum $1)')}`;\n }\n this.dispatchEditDonationError(status);\n break;\n case EditDonationInfoStatus.InvalidDonationAmount:\n this.error = html`${msg('Please enter a valid donation amount')}`;\n this.dispatchEditDonationError(status);\n break;\n }\n }\n\n private amountChanged(amount: number): void {\n const donationInfoStatus = this.getDonationInfoStatus(amount);\n this.handleDonationInfoStatus(donationInfoStatus);\n\n // Only a valid amount makes it into the donation info\n if (donationInfoStatus === EditDonationInfoStatus.ValidDonationAmount) {\n this.updateDonationInfo({ amount });\n }\n }\n\n private getDonationInfoStatus(amount: number): EditDonationInfoStatus {\n if (isNaN(amount)) {\n return EditDonationInfoStatus.InvalidDonationAmount;\n }\n\n if (amount >= 10000) {\n return EditDonationInfoStatus.DonationTooHigh;\n }\n\n if (amount < 1) {\n return EditDonationInfoStatus.DonationTooLow;\n }\n\n return EditDonationInfoStatus.ValidDonationAmount;\n }\n\n private radioSelected(e: Event): void {\n const radioButton = e.target as HTMLInputElement;\n const group = radioButton.name as EditDonationSelectionGroup;\n const { value } = radioButton;\n\n switch (group) {\n case EditDonationSelectionGroup.Amount:\n this.presetAmountChanged(parseFloat(value));\n break;\n case EditDonationSelectionGroup.DonationType:\n this.updateDonationInfo({ donationType: value as DonationType });\n break;\n default:\n break;\n }\n }\n\n private monthlyCheckboxChecked(e: Event): void {\n const isChecked = (e.target as HTMLInputElement).checked;\n const donationType = isChecked\n ? DonationType.Monthly\n : DonationType.OneTime;\n this.updateDonationInfo({ donationType });\n }\n\n private dispatchEditDonationError(error: EditDonationInfoStatus): void {\n const event = new CustomEvent('editDonationError', {\n detail: { error },\n });\n this.dispatchEvent(event);\n }\n\n private presetAmountChanged(amount: number): void {\n this.error = undefined;\n this.customAmountSelected = false;\n if (this.customAmountInput) {\n this.customAmountInput.value = '';\n }\n this.updateDonationInfo({ amount });\n }\n\n private updateDonationInfo(options: {\n donationType?: DonationType;\n amount?: number;\n coverFees?: boolean;\n }): void {\n const newDonationInfo = new DonationPaymentInfo({\n donationType: options.donationType ?? this.donationInfo.donationType,\n amount: options.amount ?? this.donationInfo.amount,\n coverFees: options.coverFees ?? this.donationInfo.coverFees,\n });\n\n this.donationInfo = newDonationInfo;\n\n const event = new CustomEvent('donationInfoChanged', {\n detail: { donationInfo: newDonationInfo },\n });\n this.dispatchEvent(event);\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n /*\n * The donation form was built for a 10px root font size. Sizing off\n * this base keeps the element self-contained, so it looks the same\n * whatever the page's root size is. Override it to rescale\n * everything, sections included.\n */\n --donation-edit-base-font-size--: var(\n --ia-donation-edit-base-font-size,\n 10px\n );\n\n --donation-edit-button-border-color--: var(\n --ia-donation-edit-button-border-color,\n var(--mid-gray)\n );\n --donation-edit-button-grid-gap--: var(\n --ia-donation-edit-button-grid-gap,\n var(--donation-edit-base-font-size--)\n );\n --donation-edit-button-font-size--: var(\n --ia-donation-edit-button-font-size,\n calc(var(--donation-edit-base-font-size--) * 1.6)\n );\n --donation-edit-button-font-color--: var(\n --ia-donation-edit-button-font-color,\n #000\n );\n --donation-edit-button-selected-font-color--: var(\n --ia-donation-edit-button-selected-font-color,\n #000\n );\n --donation-edit-button-selected-color--: var(\n --ia-donation-edit-button-selected-color,\n #f9bf3b\n );\n --donation-edit-button-focused-outline-color--: var(\n --ia-donation-edit-button-focused-outline-color,\n #7fb3f9\n );\n --donation-edit-button-color--: var(\n --ia-donation-edit-button-color,\n var(--true-white)\n );\n --donation-edit-cover-fees-font-size--: var(\n --ia-donation-edit-cover-fees-font-size,\n calc(var(--donation-edit-base-font-size--) * 1.2)\n );\n --donation-edit-cover-fees-font-weight--: var(\n --ia-donation-edit-cover-fees-font-weight,\n bold\n );\n --donation-edit-custom-amount-width--: var(\n --ia-donation-edit-custom-amount-width,\n calc(var(--donation-edit-base-font-size--) * 4)\n );\n --donation-edit-input-font-color--: var(\n --ia-donation-edit-input-font-color,\n var(--mid-gray)\n );\n --donation-edit-input-border--: var(\n --ia-donation-edit-input-border,\n 1px solid #d9d9d9\n );\n /* These two are set on the host by the element itself, from the number of amounts */\n --donation-edit-amount-column-count--: var(\n --ia-donation-edit-amount-column-count,\n 5\n );\n --donation-edit-custom-amount-col-span--: var(\n --ia-donation-edit-custom-amount-col-span,\n 3\n );\n --donation-edit-error-color--: var(--color-danger);\n\n /* Passed through to the sections */\n --ia-donation-section-base-font-size: var(\n --donation-edit-base-font-size--\n );\n --ia-donation-section-background-color: var(\n --ia-donation-edit-background-color,\n transparent\n );\n --ia-donation-section-badge-background-color: var(\n --ia-donation-edit-badge-background-color,\n var(--mid-gray)\n );\n --ia-donation-section-badge-font-color: var(\n --ia-donation-edit-badge-font-color,\n var(--true-white)\n );\n }\n\n .errors {\n color: var(--donation-edit-error-color--);\n font-size: calc(var(--donation-edit-base-font-size--) * 1.4);\n margin-top: var(--padding-sm);\n }\n\n ul {\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n grid-gap: var(--donation-edit-button-grid-gap--);\n }\n\n li {\n margin: 0;\n padding: 0;\n display: inline-block;\n }\n\n .frequency-selector {\n grid-template-columns: repeat(2, 1fr);\n }\n\n .amount-selector {\n grid-template-columns: repeat(\n var(--donation-edit-amount-column-count--),\n 1fr\n );\n }\n\n .custom-amount {\n grid-column: span var(--donation-edit-custom-amount-col-span--);\n }\n\n .selection-button {\n height: calc(var(--donation-edit-base-font-size--) * 3);\n }\n\n .selection-button label {\n padding: 0 calc(var(--donation-edit-base-font-size--) * 0.3);\n display: flex;\n cursor: pointer;\n text-align: center;\n font-size: var(--donation-edit-button-font-size--);\n font-weight: bold;\n border: 1px solid var(--donation-edit-button-border-color--);\n border-radius: 5px;\n height: 100%;\n justify-content: center;\n align-items: center;\n }\n\n label[for='custom-amount-button'] {\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .custom-amount-text {\n white-space: nowrap;\n margin-right: var(--padding-sm);\n }\n\n input[type='radio'] {\n opacity: 0;\n width: 0;\n height: 0;\n position: absolute;\n }\n\n input[type='radio'] + label {\n color: var(--donation-edit-button-font-color--);\n background-color: var(--donation-edit-button-color--);\n }\n\n input[type='radio']:checked + label {\n color: var(--donation-edit-button-selected-font-color--);\n background-color: var(--donation-edit-button-selected-color--);\n }\n\n input[type='radio']:focus + label {\n outline: 2px solid var(--donation-edit-button-focused-outline-color--);\n }\n\n .checkbox-options {\n margin-top: var(--donation-edit-base-font-size--);\n }\n\n .checkbox-option-container {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .checkbox-option-container input {\n width: calc(var(--donation-edit-base-font-size--) * 2);\n }\n\n .checkbox-option-container label {\n font-size: var(--donation-edit-cover-fees-font-size--);\n font-weight: var(--donation-edit-cover-fees-font-weight--);\n flex: 1;\n }\n\n #custom-amount-input {\n width: var(--donation-edit-custom-amount-width--);\n font-size: var(--donation-edit-button-font-size--);\n font-weight: bold;\n color: var(--donation-edit-input-font-color--);\n padding: calc(var(--donation-edit-base-font-size--) * 0.1);\n border: var(--donation-edit-input-border--);\n appearance: none;\n }\n `,\n ];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ia-donation-edit-donation.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-edit-donation.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,OAAO,GAIR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACv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EAAE,CAAC;sEAEnB;AAEN;IAAhB,KAAK,EAAE;qDAAgC;AAEvB;IAAhB,KAAK,EAAE;oEAAsC;AAEN;IAAvC,KAAK,CAAC,uBAAuB,CAAC;kEAA+C;AAEvC;IAAtC,KAAK,CAAC,sBAAsB,CAAC;iEAA8C;AA3CjE,sBAAsB;IAFlC,aAAa,CAAC,2BAA2B,CAAC;IAC1C,SAAS,EAAE;GACC,sBAAsB,CA6wBlC","sourcesContent":["import {\n css,\n html,\n LitElement,\n nothing,\n type CSSResultGroup,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport { localized, msg, str } from '@lit/localize';\nimport currency from 'currency.js';\nimport { formatUsd } from '../localized-format';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport { CurrencyValidator } from '../currency-validator';\nimport {\n DonationPaymentInfo,\n defaultDonationAmounts,\n defaultSelectedDonationInfo,\n} from '../models/donation-payment-info';\nimport { DonationType } from '../models/donation-type';\nimport { DonationSectionBadgeMode } from './ia-donation-section';\nimport './ia-donation-section';\n\n/** Whether the numbered step badges show on the sections. */\nexport const EditDonationStepNumberMode = {\n HideNumbers: 'hidenumbers',\n ShowNumbers: 'shownumbers',\n} as const;\n\nexport type EditDonationStepNumberMode =\n (typeof EditDonationStepNumberMode)[keyof typeof EditDonationStepNumberMode];\n\n/** The radio button groups in the form. */\nexport const EditDonationSelectionGroup = {\n DonationType: 'donationType',\n Amount: 'amount',\n} as const;\n\nexport type EditDonationSelectionGroup =\n (typeof EditDonationSelectionGroup)[keyof typeof EditDonationSelectionGroup];\n\n/** The outcome of validating an amount. Sent in the `editDonationError` event. */\nexport const EditDonationInfoStatus = {\n ValidDonationAmount: 'valid_donation_amount',\n InvalidDonationAmount: 'invalid_donation_amount',\n DonationTooHigh: 'donation_too_high',\n DonationTooLow: 'donation_too_low',\n} as const;\n\nexport type EditDonationInfoStatus =\n (typeof EditDonationInfoStatus)[keyof typeof EditDonationInfoStatus];\n\n/** How the one-time / monthly choice is presented. */\nexport const EditDonationFrequencySelectionMode = {\n Button: 'button',\n Checkbox: 'checkbox',\n Hide: 'hide',\n} as const;\n\nexport type EditDonationFrequencySelectionMode =\n (typeof EditDonationFrequencySelectionMode)[keyof typeof EditDonationFrequencySelectionMode];\n\n/** Whether the amount buttons wrap onto several lines or stay on one. */\nexport const EditDonationAmountSelectionLayout = {\n SingleLine: 'single-line',\n MultiLine: 'multi-line',\n} as const;\n\nexport type EditDonationAmountSelectionLayout =\n (typeof EditDonationAmountSelectionLayout)[keyof typeof EditDonationAmountSelectionLayout];\n\n/**\n * The part of the donation form where the donor picks a frequency, an amount\n * (preset or custom) and whether to cover the processing fee. Fires\n * `donationInfoChanged` with the new `DonationPaymentInfo` on every change\n * and `editDonationError` when a custom amount is out of range.\n *\n * The petabox donation banner uses this on its own, without the rest of the\n * form.\n */\n@customElement('ia-donation-edit-donation')\n@localized()\nexport class IADonationEditDonation extends LitElement {\n @property({ type: Object })\n donationInfo: DonationPaymentInfo = defaultSelectedDonationInfo;\n\n @property({ type: String })\n stepNumberMode: EditDonationStepNumberMode =\n EditDonationStepNumberMode.ShowNumbers;\n\n /**\n * A convenience for setting the selected amount from plain HTML. When\n * present it wins over `donationInfo`.\n */\n @property({ type: Number }) defaultSelectedAmount?: number;\n\n @property({ type: Array }) amountOptions: number[] = defaultDonationAmounts;\n\n @property({ type: String })\n amountSelectionLayout: EditDonationAmountSelectionLayout =\n EditDonationAmountSelectionLayout.MultiLine;\n\n @property({ type: String, reflect: true })\n frequencySelectionMode: EditDonationFrequencySelectionMode =\n EditDonationFrequencySelectionMode.Button;\n\n @property({ type: String, reflect: true }) customAmountMode:\n | 'display'\n | 'hide' = 'display';\n\n @property({ type: String, reflect: true }) coverFeesCheckboxMode:\n | 'display'\n | 'hide' = 'display';\n\n /** `slot` renders the `edit-donation-amount-title` slot in place of the default headline. */\n @property({ type: String, reflect: true }) amountTitleDisplayMode:\n | 'default'\n | 'slot' = 'default';\n\n @state() private error?: TemplateResult;\n\n @state() private customAmountSelected = false;\n\n @query('#custom-amount-button') private customAmountButton!: HTMLInputElement;\n\n @query('#custom-amount-input') private customAmountInput!: HTMLInputElement;\n\n private currencyValidator: CurrencyValidator = new CurrencyValidator();\n\n render(): TemplateResult {\n const amountTitle =\n this.amountTitleDisplayMode === 'default'\n ? msg('Choose an amount (USD)')\n : '';\n return html`\n ${this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Button\n ? this.frequencyButtonsTemplate\n : nothing}\n\n <ia-donation-section\n sectionBadge=\"${this.amountSelectionSectionNumber}\"\n headline=${amountTitle}\n badgeMode=${this.formSectionNumberMode}\n >\n ${this.amountTitleDisplayMode === 'slot'\n ? html`<slot name=\"edit-donation-amount-title\"></slot>`\n : nothing}\n <ul class=\"amount-selector\">\n ${this.presetAmountsTemplate}\n ${this.customAmountMode === 'display'\n ? html`<li class=\"custom-amount\">${this.customAmountTemplate}</li>`\n : nothing}\n </ul>\n\n <div class=\"errors\" id=\"amount-errors\" aria-live=\"polite\">\n ${this.error}\n </div>\n\n ${this.coverFeesCheckboxMode === 'display'\n ? html`<div class=\"checkbox-options\">\n ${this.coverFeesCheckboxTemplate}\n ${this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Checkbox\n ? this.frequencyCheckboxTemplate\n : nothing}\n </div>`\n : nothing}\n </ia-donation-section>\n `;\n }\n\n updated(changedProperties: PropertyValues): void {\n if (changedProperties.has('customAmountSelected')) {\n if (this.customAmountButton) {\n this.customAmountButton.checked = this.customAmountSelected;\n }\n }\n if (changedProperties.has('amountOptions')) {\n this.customAmountSelected = false;\n this.updateSelectedDonationInfo();\n this.setupAmountColumnsLayoutConfig();\n }\n if (changedProperties.has('amountSelectionLayout')) {\n this.setupAmountColumnsLayoutConfig();\n }\n if (changedProperties.has('donationInfo')) {\n this.updateSelectedDonationInfo();\n }\n if (\n changedProperties.has('defaultSelectedAmount') &&\n this.defaultSelectedAmount !== undefined\n ) {\n this.customAmountSelected = false;\n this.donationInfo = new DonationPaymentInfo({\n donationType: this.donationInfo.donationType,\n amount: this.defaultSelectedAmount,\n coverFees: this.donationInfo.coverFees,\n });\n }\n }\n\n private get frequencyButtonsTemplate(): TemplateResult {\n return html`\n <ia-donation-section\n sectionBadge=\"1\"\n headline=${msg('Choose a frequency')}\n badgeMode=${this.formSectionNumberMode}\n >\n <ul class=\"frequency-selector\">\n ${this.frequencyTemplate}\n </ul>\n </ia-donation-section>\n `;\n }\n\n private get frequencyCheckboxTemplate(): TemplateResult {\n return html`\n <div class=\"checkbox-option-container\">\n <input\n type=\"checkbox\"\n id=\"make-this-monthly\"\n @input=${this.monthlyCheckboxChecked}\n .checked=${this.donationInfo.donationType === DonationType.Monthly}\n tabindex=\"0\"\n />\n <label for=\"make-this-monthly\">${msg('Make this monthly')}</label>\n </div>\n `;\n }\n\n private get coverFeesCheckboxTemplate(): TemplateResult {\n return html`\n <div class=\"checkbox-option-container\">\n <input\n type=\"checkbox\"\n id=\"cover-fees\"\n @input=${this.coverFeesChecked}\n .checked=${this.donationInfo.coverFees}\n tabindex=\"0\"\n />\n <label for=\"cover-fees\">${this.coverFeesText}</label>\n </div>\n `;\n }\n\n /** The amount step is 2 when the frequency buttons come first, otherwise 1. */\n private get amountSelectionSectionNumber(): number {\n return this.frequencySelectionMode ===\n EditDonationFrequencySelectionMode.Button\n ? 2\n : 1;\n }\n\n private get formSectionNumberMode(): DonationSectionBadgeMode {\n switch (this.stepNumberMode) {\n case EditDonationStepNumberMode.ShowNumbers:\n return DonationSectionBadgeMode.ShowBadge;\n case EditDonationStepNumberMode.HideNumbers:\n return DonationSectionBadgeMode.HideBadge;\n }\n }\n\n /**\n * Picks the amount grid's column count, and how many columns the custom\n * amount field spans, from how many preset amounts there are.\n */\n private setupAmountColumnsLayoutConfig(): void {\n const minimalView =\n this.customAmountMode === 'hide' &&\n this.coverFeesCheckboxMode === 'hide' &&\n this.frequencySelectionMode === EditDonationFrequencySelectionMode.Hide;\n const amountCount = this.amountOptions.length;\n let columnCount = 5;\n let customAmountSpan = 3;\n switch (amountCount) {\n case 7:\n columnCount = 5;\n customAmountSpan = 3;\n break;\n case 6:\n columnCount = 4;\n customAmountSpan = 2;\n break;\n case 5:\n columnCount = 4;\n customAmountSpan = 3;\n break;\n case 4:\n if (minimalView) {\n columnCount = 4;\n customAmountSpan = 0;\n break;\n }\n columnCount = 3;\n customAmountSpan = 2;\n break;\n case 3:\n columnCount = 2;\n customAmountSpan = 1;\n break;\n }\n\n if (\n this.amountSelectionLayout ===\n EditDonationAmountSelectionLayout.SingleLine\n ) {\n columnCount = amountCount + 3;\n customAmountSpan = 3;\n }\n\n this.style.setProperty(\n '--ia-donation-edit-amount-column-count',\n `${columnCount}`,\n );\n this.style.setProperty(\n '--ia-donation-edit-custom-amount-col-span',\n `${customAmountSpan}`,\n );\n }\n\n /**\n * Syncs the radios and the custom field with `donationInfo`. A preset\n * amount checks its radio and clears the custom field; anything else\n * selects the custom field and formats the amount into it.\n */\n private updateSelectedDonationInfo(): void {\n // Keep the custom amount selected while the donor is typing in it, even\n // if the value matches a preset, so the selection doesn't jump to the\n // preset radio mid-keystroke.\n // With the custom field hidden both sides would be null, so guard on it\n // existing first.\n const typingInCustomAmount =\n !!this.customAmountInput &&\n this.shadowRoot?.activeElement === this.customAmountInput;\n if (\n !this.isCustomAmount &&\n !(this.customAmountSelected && typingInCustomAmount)\n ) {\n const radioButton = this.shadowRoot?.querySelector<HTMLInputElement>(\n `input[type=\"radio\"][name=\"${EditDonationSelectionGroup.Amount}\"][value=\"${this.donationInfo.amount}\"]`,\n );\n if (radioButton) radioButton.checked = true;\n this.customAmountSelected = false;\n this.error = undefined;\n if (this.customAmountInput) {\n this.customAmountInput.value = '';\n }\n } else {\n this.customAmountSelected = true;\n // Leave the field alone while it has focus, the donor may be typing\n if (!typingInCustomAmount && this.customAmountInput) {\n this.customAmountInput.value = this.customAmountDisplayValue;\n const donationInfoStatus = this.getDonationInfoStatus(\n this.donationInfo.amount,\n );\n this.handleDonationInfoStatus(donationInfoStatus);\n }\n }\n }\n\n private get coverFeesText(): string {\n const feeAmountString = formatUsd(this.donationInfo.fee);\n\n return msg(str`I'll generously add ${feeAmountString} to cover fees.`);\n }\n\n /**\n * Formats a dollar amount without cents when it's a whole number and with\n * them when it isn't: `$5` and `$5.50`.\n */\n private formatShortenedAmount(dollars: number): string {\n const precision = dollars % 1 === 0 ? 0 : 2;\n return formatUsd(dollars, precision);\n }\n\n private get frequencyTemplate(): TemplateResult {\n return html`\n <li>\n ${this.getRadioButton({\n group: EditDonationSelectionGroup.DonationType,\n value: DonationType.OneTime,\n displayText: msg('One time'),\n checked: this.donationInfo.donationType === DonationType.OneTime,\n })}\n </li>\n\n <li>\n ${this.getRadioButton({\n group: EditDonationSelectionGroup.DonationType,\n value: DonationType.Monthly,\n displayText: msg('Monthly'),\n checked: this.donationInfo.donationType === DonationType.Monthly,\n })}\n </li>\n `;\n }\n\n private get presetAmountsTemplate(): TemplateResult {\n return html`\n ${this.amountOptions.map((amount) => {\n const checked =\n !this.customAmountSelected && amount === this.donationInfo.amount;\n\n return html`\n <li>\n ${this.getRadioButton({\n group: EditDonationSelectionGroup.Amount,\n value: `${amount}`,\n displayText: this.formatShortenedAmount(amount),\n checked,\n })}\n </li>\n `;\n })}\n `;\n }\n\n private getRadioButton(options: {\n group: EditDonationSelectionGroup;\n value: string;\n displayText: string;\n checked: boolean;\n }): TemplateResult {\n const radioId = `${options.group}-${options.value}-option`;\n return html`\n <div class=\"selection-button\">\n <input\n type=\"radio\"\n name=${options.group}\n value=${options.value}\n id=${radioId}\n tabindex=\"0\"\n .checked=${options.checked}\n @change=${this.radioSelected}\n @click=${(e: Event): void => {\n // `change` doesn't fire when the checked radio is clicked again,\n // so re-selecting the current amount is caught here. It matters\n // after a custom amount, which unchecks the presets visually.\n const isAmountSelection =\n options.group === EditDonationSelectionGroup.Amount;\n if (isAmountSelection) {\n const isSameValue =\n parseFloat(options.value) === this.donationInfo.amount;\n if (isSameValue) {\n this.radioSelected(e);\n }\n }\n }}\n />\n <label for=${radioId}>${options.displayText}</label>\n </div>\n `;\n }\n\n private get isCustomAmount(): boolean {\n return !this.amountOptions.includes(this.donationInfo.amount);\n }\n\n private get customAmountDisplayValue(): string {\n if (!this.isCustomAmount) return '';\n return currency(this.donationInfo.amount, { symbol: '' }).format();\n }\n\n private get customAmountTemplate(): TemplateResult {\n return html`\n <div class=\"selection-button\">\n <input\n type=\"radio\"\n name=${EditDonationSelectionGroup.Amount}\n value=\"custom\"\n id=\"custom-amount-button\"\n tabindex=\"0\"\n @change=${this.customRadioSelected}\n />\n\n <label for=\"custom-amount-button\">\n <span class=\"custom-amount-text\">${msg('Custom: $')}</span\n ><input\n type=\"text\"\n id=\"custom-amount-input\"\n tabindex=\"-1\"\n aria-label=${msg('Custom amount in dollars')}\n aria-describedby=\"amount-errors\"\n value=${this.customAmountDisplayValue}\n @input=${this.customAmountChanged}\n @keydown=${this.currencyValidator.keydown}\n @focus=${this.customAmountFocused}\n @blur=${this.customAmountBlurred}\n />\n </label>\n </div>\n `;\n }\n\n private customRadioSelected(): void {\n this.customAmountInput.focus();\n }\n\n private customAmountFocused(e: Event): void {\n const target = e.target as HTMLInputElement;\n this.customAmountSelected = true;\n this.handleCustomAmountInput(target.value);\n }\n\n /**\n * Once focus leaves the custom field the mid-keystroke protection is over,\n * so the UI re-syncs with `donationInfo`: a typed amount equal to a preset\n * moves to that preset, anything else gets re-formatted in place.\n */\n private customAmountBlurred(): void {\n this.updateSelectedDonationInfo();\n }\n\n private coverFeesChecked(e: Event): void {\n const target = e.target as HTMLInputElement;\n this.updateDonationInfo({ coverFees: target.checked });\n }\n\n private customAmountChanged(e: Event): void {\n const target = e.target as HTMLInputElement;\n this.customAmountSelected = true;\n this.handleCustomAmountInput(target.value);\n }\n\n private handleCustomAmountInput(value: string): void {\n const amount = parseFloat(value);\n if (isNaN(amount)) {\n this.dispatchEditDonationError(\n EditDonationInfoStatus.InvalidDonationAmount,\n );\n } else {\n this.amountChanged(amount);\n }\n }\n\n private handleDonationInfoStatus(status: EditDonationInfoStatus): void {\n switch (status) {\n case EditDonationInfoStatus.ValidDonationAmount:\n this.error = undefined;\n break;\n case EditDonationInfoStatus.DonationTooHigh:\n this.error = msg(html`\n To make a donation of $10,000 or more, please contact our philanthropy\n department at\n <a href=\"mailto:donations@archive.org\">donations@archive.org</a>\n `);\n this.dispatchEditDonationError(status);\n break;\n case EditDonationInfoStatus.DonationTooLow:\n if (this.customAmountInput.value.length > 0) {\n this.error = html`${msg('Please select an amount (minimum $1)')}`;\n }\n this.dispatchEditDonationError(status);\n break;\n case EditDonationInfoStatus.InvalidDonationAmount:\n this.error = html`${msg('Please enter a valid donation amount')}`;\n this.dispatchEditDonationError(status);\n break;\n }\n }\n\n private amountChanged(amount: number): void {\n const donationInfoStatus = this.getDonationInfoStatus(amount);\n this.handleDonationInfoStatus(donationInfoStatus);\n\n // Only a valid amount makes it into the donation info\n if (donationInfoStatus === EditDonationInfoStatus.ValidDonationAmount) {\n this.updateDonationInfo({ amount });\n }\n }\n\n private getDonationInfoStatus(amount: number): EditDonationInfoStatus {\n if (isNaN(amount)) {\n return EditDonationInfoStatus.InvalidDonationAmount;\n }\n\n if (amount >= 10000) {\n return EditDonationInfoStatus.DonationTooHigh;\n }\n\n if (amount < 1) {\n return EditDonationInfoStatus.DonationTooLow;\n }\n\n return EditDonationInfoStatus.ValidDonationAmount;\n }\n\n private radioSelected(e: Event): void {\n const radioButton = e.target as HTMLInputElement;\n const group = radioButton.name as EditDonationSelectionGroup;\n const { value } = radioButton;\n\n switch (group) {\n case EditDonationSelectionGroup.Amount:\n this.presetAmountChanged(parseFloat(value));\n break;\n case EditDonationSelectionGroup.DonationType:\n this.updateDonationInfo({ donationType: value as DonationType });\n break;\n default:\n break;\n }\n }\n\n private monthlyCheckboxChecked(e: Event): void {\n const isChecked = (e.target as HTMLInputElement).checked;\n const donationType = isChecked\n ? DonationType.Monthly\n : DonationType.OneTime;\n this.updateDonationInfo({ donationType });\n }\n\n private dispatchEditDonationError(error: EditDonationInfoStatus): void {\n const event = new CustomEvent('editDonationError', {\n detail: { error },\n });\n this.dispatchEvent(event);\n }\n\n private presetAmountChanged(amount: number): void {\n this.error = undefined;\n this.customAmountSelected = false;\n if (this.customAmountInput) {\n this.customAmountInput.value = '';\n }\n this.updateDonationInfo({ amount });\n }\n\n private updateDonationInfo(options: {\n donationType?: DonationType;\n amount?: number;\n coverFees?: boolean;\n }): void {\n const newDonationInfo = new DonationPaymentInfo({\n donationType: options.donationType ?? this.donationInfo.donationType,\n amount: options.amount ?? this.donationInfo.amount,\n coverFees: options.coverFees ?? this.donationInfo.coverFees,\n });\n\n this.donationInfo = newDonationInfo;\n\n const event = new CustomEvent('donationInfoChanged', {\n detail: { donationInfo: newDonationInfo },\n });\n this.dispatchEvent(event);\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n /*\n * The donation form was built for a 10px root font size. Sizing off\n * this base keeps the element self-contained, so it looks the same\n * whatever the page's root size is. Override it to rescale\n * everything, sections included.\n */\n --donation-edit-base-font-size--: var(\n --ia-donation-edit-base-font-size,\n 10px\n );\n\n --donation-edit-button-border-color--: var(\n --ia-donation-edit-button-border-color,\n var(--mid-gray)\n );\n --donation-edit-button-grid-gap--: var(\n --ia-donation-edit-button-grid-gap,\n var(--donation-edit-base-font-size--)\n );\n --donation-edit-button-font-size--: var(\n --ia-donation-edit-button-font-size,\n calc(var(--donation-edit-base-font-size--) * 1.6)\n );\n --donation-edit-button-font-color--: var(\n --ia-donation-edit-button-font-color,\n #000\n );\n --donation-edit-button-selected-font-color--: var(\n --ia-donation-edit-button-selected-font-color,\n #000\n );\n --donation-edit-button-selected-color--: var(\n --ia-donation-edit-button-selected-color,\n #f9bf3b\n );\n --donation-edit-button-focused-outline-color--: var(\n --ia-donation-edit-button-focused-outline-color,\n #7fb3f9\n );\n --donation-edit-button-color--: var(\n --ia-donation-edit-button-color,\n var(--true-white)\n );\n --donation-edit-cover-fees-font-size--: var(\n --ia-donation-edit-cover-fees-font-size,\n calc(var(--donation-edit-base-font-size--) * 1.2)\n );\n --donation-edit-cover-fees-font-weight--: var(\n --ia-donation-edit-cover-fees-font-weight,\n bold\n );\n --donation-edit-custom-amount-width--: var(\n --ia-donation-edit-custom-amount-width,\n calc(var(--donation-edit-base-font-size--) * 4)\n );\n --donation-edit-input-font-color--: var(\n --ia-donation-edit-input-font-color,\n var(--mid-gray)\n );\n --donation-edit-input-border--: var(\n --ia-donation-edit-input-border,\n 1px solid #d9d9d9\n );\n /* These two are set on the host by the element itself, from the number of amounts */\n --donation-edit-amount-column-count--: var(\n --ia-donation-edit-amount-column-count,\n 5\n );\n --donation-edit-custom-amount-col-span--: var(\n --ia-donation-edit-custom-amount-col-span,\n 3\n );\n --donation-edit-error-color--: var(--color-danger);\n\n /* Passed through to the sections */\n --ia-donation-section-base-font-size: var(\n --donation-edit-base-font-size--\n );\n --ia-donation-section-background-color: var(\n --ia-donation-edit-background-color,\n transparent\n );\n --ia-donation-section-badge-background-color: var(\n --ia-donation-edit-badge-background-color,\n var(--mid-gray)\n );\n --ia-donation-section-badge-font-color: var(\n --ia-donation-edit-badge-font-color,\n var(--true-white)\n );\n }\n\n .errors {\n color: var(--donation-edit-error-color--);\n font-size: calc(var(--donation-edit-base-font-size--) * 1.4);\n margin-top: var(--padding-sm);\n }\n\n ul {\n list-style: none;\n margin: 0;\n padding: 0;\n display: grid;\n grid-gap: var(--donation-edit-button-grid-gap--);\n }\n\n li {\n margin: 0;\n padding: 0;\n display: inline-block;\n }\n\n .frequency-selector {\n grid-template-columns: repeat(2, 1fr);\n }\n\n .amount-selector {\n grid-template-columns: repeat(\n var(--donation-edit-amount-column-count--),\n 1fr\n );\n }\n\n .custom-amount {\n grid-column: span var(--donation-edit-custom-amount-col-span--);\n }\n\n .selection-button {\n height: calc(var(--donation-edit-base-font-size--) * 3);\n }\n\n .selection-button label {\n padding: 0 calc(var(--donation-edit-base-font-size--) * 0.3);\n display: flex;\n cursor: pointer;\n text-align: center;\n font-size: var(--donation-edit-button-font-size--);\n font-weight: bold;\n border: 1px solid var(--donation-edit-button-border-color--);\n border-radius: 5px;\n height: 100%;\n justify-content: center;\n align-items: center;\n }\n\n label[for='custom-amount-button'] {\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .custom-amount-text {\n white-space: nowrap;\n margin-right: var(--padding-sm);\n }\n\n input[type='radio'] {\n opacity: 0;\n width: 0;\n height: 0;\n position: absolute;\n }\n\n input[type='radio'] + label {\n color: var(--donation-edit-button-font-color--);\n background-color: var(--donation-edit-button-color--);\n }\n\n input[type='radio']:checked + label {\n color: var(--donation-edit-button-selected-font-color--);\n background-color: var(--donation-edit-button-selected-color--);\n }\n\n input[type='radio']:focus + label {\n outline: 2px solid var(--donation-edit-button-focused-outline-color--);\n }\n\n .checkbox-options {\n margin-top: var(--donation-edit-base-font-size--);\n }\n\n .checkbox-option-container {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .checkbox-option-container input {\n width: calc(var(--donation-edit-base-font-size--) * 2);\n }\n\n .checkbox-option-container label {\n font-size: var(--donation-edit-cover-fees-font-size--);\n font-weight: var(--donation-edit-cover-fees-font-weight--);\n flex: 1;\n }\n\n #custom-amount-input {\n width: var(--donation-edit-custom-amount-width--);\n font-size: var(--donation-edit-button-font-size--);\n font-weight: bold;\n color: var(--donation-edit-input-font-color--);\n padding: calc(var(--donation-edit-base-font-size--) * 0.1);\n border: var(--donation-edit-input-border--);\n appearance: none;\n }\n `,\n ];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-summary.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAOb,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAG3E,uFAAuF;AACvF,
|
|
1
|
+
{"version":3,"file":"ia-donation-summary.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAOb,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAG3E,uFAAuF;AACvF,qBAEa,iBAAkB,SAAQ,UAAU;IACnB,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAE/D,MAAM,IAAI,cAAc;IAOxB,IAAI,YAAY,IAAI,MAAM,CAazB;IAED,OAAO,CAAC,WAAW;IAInB,MAAM,KAAK,MAAM,IAAI,cAAc,CAkBlC;CACF"}
|
|
@@ -2,8 +2,8 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { css, html, LitElement, } from 'lit';
|
|
3
3
|
import { property } from 'lit/decorators.js';
|
|
4
4
|
import { customElement } from '../../../utils/custom-element.js';
|
|
5
|
-
import { msg, str } from '@lit/localize';
|
|
6
|
-
import
|
|
5
|
+
import { localized, msg, str } from '@lit/localize';
|
|
6
|
+
import { formatUsd } from '../localized-format.js';
|
|
7
7
|
import themeStyles from '../../../themes/theme-styles.js';
|
|
8
8
|
import { DonationType } from '../models/donation-type.js';
|
|
9
9
|
/** The collapsed view of the chosen donation, with a button to go back and edit it. */
|
|
@@ -21,7 +21,7 @@ let IADonationSummary = class IADonationSummary extends LitElement {
|
|
|
21
21
|
const amount = this.donationInfo.amount;
|
|
22
22
|
// Whole dollars don't need the cents
|
|
23
23
|
const precision = amount === Math.round(amount) ? 0 : 2;
|
|
24
|
-
const displayAmount =
|
|
24
|
+
const displayAmount = formatUsd(amount, precision);
|
|
25
25
|
return this.donationInfo.donationType === DonationType.Monthly
|
|
26
26
|
? msg(str `${displayAmount} Monthly Donation`)
|
|
27
27
|
: msg(str `${displayAmount} Donation`);
|
|
@@ -53,7 +53,8 @@ __decorate([
|
|
|
53
53
|
property({ type: Object })
|
|
54
54
|
], IADonationSummary.prototype, "donationInfo", void 0);
|
|
55
55
|
IADonationSummary = __decorate([
|
|
56
|
-
customElement('ia-donation-summary')
|
|
56
|
+
customElement('ia-donation-summary'),
|
|
57
|
+
localized()
|
|
57
58
|
], IADonationSummary);
|
|
58
59
|
export { IADonationSummary };
|
|
59
60
|
//# sourceMappingURL=ia-donation-summary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-summary.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-summary.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,GAGX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ia-donation-summary.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-summary.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,GAGX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,uFAAuF;AAGhF,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAG/C,MAAM;QACJ,OAAO,IAAI,CAAA;YACH,IAAI,CAAC,YAAY;uBACN,IAAI,CAAC,WAAW,IAAI,GAAG,CAAC,kBAAkB,CAAC;KAC7D,CAAC;IACJ,CAAC;IAED,IAAI,YAAY;QACd,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;QACxC,qCAAqC;QACrC,MAAM,SAAS,GAAG,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxD,MAAM,aAAa,GAAG,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAEnD,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,KAAK,YAAY,CAAC,OAAO;YAC5D,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,aAAa,mBAAmB,CAAC;YAC7C,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,aAAa,WAAW,CAAC,CAAC;IAC1C,CAAC;IAEO,WAAW;QACjB,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,WAAW;YACX,GAAG,CAAA;;;;;;;;;;;;;OAaF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA/C6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAoC;AADpD,iBAAiB;IAF7B,aAAa,CAAC,qBAAqB,CAAC;IACpC,SAAS,EAAE;GACC,iBAAiB,CAgD7B","sourcesContent":["import {\n css,\n html,\n LitElement,\n type CSSResultGroup,\n type TemplateResult,\n} from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport { localized, msg, str } from '@lit/localize';\nimport { formatUsd } from '../localized-format';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport type { DonationPaymentInfo } from '../models/donation-payment-info';\nimport { DonationType } from '../models/donation-type';\n\n/** The collapsed view of the chosen donation, with a button to go back and edit it. */\n@customElement('ia-donation-summary')\n@localized()\nexport class IADonationSummary extends LitElement {\n @property({ type: Object }) donationInfo?: DonationPaymentInfo;\n\n render(): TemplateResult {\n return html`\n <h1>${this.displayTitle}</h1>\n <button @click=${this.editClicked}>${msg('Edit this amount')}</button>\n `;\n }\n\n get displayTitle(): string {\n if (!this.donationInfo) {\n return '';\n }\n\n const amount = this.donationInfo.amount;\n // Whole dollars don't need the cents\n const precision = amount === Math.round(amount) ? 0 : 2;\n const displayAmount = formatUsd(amount, precision);\n\n return this.donationInfo.donationType === DonationType.Monthly\n ? msg(str`${displayAmount} Monthly Donation`)\n : msg(str`${displayAmount} Donation`);\n }\n\n private editClicked(): void {\n this.dispatchEvent(new Event('editClicked'));\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n display: flex;\n justify-content: center;\n align-content: center;\n }\n\n button {\n border: 0;\n background: none;\n color: var(--link-color);\n cursor: pointer;\n }\n `,\n ];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-total-amount.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-total-amount.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAOb,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAG3E,qFAAqF;AACrF,
|
|
1
|
+
{"version":3,"file":"ia-donation-total-amount.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-total-amount.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAOb,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAG3E,qFAAqF;AACrF,qBAEa,qBAAsB,SAAQ,UAAU;IACvB,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAE/D,MAAM,IAAI,cAAc;IAOxB,OAAO,KAAK,SAAS,GAMpB;IAED,MAAM,KAAK,MAAM,IAAI,cAAc,CAyClC;CACF"}
|
|
@@ -2,8 +2,8 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { css, html, LitElement, } from 'lit';
|
|
3
3
|
import { property } from 'lit/decorators.js';
|
|
4
4
|
import { customElement } from '../../../utils/custom-element.js';
|
|
5
|
-
import { msg, str } from '@lit/localize';
|
|
6
|
-
import
|
|
5
|
+
import { localized, msg, str } from '@lit/localize';
|
|
6
|
+
import { formatUsd } from '../localized-format.js';
|
|
7
7
|
import themeStyles from '../../../themes/theme-styles.js';
|
|
8
8
|
import { DonationType } from '../models/donation-type.js';
|
|
9
9
|
/** The "Total: $X" line under the amount picker, with "/month" for monthly gifts. */
|
|
@@ -17,7 +17,7 @@ let IADonationTotalAmount = class IADonationTotalAmount extends LitElement {
|
|
|
17
17
|
get totalLine() {
|
|
18
18
|
if (!this.donationInfo)
|
|
19
19
|
return '';
|
|
20
|
-
const amount =
|
|
20
|
+
const amount = formatUsd(this.donationInfo.total);
|
|
21
21
|
return this.donationInfo.donationType === DonationType.Monthly
|
|
22
22
|
? msg(str `Total: ${amount}/month`)
|
|
23
23
|
: msg(str `Total: ${amount}`);
|
|
@@ -69,7 +69,8 @@ __decorate([
|
|
|
69
69
|
property({ type: Object })
|
|
70
70
|
], IADonationTotalAmount.prototype, "donationInfo", void 0);
|
|
71
71
|
IADonationTotalAmount = __decorate([
|
|
72
|
-
customElement('ia-donation-total-amount')
|
|
72
|
+
customElement('ia-donation-total-amount'),
|
|
73
|
+
localized()
|
|
73
74
|
], IADonationTotalAmount);
|
|
74
75
|
export { IADonationTotalAmount };
|
|
75
76
|
//# sourceMappingURL=ia-donation-total-amount.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ia-donation-total-amount.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-total-amount.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,GAGX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ia-donation-total-amount.js","sourceRoot":"","sources":["../../../../../src/elements/ia-donation-form/form-elements/ia-donation-total-amount.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,GAGX,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,qFAAqF;AAG9E,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;IAGnD,MAAM;QACJ,OAAO,IAAI,CAAA;;gCAEiB,IAAI,CAAC,SAAS;KACzC,CAAC;IACJ,CAAC;IAED,IAAY,SAAS;QACnB,IAAI,CAAC,IAAI,CAAC,YAAY;YAAE,OAAO,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,KAAK,YAAY,CAAC,OAAO;YAC5D,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,UAAU,MAAM,QAAQ,CAAC;YAClC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,UAAU,MAAM,EAAE,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,WAAW;YACX,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA3D6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAoC;AADpD,qBAAqB;IAFjC,aAAa,CAAC,0BAA0B,CAAC;IACzC,SAAS,EAAE;GACC,qBAAqB,CA4DjC","sourcesContent":["import {\n css,\n html,\n LitElement,\n type CSSResultGroup,\n type TemplateResult,\n} from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { customElement } from '@src/utils/custom-element';\nimport { localized, msg, str } from '@lit/localize';\nimport { formatUsd } from '../localized-format';\n\nimport themeStyles from '@src/themes/theme-styles';\nimport type { DonationPaymentInfo } from '../models/donation-payment-info';\nimport { DonationType } from '../models/donation-type';\n\n/** The \"Total: $X\" line under the amount picker, with \"/month\" for monthly gifts. */\n@customElement('ia-donation-total-amount')\n@localized()\nexport class IADonationTotalAmount extends LitElement {\n @property({ type: Object }) donationInfo?: DonationPaymentInfo;\n\n render(): TemplateResult {\n return html`\n <div class=\"top-line\"></div>\n <div class=\"total-line\">${this.totalLine}</div>\n `;\n }\n\n private get totalLine(): string {\n if (!this.donationInfo) return '';\n const amount = formatUsd(this.donationInfo.total);\n return this.donationInfo.donationType === DonationType.Monthly\n ? msg(str`Total: ${amount}/month`)\n : msg(str`Total: ${amount}`);\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --donation-total-base-font-size--: var(\n --ia-donation-form-base-font-size,\n 10px\n );\n --donation-total-line-color--: var(\n --ia-donation-total-amount-line-color,\n var(--mid-gray)\n );\n --donation-total-line-thickness--: var(\n --ia-donation-total-amount-line-thickness,\n 2px\n );\n --donation-total-vertical-spacing--: var(\n --ia-donation-total-amount-vertical-spacing,\n var(--padding-sm)\n );\n --donation-total-font-size--: var(\n --ia-donation-total-amount-font-size,\n calc(var(--donation-total-base-font-size--) * 2.6)\n );\n }\n\n .top-line {\n width: 100%;\n height: var(--donation-total-line-thickness--);\n background-color: var(--donation-total-line-color--);\n }\n\n .total-line {\n font-size: var(--donation-total-font-size--);\n font-weight: bold;\n text-align: center;\n margin-top: var(--donation-total-vertical-spacing--);\n }\n `,\n ];\n }\n}\n"]}
|