@foxy.io/elements 1.14.0-beta.7 → 1.14.0-beta.8

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.
Files changed (89) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-card.js +1 -1
  3. package/dist/cdn/foxy-address-form.js +1 -1
  4. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  5. package/dist/cdn/foxy-attribute-card.js +1 -1
  6. package/dist/cdn/foxy-attribute-form.js +1 -1
  7. package/dist/cdn/foxy-cancellation-form.js +1 -1
  8. package/dist/cdn/foxy-collection-page.js +1 -1
  9. package/dist/cdn/foxy-collection-pages.js +1 -1
  10. package/dist/cdn/foxy-custom-field-card.js +1 -1
  11. package/dist/cdn/foxy-custom-field-form.js +1 -1
  12. package/dist/cdn/foxy-customer-card.js +1 -1
  13. package/dist/cdn/foxy-customer-form.js +1 -1
  14. package/dist/cdn/foxy-customer-portal-settings.js +17 -17
  15. package/dist/cdn/foxy-customer-portal.js +2 -2
  16. package/dist/cdn/foxy-customer.js +4 -4
  17. package/dist/cdn/foxy-customers-table.js +1 -1
  18. package/dist/cdn/foxy-discount-card.js +1 -1
  19. package/dist/cdn/foxy-donation.js +1 -1
  20. package/dist/cdn/foxy-email-template-form.js +1 -1
  21. package/dist/cdn/foxy-error-entry-card.js +1 -1
  22. package/dist/cdn/foxy-form-dialog.js +1 -1
  23. package/dist/cdn/foxy-i18n.js +1 -1
  24. package/dist/cdn/foxy-items-form.js +1 -1
  25. package/dist/cdn/foxy-payment-card.js +1 -1
  26. package/dist/cdn/foxy-payment-method-card.js +1 -1
  27. package/dist/cdn/foxy-query-builder.js +2 -2
  28. package/dist/cdn/foxy-sign-in-form.js +1 -1
  29. package/dist/cdn/foxy-spinner.js +1 -1
  30. package/dist/cdn/foxy-subscription-card.js +1 -1
  31. package/dist/cdn/foxy-subscription-form.js +3 -3
  32. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  33. package/dist/cdn/foxy-table.js +1 -1
  34. package/dist/cdn/foxy-tax-card.js +1 -1
  35. package/dist/cdn/foxy-tax-form.js +1 -1
  36. package/dist/cdn/foxy-template-config-form.js +1 -14
  37. package/dist/cdn/foxy-template-form.js +1 -1
  38. package/dist/cdn/foxy-transaction-card.js +1 -1
  39. package/dist/cdn/foxy-transactions-table.js +1 -1
  40. package/dist/cdn/foxy-user-form.js +1 -1
  41. package/dist/cdn/foxy-users-table.js +1 -1
  42. package/dist/cdn/{shared-50c7a176.js → shared-00070cc4.js} +5 -5
  43. package/dist/cdn/shared-007c4e34.js +1 -0
  44. package/dist/cdn/shared-07134f93.js +14 -0
  45. package/dist/cdn/{shared-09feabf8.js → shared-0f9809ab.js} +1 -1
  46. package/dist/cdn/{shared-8edee4e1.js → shared-31d03530.js} +7 -7
  47. package/dist/cdn/{shared-691da586.js → shared-4ba926ca.js} +1 -1
  48. package/dist/cdn/{shared-1bafffd0.js → shared-5d94bacb.js} +1 -1
  49. package/dist/cdn/{shared-6ecbc785.js → shared-7007dedb.js} +1 -1
  50. package/dist/cdn/{shared-7629a1a5.js → shared-a3d2c48e.js} +1 -1
  51. package/dist/cdn/{shared-c66e9946.js → shared-b24377bf.js} +1 -1
  52. package/dist/cdn/{shared-0ba88744.js → shared-c5ae5d33.js} +1 -1
  53. package/dist/cdn/{shared-6f7f752e.js → shared-ca7c3b9a.js} +1 -1
  54. package/dist/cdn/shared-d01035c5.js +1 -0
  55. package/dist/cdn/{shared-16e28f3b.js → shared-d05c93a5.js} +1 -1
  56. package/dist/cdn/{shared-4d3c7828.js → shared-da787055.js} +1 -1
  57. package/dist/cdn/{shared-a6c047b1.js → shared-daf6b763.js} +1 -1
  58. package/dist/cdn/shared-fe8a7aa2.js +1 -0
  59. package/dist/elements/private/Checkbox/Checkbox.d.ts +3 -1
  60. package/dist/elements/private/Checkbox/Checkbox.js +43 -14
  61. package/dist/elements/private/Checkbox/Checkbox.js.map +1 -1
  62. package/dist/elements/private/Choice/Choice.js +7 -5
  63. package/dist/elements/private/Choice/Choice.js.map +1 -1
  64. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.d.ts +3 -2
  65. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +68 -50
  66. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
  67. package/dist/elements/public/EmailTemplateForm/types.d.ts +14 -0
  68. package/dist/elements/public/EmailTemplateForm/types.js.map +1 -1
  69. package/dist/elements/public/TemplateConfigForm/CountriesList.js +11 -2
  70. package/dist/elements/public/TemplateConfigForm/CountriesList.js.map +1 -1
  71. package/dist/elements/public/TemplateConfigForm/CountryCard.d.ts +2 -0
  72. package/dist/elements/public/TemplateConfigForm/CountryCard.js +36 -4
  73. package/dist/elements/public/TemplateConfigForm/CountryCard.js.map +1 -1
  74. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +55 -1
  75. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +247 -55
  76. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
  77. package/dist/elements/public/TemplateConfigForm/types.d.ts +34 -0
  78. package/dist/elements/public/TemplateConfigForm/types.js.map +1 -1
  79. package/dist/elements/public/TemplateForm/TemplateForm.d.ts +2 -1
  80. package/dist/elements/public/TemplateForm/TemplateForm.js +71 -52
  81. package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -1
  82. package/dist/elements/public/TemplateForm/types.d.ts +14 -0
  83. package/dist/elements/public/TemplateForm/types.js.map +1 -1
  84. package/dist/mixins/themeable.js +22 -8
  85. package/dist/mixins/themeable.js.map +1 -1
  86. package/package.json +1 -1
  87. package/dist/cdn/shared-3f35fa81.js +0 -1
  88. package/dist/cdn/shared-ace85f1b.js +0 -1
  89. package/dist/cdn/shared-d8852c42.js +0 -1
@@ -1,3 +1,17 @@
1
+ import { EmailTemplateForm } from './EmailTemplateForm';
1
2
  import { Rels } from '@foxy.io/sdk/backend';
3
+ import { Renderer } from '../../../mixins/configurable';
2
4
  import { Resource } from '@foxy.io/sdk/core';
3
5
  export declare type Data = Resource<Rels.EmailTemplate>;
6
+ export declare type Templates = {
7
+ 'description:before'?: Renderer<EmailTemplateForm>;
8
+ 'description:after'?: Renderer<EmailTemplateForm>;
9
+ 'content:before'?: Renderer<EmailTemplateForm>;
10
+ 'content:after'?: Renderer<EmailTemplateForm>;
11
+ 'timestamps:before'?: Renderer<EmailTemplateForm>;
12
+ 'timestamps:after'?: Renderer<EmailTemplateForm>;
13
+ 'create:before'?: Renderer<EmailTemplateForm>;
14
+ 'create:after'?: Renderer<EmailTemplateForm>;
15
+ 'delete:before'?: Renderer<EmailTemplateForm>;
16
+ 'delete:after'?: Renderer<EmailTemplateForm>;
17
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\n\nexport type Data = Resource<Rels.EmailTemplate>;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/EmailTemplateForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { EmailTemplateForm } from './EmailTemplateForm';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Renderer } from '../../../mixins/configurable';\nimport { Resource } from '@foxy.io/sdk/core';\n\nexport type Data = Resource<Rels.EmailTemplate>;\n\nexport type Templates = {\n 'description:before'?: Renderer<EmailTemplateForm>;\n 'description:after'?: Renderer<EmailTemplateForm>;\n 'content:before'?: Renderer<EmailTemplateForm>;\n 'content:after'?: Renderer<EmailTemplateForm>;\n 'timestamps:before'?: Renderer<EmailTemplateForm>;\n 'timestamps:after'?: Renderer<EmailTemplateForm>;\n 'create:before'?: Renderer<EmailTemplateForm>;\n 'create:after'?: Renderer<EmailTemplateForm>;\n 'delete:before'?: Renderer<EmailTemplateForm>;\n 'delete:after'?: Renderer<EmailTemplateForm>;\n};\n"]}
@@ -77,13 +77,22 @@ export class CountriesList extends Base {
77
77
  })}
78
78
 
79
79
  <div
80
- class="h-m flex items-center rounded transition-colors border border-contrast-10 hover-border-contrast-40 focus-within-ring-1 focus-within-ring-primary-50 focus-within-border-primary-50"
80
+ class=${classMap({
81
+ 'h-m flex items-center rounded transition-colors': true,
82
+ 'border border-contrast-10 ring-primary-50': true,
83
+ 'hover-border-contrast-40': !this.disabled,
84
+ 'focus-within-ring-1 focus-within-border-primary-50': !this.disabled,
85
+ 'flex': !this.readonly,
86
+ 'hidden': this.readonly,
87
+ })}
81
88
  >
82
89
  <input
83
90
  placeholder=${this.t('add_country')}
84
91
  class="w-full bg-transparent appearance-none h-m text-s px-m focus-outline-none"
85
92
  list="list"
86
93
  .value=${this.country}
94
+ ?disabled=${this.disabled}
95
+ ?readonly=${this.readonly}
87
96
  @keydown=${(evt) => {
88
97
  if (evt.key === 'Enter' && this.country)
89
98
  this.__addCountry();
@@ -104,7 +113,7 @@ export class CountriesList extends Base {
104
113
  'focus-outline-none focus-ring-2 ring-inset ring-success-50': !!this.country,
105
114
  })}
106
115
  style="width: calc(var(--lumo-size-s) - 2px); height: calc(var(--lumo-size-s) - 2px)"
107
- ?disabled=${!this.country}
116
+ ?disabled=${!this.country || this.disabled}
108
117
  @click=${this.__addCountry}
109
118
  >
110
119
  <iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon>
@@ -1 +1 @@
1
- {"version":3,"file":"CountriesList.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateConfigForm/CountriesList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,yBAAsB;AAC5C,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAIlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D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sMixin } from '@open-wc/scoped-elements';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { CountryCard } from './CountryCard';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst Base = ScopedElementsMixin(ThemeableMixin(TranslatableMixin(NucleonElement)));\n\nexport class CountriesList extends Base<Resource<Rels.Countries>> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'x-country-card': CountryCard,\n 'iron-icon': customElements.get('iron-icon'),\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n countries: { type: Object },\n disabled: { type: Boolean },\n readonly: { type: Boolean },\n regions: { type: String },\n country: { type: String },\n };\n }\n\n countries: Record<string, '*' | string[]> = {};\n\n disabled = false;\n\n readonly = false;\n\n regions = '';\n\n country = '';\n\n render(): TemplateResult {\n return html`\n <div>\n <div class=\"space-y-s\">\n ${Object.entries(this.countries).map(([country, regions]) => {\n let regionsLink: string;\n\n try {\n const url = new URL(this.regions);\n url.searchParams.set('country_code', country);\n regionsLink = url.toString();\n } catch {\n regionsLink = '';\n }\n\n return html`\n <x-country-card\n regions=${JSON.stringify(regions === '*' ? [] : regions)}\n code=${country}\n name=${ifDefined(this.data?.values[country]?.default)}\n href=${regionsLink}\n lang=${this.lang}\n ns=${this.ns}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @update:regions=${(evt: CustomEvent) => {\n const newCountries = { ...this.countries };\n const newRegions = (evt.currentTarget as CountryCard).regions;\n\n newCountries[country] = newRegions.length ? newRegions : '*';\n this.countries = newCountries;\n\n this.dispatchEvent(new CustomEvent('update:countries'));\n }}\n @delete=${() => {\n const newCountries = { ...this.countries };\n delete newCountries[country];\n this.countries = newCountries;\n\n this.dispatchEvent(new CustomEvent('update:countries'));\n }}\n >\n </x-country-card>\n `;\n })}\n\n <div\n class=\"h-m flex items-center rounded transition-colors border border-contrast-10 hover-border-contrast-40 focus-within-ring-1 focus-within-ring-primary-50 focus-within-border-primary-50\"\n >\n <input\n placeholder=${this.t('add_country')}\n class=\"w-full bg-transparent appearance-none h-m text-s px-m focus-outline-none\"\n list=\"list\"\n .value=${this.country}\n @keydown=${(evt: KeyboardEvent) => {\n if (evt.key === 'Enter' && this.country) this.__addCountry();\n }}\n @input=${(evt: InputEvent) => {\n const target = evt.currentTarget as HTMLInputElement;\n this.country = target.value;\n }}\n />\n\n <button\n class=${classMap({\n 'mr-xs flex-shrink-0': true,\n 'flex items-center justify-center rounded-full transition-colors': true,\n 'bg-contrast-5 text-disabled cursor-default': !this.country,\n 'bg-success-10 text-success cursor-pointer': !!this.country,\n 'hover-bg-success hover-text-success-contrast': !!this.country,\n 'focus-outline-none focus-ring-2 ring-inset ring-success-50': !!this.country,\n })}\n style=\"width: calc(var(--lumo-size-s) - 2px); height: calc(var(--lumo-size-s) - 2px)\"\n ?disabled=${!this.country}\n @click=${this.__addCountry}\n >\n <iron-icon icon=\"icons:add\" class=\"icon-inline text-m\"></iron-icon>\n </button>\n </div>\n </div>\n\n <datalist id=\"list\">\n ${Object.values(this.data?.values ?? {}).map(country => {\n return html`<option value=${country.cc2}>${country.default}</option>`;\n })}\n </datalist>\n </div>\n `;\n }\n\n private __addCountry() {\n this.countries = { ...this.countries, [this.country]: '*' };\n this.country = '';\n this.dispatchEvent(new CustomEvent('update:countries'));\n }\n}\n"]}
1
+ {"version":3,"file":"CountriesList.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateConfigForm/CountriesList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,WA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EAAE;YACrD,OAAO,IAAI,CAAA,iBAAiB,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,OAAO,WAAW,CAAC;QACxE,CAAC,CAAC;;;KAGP,CAAC;IACJ,CAAC;IAEO,YAAY;QAClB,IAAI,CAAC,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;QAC5D,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC1D,CAAC;CACF","sourcesContent":["import { ScopedElementsMap, ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { CountryCard } from './CountryCard';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\n\nconst Base = ScopedElementsMixin(ThemeableMixin(TranslatableMixin(NucleonElement)));\n\nexport class CountriesList extends Base<Resource<Rels.Countries>> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'x-country-card': CountryCard,\n 'iron-icon': customElements.get('iron-icon'),\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n countries: { type: Object },\n disabled: { type: Boolean },\n readonly: { type: Boolean },\n regions: { type: String },\n country: { type: String },\n };\n }\n\n countries: Record<string, '*' | string[]> = {};\n\n disabled = false;\n\n readonly = false;\n\n regions = '';\n\n country = '';\n\n render(): TemplateResult {\n return html`\n <div>\n <div class=\"space-y-s\">\n ${Object.entries(this.countries).map(([country, regions]) => {\n let regionsLink: string;\n\n try {\n const url = new URL(this.regions);\n url.searchParams.set('country_code', country);\n regionsLink = url.toString();\n } catch {\n regionsLink = '';\n }\n\n return html`\n <x-country-card\n regions=${JSON.stringify(regions === '*' ? [] : regions)}\n code=${country}\n name=${ifDefined(this.data?.values[country]?.default)}\n href=${regionsLink}\n lang=${this.lang}\n ns=${this.ns}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @update:regions=${(evt: CustomEvent) => {\n const newCountries = { ...this.countries };\n const newRegions = (evt.currentTarget as CountryCard).regions;\n\n newCountries[country] = newRegions.length ? newRegions : '*';\n this.countries = newCountries;\n\n this.dispatchEvent(new CustomEvent('update:countries'));\n }}\n @delete=${() => {\n const newCountries = { ...this.countries };\n delete newCountries[country];\n this.countries = newCountries;\n\n this.dispatchEvent(new CustomEvent('update:countries'));\n }}\n >\n </x-country-card>\n `;\n })}\n\n <div\n class=${classMap({\n 'h-m flex items-center rounded transition-colors': true,\n 'border border-contrast-10 ring-primary-50': true,\n 'hover-border-contrast-40': !this.disabled,\n 'focus-within-ring-1 focus-within-border-primary-50': !this.disabled,\n 'flex': !this.readonly,\n 'hidden': this.readonly,\n })}\n >\n <input\n placeholder=${this.t('add_country')}\n class=\"w-full bg-transparent appearance-none h-m text-s px-m focus-outline-none\"\n list=\"list\"\n .value=${this.country}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n @keydown=${(evt: KeyboardEvent) => {\n if (evt.key === 'Enter' && this.country) this.__addCountry();\n }}\n @input=${(evt: InputEvent) => {\n const target = evt.currentTarget as HTMLInputElement;\n this.country = target.value;\n }}\n />\n\n <button\n class=${classMap({\n 'mr-xs flex-shrink-0': true,\n 'flex items-center justify-center rounded-full transition-colors': true,\n 'bg-contrast-5 text-disabled cursor-default': !this.country,\n 'bg-success-10 text-success cursor-pointer': !!this.country,\n 'hover-bg-success hover-text-success-contrast': !!this.country,\n 'focus-outline-none focus-ring-2 ring-inset ring-success-50': !!this.country,\n })}\n style=\"width: calc(var(--lumo-size-s) - 2px); height: calc(var(--lumo-size-s) - 2px)\"\n ?disabled=${!this.country || this.disabled}\n @click=${this.__addCountry}\n >\n <iron-icon icon=\"icons:add\" class=\"icon-inline text-m\"></iron-icon>\n </button>\n </div>\n </div>\n\n <datalist id=\"list\">\n ${Object.values(this.data?.values ?? {}).map(country => {\n return html`<option value=${country.cc2}>${country.default}</option>`;\n })}\n </datalist>\n </div>\n `;\n }\n\n private __addCountry() {\n this.countries = { ...this.countries, [this.country]: '*' };\n this.country = '';\n this.dispatchEvent(new CustomEvent('update:countries'));\n }\n}\n"]}
@@ -10,6 +10,8 @@ declare const Base: typeof NucleonElement & import("lit-element").Constructor<im
10
10
  } & import("lit-element").Constructor<import("../../../mixins/configurable").ConfigurableMixinHost>;
11
11
  export declare class CountryCard extends Base<Resource<Rels.Regions>> {
12
12
  static get properties(): PropertyDeclarations;
13
+ disabled: boolean;
14
+ readonly: boolean;
13
15
  regions: string[];
14
16
  region: string;
15
17
  name: string;
@@ -8,6 +8,8 @@ const Base = ConfigurableMixin(ThemeableMixin(TranslatableMixin(NucleonElement))
8
8
  export class CountryCard extends Base {
9
9
  constructor() {
10
10
  super(...arguments);
11
+ this.disabled = false;
12
+ this.readonly = false;
11
13
  this.regions = [];
12
14
  this.region = '';
13
15
  this.name = '';
@@ -16,6 +18,8 @@ export class CountryCard extends Base {
16
18
  static get properties() {
17
19
  return {
18
20
  ...super.properties,
21
+ disabled: { type: Boolean },
22
+ readonly: { type: Boolean },
19
23
  regions: { type: Array },
20
24
  region: { type: String },
21
25
  name: { type: String },
@@ -25,7 +29,12 @@ export class CountryCard extends Base {
25
29
  render() {
26
30
  var _a, _b;
27
31
  return html `
28
- <div class="border border-contrast-10 rounded text-s">
32
+ <div
33
+ class=${classMap({
34
+ 'border border-contrast-10 rounded text-s': true,
35
+ 'text-disabled': this.disabled,
36
+ })}
37
+ >
29
38
  <div class="h-m flex justify-between items-center border-b border-contrast-10">
30
39
  <div class="ml-m">
31
40
  <span>${this.name || this.code}</span>
@@ -33,8 +42,16 @@ export class CountryCard extends Base {
33
42
  </div>
34
43
 
35
44
  <button
36
- class="mr-xs flex items-center justify-center rounded-full transition-colors hover-bg-error-10 hover-text-error focus-outline-none focus-ring-2 focus-ring-inset focus-ring-error-50"
45
+ class=${classMap({
46
+ 'mr-xs items-center justify-center rounded-full transition-colors': true,
47
+ 'hover-bg-error-10 hover-text-error': !this.disabled,
48
+ 'focus-outline-none focus-ring-2 ring-inset ring-error-50': !this.disabled,
49
+ 'cursor-default': this.disabled,
50
+ 'flex': !this.readonly,
51
+ 'hidden': this.readonly,
52
+ })}
37
53
  style="width: calc(var(--lumo-size-s) - 2px); height: calc(var(--lumo-size-s) - 2px)"
54
+ ?disabled=${this.disabled}
38
55
  @click=${() => this.dispatchEvent(new CustomEvent('delete'))}
39
56
  >
40
57
  <iron-icon icon="icons:close" class="icon-inline text-m"></iron-icon>
@@ -57,8 +74,16 @@ export class CountryCard extends Base {
57
74
  </span>
58
75
 
59
76
  <button
60
- class="flex items-center justify-center rounded-full transition-colors hover-bg-error-10 hover-text-error focus-outline-none focus-ring-2 focus-ring-inset focus-ring-error-50"
77
+ class=${classMap({
78
+ 'items-center justify-center rounded-full transition-colors': true,
79
+ 'hover-bg-error-10 hover-text-error': !this.disabled,
80
+ 'focus-outline-none focus-ring-2 ring-inset ring-error-50': !this.disabled,
81
+ 'cursor-default': this.disabled,
82
+ 'flex': !this.readonly,
83
+ 'hidden': this.readonly,
84
+ })}
61
85
  style="width: calc(var(--lumo-size-s) - 2px); height: calc(var(--lumo-size-s) - 2px)"
86
+ ?disabled=${this.disabled}
62
87
  @click=${() => {
63
88
  this.regions = this.regions.filter(value => value !== region);
64
89
  this.dispatchEvent(new CustomEvent('update:regions'));
@@ -71,8 +96,14 @@ export class CountryCard extends Base {
71
96
  })}
72
97
 
73
98
  <div
74
- class="h-s m-xs flex items-center transition-colors border border-contrast-10 hover-border-contrast-40 focus-within-ring-1 focus-within-ring-primary-50 focus-within-border-primary-50"
75
99
  style="border-radius: var(--lumo-size-s)"
100
+ class=${classMap({
101
+ 'h-s m-xs items-center transition-colors border border-contrast-10': true,
102
+ 'hover-border-contrast-40': !this.disabled,
103
+ 'focus-within-ring-1 ring-primary-50 focus-within-border-primary-50': !this.disabled,
104
+ 'flex': !this.readonly,
105
+ 'hidden': this.readonly,
106
+ })}
76
107
  >
77
108
  <input
78
109
  placeholder=${this.t('add_region')}
@@ -80,6 +111,7 @@ export class CountryCard extends Base {
80
111
  style="width: 8rem"
81
112
  list="list"
82
113
  .value=${this.region}
114
+ ?disabled=${this.disabled}
83
115
  @keydown=${(evt) => {
84
116
  if (evt.key === 'Enter' && this.region)
85
117
  this.__addRegion();
@@ -1 +1 @@
1
- {"version":3,"file":"CountryCard.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateConfigForm/CountryCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAIlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,IAAI,GAAG,iBAAiB,CAAC,cAAc,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAElF,MAAM,OAAO,WAAY,SAAQ,IAA4B;IAA7D;;QAWE,YAAO,GAAa,EAAE,CAAC;QAEvB,WAAM,GAAG,EAAE,CAAC;QAEZ,SAAI,GAAG,EAAE,CAAC;QAEV,SAAI,GAAG,EAAE,CAAC;IAoGZ,CAAC;IApHC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;YACxB,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACxB,IAAI,EAAE,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CAAC;uBACQ,CAAC,GAAe,EAAE,EAAE;YAC3B,MAAM,MAAM,GAAG,GAAG,CAAC,aAAiC,CAAC;YACrD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC;QAC7B,CAAC;;;;;sBAKO,QAAQ,CAAC;YACf,eAAe,EAAE,IAAI;YACrB,iEAAiE,EAAE,IAAI;YACvE,4CAA4C,EAAE,CAAC,IAAI,CAAC,MAAM;YAC1D,2CAA2C,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM;YAC1D,8CAA8C,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM;YAC7D,4DAA4D,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM;SAC5E,CAAC;0BACU,CAAC,IAAI,CAAC,MAAM;uBACf,IAAI,CAAC,WAAW;;;;;;;cAOzB,MAAM,CAAC,MAAM,aAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YACpD,OAAO,IAAI,CAAA,iBAAiB,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,OAAO,WAAW,CAAC;QACvE,CAAC,CAAC;;;;KAIT,CAAC;IACJ,CAAC;IAEO,WAAW;QACjB,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACxD,CAAC;CACF","sourcesContent":["import { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst Base = ConfigurableMixin(ThemeableMixin(TranslatableMixin(NucleonElement)));\n\nexport class CountryCard extends Base<Resource<Rels.Regions>> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n regions: { type: Array },\n region: { type: String },\n name: { type: String },\n code: { type: String },\n };\n }\n\n regions: string[] = [];\n\n region = '';\n\n name = '';\n\n code = '';\n\n render(): TemplateResult {\n return html`\n <div class=\"border border-contrast-10 rounded text-s\">\n <div class=\"h-m flex justify-between items-center border-b border-contrast-10\">\n <div class=\"ml-m\">\n <span>${this.name || this.code}</span>\n ${this.name ? html`<span class=\"text-secondary\">${this.code}</span>` : ''}\n </div>\n\n <button\n class=\"mr-xs flex items-center justify-center rounded-full transition-colors hover-bg-error-10 hover-text-error focus-outline-none focus-ring-2 focus-ring-inset focus-ring-error-50\"\n style=\"width: calc(var(--lumo-size-s) - 2px); height: calc(var(--lumo-size-s) - 2px)\"\n @click=${() => this.dispatchEvent(new CustomEvent('delete'))}\n >\n <iron-icon icon=\"icons:close\" class=\"icon-inline text-m\"></iron-icon>\n </button>\n </div>\n\n <div class=\"flex flex-wrap p-xs\">\n ${this.regions.map(region => {\n const name = this.data?.values[region]?.default;\n const code = region;\n\n return html`\n <div\n class=\"flex items-center border border-contrast-10 h-s m-xs\"\n style=\"border-radius: var(--lumo-size-s)\"\n >\n <span class=\"mx-s\">\n <span>${name || code}</span>\n ${name ? html`<span class=\"text-secondary\">${code}</span>` : ''}\n </span>\n\n <button\n class=\"flex items-center justify-center rounded-full transition-colors hover-bg-error-10 hover-text-error focus-outline-none focus-ring-2 focus-ring-inset focus-ring-error-50\"\n style=\"width: calc(var(--lumo-size-s) - 2px); height: calc(var(--lumo-size-s) - 2px)\"\n @click=${() => {\n this.regions = this.regions.filter(value => value !== region);\n this.dispatchEvent(new CustomEvent('update:regions'));\n }}\n >\n <iron-icon icon=\"icons:close\" class=\"icon-inline text-m\"></iron-icon>\n </button>\n </div>\n `;\n })}\n\n <div\n class=\"h-s m-xs flex items-center transition-colors border border-contrast-10 hover-border-contrast-40 focus-within-ring-1 focus-within-ring-primary-50 focus-within-border-primary-50\"\n style=\"border-radius: var(--lumo-size-s)\"\n >\n <input\n placeholder=${this.t('add_region')}\n class=\"bg-transparent appearance-none h-s text-s px-s focus-outline-none\"\n style=\"width: 8rem\"\n list=\"list\"\n .value=${this.region}\n @keydown=${(evt: KeyboardEvent) => {\n if (evt.key === 'Enter' && this.region) this.__addRegion();\n }}\n @input=${(evt: InputEvent) => {\n const target = evt.currentTarget as HTMLInputElement;\n this.region = target.value;\n }}\n />\n\n <button\n style=\"width: calc(var(--lumo-size-s) - 2px); height: calc(var(--lumo-size-s) - 2px)\"\n class=${classMap({\n 'flex-shrink-0': true,\n 'flex items-center justify-center rounded-full transition-colors': true,\n 'bg-contrast-5 text-disabled cursor-default': !this.region,\n 'bg-success-10 text-success cursor-pointer': !!this.region,\n 'hover-bg-success hover-text-success-contrast': !!this.region,\n 'focus-outline-none focus-ring-2 ring-inset ring-success-50': !!this.region,\n })}\n ?disabled=${!this.region}\n @click=${this.__addRegion}\n >\n <iron-icon icon=\"icons:add\" class=\"icon-inline text-m\"></iron-icon>\n </button>\n </div>\n\n <datalist id=\"list\">\n ${Object.values(this.data?.values ?? {}).map(region => {\n return html`<option value=${region.code}>${region.default}</option>`;\n })}\n </datalist>\n </div>\n </div>\n `;\n }\n\n private __addRegion() {\n this.regions = [...new Set([...this.regions, this.region])];\n this.region = '';\n this.dispatchEvent(new CustomEvent('update:regions'));\n }\n}\n"]}
1
+ {"version":3,"file":"CountryCard.js","sourceRoot":"","sources":["../../../../src/elements/public/TemplateConfigForm/CountryCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE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CAAC;IACJ,CAAC;IAEO,WAAW;QACjB,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACxD,CAAC;CACF","sourcesContent":["import { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst Base = ConfigurableMixin(ThemeableMixin(TranslatableMixin(NucleonElement)));\n\nexport class CountryCard extends Base<Resource<Rels.Regions>> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n disabled: { type: Boolean },\n readonly: { type: Boolean },\n regions: { type: Array },\n region: { type: String },\n name: { type: String },\n code: { type: String },\n };\n }\n\n disabled = false;\n\n readonly = false;\n\n regions: string[] = [];\n\n region = '';\n\n name = '';\n\n code = '';\n\n render(): TemplateResult {\n return html`\n <div\n class=${classMap({\n 'border border-contrast-10 rounded text-s': true,\n 'text-disabled': this.disabled,\n })}\n >\n <div class=\"h-m flex justify-between items-center border-b border-contrast-10\">\n <div class=\"ml-m\">\n <span>${this.name || this.code}</span>\n ${this.name ? html`<span class=\"text-secondary\">${this.code}</span>` : ''}\n </div>\n\n <button\n class=${classMap({\n 'mr-xs items-center justify-center rounded-full transition-colors': true,\n 'hover-bg-error-10 hover-text-error': !this.disabled,\n 'focus-outline-none focus-ring-2 ring-inset ring-error-50': !this.disabled,\n 'cursor-default': this.disabled,\n 'flex': !this.readonly,\n 'hidden': this.readonly,\n })}\n style=\"width: calc(var(--lumo-size-s) - 2px); height: calc(var(--lumo-size-s) - 2px)\"\n ?disabled=${this.disabled}\n @click=${() => this.dispatchEvent(new CustomEvent('delete'))}\n >\n <iron-icon icon=\"icons:close\" class=\"icon-inline text-m\"></iron-icon>\n </button>\n </div>\n\n <div class=\"flex flex-wrap p-xs\">\n ${this.regions.map(region => {\n const name = this.data?.values[region]?.default;\n const code = region;\n\n return html`\n <div\n class=\"flex items-center border border-contrast-10 h-s m-xs\"\n style=\"border-radius: var(--lumo-size-s)\"\n >\n <span class=\"mx-s\">\n <span>${name || code}</span>\n ${name ? html`<span class=\"text-secondary\">${code}</span>` : ''}\n </span>\n\n <button\n class=${classMap({\n 'items-center justify-center rounded-full transition-colors': true,\n 'hover-bg-error-10 hover-text-error': !this.disabled,\n 'focus-outline-none focus-ring-2 ring-inset ring-error-50': !this.disabled,\n 'cursor-default': this.disabled,\n 'flex': !this.readonly,\n 'hidden': this.readonly,\n })}\n style=\"width: calc(var(--lumo-size-s) - 2px); height: calc(var(--lumo-size-s) - 2px)\"\n ?disabled=${this.disabled}\n @click=${() => {\n this.regions = this.regions.filter(value => value !== region);\n this.dispatchEvent(new CustomEvent('update:regions'));\n }}\n >\n <iron-icon icon=\"icons:close\" class=\"icon-inline text-m\"></iron-icon>\n </button>\n </div>\n `;\n })}\n\n <div\n style=\"border-radius: var(--lumo-size-s)\"\n class=${classMap({\n 'h-s m-xs items-center transition-colors border border-contrast-10': true,\n 'hover-border-contrast-40': !this.disabled,\n 'focus-within-ring-1 ring-primary-50 focus-within-border-primary-50': !this.disabled,\n 'flex': !this.readonly,\n 'hidden': this.readonly,\n })}\n >\n <input\n placeholder=${this.t('add_region')}\n class=\"bg-transparent appearance-none h-s text-s px-s focus-outline-none\"\n style=\"width: 8rem\"\n list=\"list\"\n .value=${this.region}\n ?disabled=${this.disabled}\n @keydown=${(evt: KeyboardEvent) => {\n if (evt.key === 'Enter' && this.region) this.__addRegion();\n }}\n @input=${(evt: InputEvent) => {\n const target = evt.currentTarget as HTMLInputElement;\n this.region = target.value;\n }}\n />\n\n <button\n style=\"width: calc(var(--lumo-size-s) - 2px); height: calc(var(--lumo-size-s) - 2px)\"\n class=${classMap({\n 'flex-shrink-0': true,\n 'flex items-center justify-center rounded-full transition-colors': true,\n 'bg-contrast-5 text-disabled cursor-default': !this.region,\n 'bg-success-10 text-success cursor-pointer': !!this.region,\n 'hover-bg-success hover-text-success-contrast': !!this.region,\n 'focus-outline-none focus-ring-2 ring-inset ring-success-50': !!this.region,\n })}\n ?disabled=${!this.region}\n @click=${this.__addRegion}\n >\n <iron-icon icon=\"icons:add\" class=\"icon-inline text-m\"></iron-icon>\n </button>\n </div>\n\n <datalist id=\"list\">\n ${Object.values(this.data?.values ?? {}).map(region => {\n return html`<option value=${region.code}>${region.default}</option>`;\n })}\n </datalist>\n </div>\n </div>\n `;\n }\n\n private __addRegion() {\n this.regions = [...new Set([...this.regions, this.region])];\n this.region = '';\n this.dispatchEvent(new CustomEvent('update:regions'));\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Data } from './types';
1
+ import { Data, Templates } from './types';
2
2
  import { ScopedElementsMap } from '@open-wc/scoped-elements';
3
3
  import { TemplateResult } from 'lit-html';
4
4
  import { NucleonElement } from '../NucleonElement/NucleonElement';
@@ -8,10 +8,64 @@ declare const Base: typeof NucleonElement & import("lit-element").Constructor<im
8
8
  } & {
9
9
  styles: import("lit-element").CSSResultArray;
10
10
  } & import("lit-element").Constructor<import("../../../mixins/configurable").ConfigurableMixinHost> & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/src/types").ScopedElementsHost>;
11
+ /**
12
+ * Form element for creating or editing template configs (`fx:template_config`).
13
+ *
14
+ * @slot cart-type:before
15
+ * @slot cart-type:after
16
+ *
17
+ * @slot foxycomplete:before
18
+ * @slot foxycomplete:after
19
+ *
20
+ * @slot locations:before
21
+ * @slot locations:after
22
+ *
23
+ * @slot hidden-fields:before
24
+ * @slot hidden-fields:after
25
+ *
26
+ * @slot cards:before
27
+ * @slot cards:after
28
+ *
29
+ * @slot checkout-type:before
30
+ * @slot checkout-type:after
31
+ *
32
+ * @slot consent:before
33
+ * @slot consent:after
34
+ *
35
+ * @slot fields:before
36
+ * @slot fields:after
37
+ *
38
+ * @slot google-analytics:before
39
+ * @slot google-analytics:after
40
+ *
41
+ * @slot segment-io:before
42
+ * @slot segment-io:after
43
+ *
44
+ * @slot troubleshooting:before
45
+ * @slot troubleshooting:after
46
+ *
47
+ * @slot custom-config:before
48
+ * @slot custom-config:after
49
+ *
50
+ * @slot header:before
51
+ * @slot header:after
52
+ *
53
+ * @slot custom-fields:before
54
+ * @slot custom-fields:after
55
+ *
56
+ * @slot footer:before
57
+ * @slot footer:after
58
+ *
59
+ * @element foxy-template-config-form
60
+ * @since 1.14.0
61
+ */
11
62
  export declare class TemplateConfigForm extends Base<Data> {
12
63
  static get scopedElements(): ScopedElementsMap;
13
64
  static get properties(): PropertyDeclarations;
65
+ templates: Templates;
66
+ /** URI of the `fx:countries` hAPI resource. */
14
67
  countries: string;
68
+ /** URI of the `fx:regions` hAPI resource. */
15
69
  regions: string;
16
70
  private __addHiddenFieldInputValue;
17
71
  render(): TemplateResult;