@foxy.io/elements 1.14.0-beta.8 → 1.14.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.
Files changed (94) 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 +1 -1
  15. package/dist/cdn/foxy-customer-portal.js +18 -15
  16. package/dist/cdn/foxy-customer.js +1 -1
  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 +1 -1
  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 -1
  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-4ba926ca.js → shared-07abcd7b.js} +1 -1
  43. package/dist/cdn/{shared-31d03530.js → shared-1f1734cb.js} +1 -1
  44. package/dist/cdn/{shared-ca7c3b9a.js → shared-322e60b1.js} +1 -1
  45. package/dist/cdn/{shared-7007dedb.js → shared-5f54e916.js} +1 -1
  46. package/dist/cdn/{shared-0f9809ab.js → shared-66cb6a36.js} +1 -1
  47. package/dist/cdn/{shared-a3d2c48e.js → shared-6ebe3825.js} +1 -1
  48. package/dist/cdn/{shared-5d94bacb.js → shared-74b9e1d1.js} +1 -1
  49. package/dist/cdn/{shared-00070cc4.js → shared-7a42073a.js} +5 -5
  50. package/dist/cdn/{shared-b24377bf.js → shared-8a7bee0d.js} +1 -1
  51. package/dist/cdn/{shared-da787055.js → shared-91e768be.js} +1 -1
  52. package/dist/cdn/{shared-d01035c5.js → shared-9a40309d.js} +1 -1
  53. package/dist/cdn/shared-9c099da6.js +1 -0
  54. package/dist/cdn/{shared-daf6b763.js → shared-b1fc5dc3.js} +1 -1
  55. package/dist/cdn/{shared-d05c93a5.js → shared-bc2bfe52.js} +1 -1
  56. package/dist/cdn/{shared-c5ae5d33.js → shared-ce1da35d.js} +1 -1
  57. package/dist/cdn/{shared-007c4e34.js → shared-f1dc1c6c.js} +1 -1
  58. package/dist/cdn/translations/shared/de.json +94 -0
  59. package/dist/cdn/translations/shared/en.json +83 -83
  60. package/dist/cdn/translations/shared/es.json +93 -0
  61. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.d.ts +1 -0
  62. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.js +17 -8
  63. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLink.js.map +1 -1
  64. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.js +19 -6
  65. package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedInView.js.map +1 -1
  66. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +11 -3
  67. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
  68. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.d.ts +21 -0
  69. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +21 -0
  70. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
  71. package/dist/elements/public/I18n/I18n.js +1 -1
  72. package/dist/elements/public/I18n/I18n.js.map +1 -1
  73. package/dist/elements/public/ItemsForm/private/Picture.d.ts +1 -0
  74. package/dist/elements/public/ItemsForm/private/Picture.js +2 -0
  75. package/dist/elements/public/ItemsForm/private/Picture.js.map +1 -1
  76. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +12 -4
  77. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
  78. package/dist/elements/public/TemplateConfigForm/CountriesList.d.ts +2 -4
  79. package/dist/elements/public/TemplateConfigForm/CountriesList.js +19 -20
  80. package/dist/elements/public/TemplateConfigForm/CountriesList.js.map +1 -1
  81. package/dist/elements/public/TemplateConfigForm/CountryCard.d.ts +1 -3
  82. package/dist/elements/public/TemplateConfigForm/CountryCard.js +21 -18
  83. package/dist/elements/public/TemplateConfigForm/CountryCard.js.map +1 -1
  84. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +184 -166
  85. package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
  86. package/dist/elements/public/TemplateForm/TemplateForm.d.ts +21 -0
  87. package/dist/elements/public/TemplateForm/TemplateForm.js +21 -0
  88. package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -1
  89. package/dist/mixins/themeable.js +10 -8
  90. package/dist/mixins/themeable.js.map +1 -1
  91. package/dist/mixins/translatable.js +1 -1
  92. package/dist/mixins/translatable.js.map +1 -1
  93. package/package.json +1 -1
  94. package/dist/cdn/shared-fe8a7aa2.js +0 -1
@@ -1027,6 +1027,12 @@ input::-webkit-date-and-time-value{
1027
1027
  cursor: text;
1028
1028
  }
1029
1029
 
1030
+ @media (hover: hover) {
1031
+ .hover-cursor-pointer:hover {
1032
+ cursor: pointer;
1033
+ }
1034
+ }
1035
+
1030
1036
  .disabled-cursor-default:disabled {
1031
1037
  cursor: default;
1032
1038
  }
@@ -1749,10 +1755,6 @@ input::-webkit-date-and-time-value{
1749
1755
  }
1750
1756
  }
1751
1757
 
1752
- .focus-text-primary:focus {
1753
- color: var(--lumo-primary-text-color, hsl(214, 90%, 52%));
1754
- }
1755
-
1756
1758
  .focus-text-body:focus {
1757
1759
  color: var(--lumo-body-text-color, hsla(214, 40%, 16%, 0.94));
1758
1760
  }
@@ -1910,12 +1912,12 @@ input::-webkit-date-and-time-value{
1910
1912
  --tw-ring-color: var(--lumo-primary-color-50pct, hsla(214, 90%, 52%, 0.5));
1911
1913
  }
1912
1914
 
1913
- .ring-offset-4 {
1914
- --tw-ring-offset-width: 4px;
1915
+ .ring-offset-2 {
1916
+ --tw-ring-offset-width: 2px;
1915
1917
  }
1916
1918
 
1917
- .focus-ring-offset-2:focus {
1918
- --tw-ring-offset-width: 2px;
1919
+ .ring-offset-4 {
1920
+ --tw-ring-offset-width: 4px;
1919
1921
  }
1920
1922
 
1921
1923
  .ring-offset-base {
@@ -1 +1 @@
1
- {"version":3,"file":"themeable.js","sourceRoot":"","sources":["../../src/mixins/themeable.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAA0C,UAAU,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEtF,OAAO,EAAE,eAAe,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqHF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,OAAgB,SAAU,SAAQ,mBAAmB,CACzD,eAAe,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAC5C;CAAG","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n\nimport { CSSResult, CSSResultArray, Constructor, LitElement, css } from 'lit-element';\n\nimport { ResponsiveMixin } from './responsive';\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements';\n\ntype Base = Constructor<LitElement> & { styles?: CSSResult | CSSResultArray | CSSStyleSheet };\n\nexport const ThemeableMixin = <TBase extends Base>(\n BaseElement: TBase\n): TBase & { styles: CSSResultArray } => {\n return class ThemeableElement extends BaseElement {\n static get styles(): CSSResultArray {\n const originalCSS = super.styles;\n\n return [\n ...(originalCSS ? (Array.isArray(originalCSS) ? originalCSS : [originalCSS]) : []),\n css`\n @tailwind base;\n\n * {\n -webkit-tap-highlight-color: transparent;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n\n :host {\n display: block;\n }\n\n details > summary::-webkit-details-marker {\n display: none;\n }\n\n details > summary {\n list-style: none;\n }\n\n vaadin-select {\n margin-top: -4px;\n margin-bottom: -4px;\n }\n\n vaadin-text-area,\n vaadin-text-field,\n vaadin-date-picker,\n vaadin-email-field,\n vaadin-number-field,\n vaadin-custom-field,\n vaadin-integer-field,\n vaadin-password-field,\n vaadin-combo-box::part(text-field) {\n padding-top: 0;\n padding-bottom: 0;\n }\n\n vaadin-date-picker::part(text-field) {\n padding-top: 0;\n padding-bottom: 0;\n }\n\n vaadin-button {\n margin: 0;\n }\n\n vaadin-checkbox::part(checkbox) {\n margin: 0;\n }\n\n vaadin-checkbox::part(label) {\n margin: 0.1875em var(--lumo-space-m);\n }\n\n .appearance-none {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n }\n\n .appearance-none::-webkit-calendar-picker-indicator,\n .appearance-none::-webkit-outer-spin-button,\n .appearance-none::-webkit-inner-spin-button,\n .appearance-none::-webkit-list-button {\n opacity: 0 !important;\n width: 0 !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n\n input::-webkit-date-and-time-value {\n text-align: inherit !important;\n }\n\n @tailwind components;\n\n @tailwind utilities;\n\n @layer utilities {\n .border-radius-overflow-fix {\n -webkit-mask-image: -webkit-radial-gradient(white, black);\n }\n\n @variants sm, md, lg, xl {\n .grid-rows-auto {\n grid-auto-rows: 1fr;\n }\n\n .icon-inline {\n --iron-icon-height: 1em;\n --iron-icon-width: 1em;\n }\n\n .bg-blurred {\n backdrop-filter: blur(25px);\n background: var(--lumo-tint-80pct);\n }\n\n .max-w-modal {\n max-width: 28rem;\n }\n\n .w-narrow-modal {\n width: 18rem;\n }\n\n .snap-x-mandatory {\n scroll-snap-type: x mandatory;\n }\n\n .snap-start {\n scroll-snap-align: start;\n }\n }\n }\n `,\n ];\n }\n };\n};\n\n/**\n * One of the base classes for each rel-specific element in the collection\n * providing shared TailwindCSS styles for Shadow DOM content.\n * This class MUST NOT be used on its own (hence the `abstract` keyword) or\n * referenced externally (outside of the package).\n *\n * @deprecated\n */\nexport abstract class Themeable extends ScopedElementsMixin(\n ResponsiveMixin(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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqHF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,OAAgB,SAAU,SAAQ,mBAAmB,CACzD,eAAe,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAC5C;CAAG","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n\nimport { CSSResult, CSSResultArray, Constructor, LitElement, css } from 'lit-element';\n\nimport { ResponsiveMixin } from './responsive';\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements';\n\ntype Base = Constructor<LitElement> & { styles?: CSSResult | CSSResultArray | CSSStyleSheet };\n\nexport const ThemeableMixin = <TBase extends Base>(\n BaseElement: TBase\n): TBase & { styles: CSSResultArray } => {\n return class ThemeableElement extends BaseElement {\n static get styles(): CSSResultArray {\n const originalCSS = super.styles;\n\n return [\n ...(originalCSS ? (Array.isArray(originalCSS) ? originalCSS : [originalCSS]) : []),\n css`\n @tailwind base;\n\n * {\n -webkit-tap-highlight-color: transparent;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n\n :host {\n display: block;\n }\n\n details > summary::-webkit-details-marker {\n display: none;\n }\n\n details > summary {\n list-style: none;\n }\n\n vaadin-select {\n margin-top: -4px;\n margin-bottom: -4px;\n }\n\n vaadin-text-area,\n vaadin-text-field,\n vaadin-date-picker,\n vaadin-email-field,\n vaadin-number-field,\n vaadin-custom-field,\n vaadin-integer-field,\n vaadin-password-field,\n vaadin-combo-box::part(text-field) {\n padding-top: 0;\n padding-bottom: 0;\n }\n\n vaadin-date-picker::part(text-field) {\n padding-top: 0;\n padding-bottom: 0;\n }\n\n vaadin-button {\n margin: 0;\n }\n\n vaadin-checkbox::part(checkbox) {\n margin: 0;\n }\n\n vaadin-checkbox::part(label) {\n margin: 0.1875em var(--lumo-space-m);\n }\n\n .appearance-none {\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n }\n\n .appearance-none::-webkit-calendar-picker-indicator,\n .appearance-none::-webkit-outer-spin-button,\n .appearance-none::-webkit-inner-spin-button,\n .appearance-none::-webkit-list-button {\n opacity: 0 !important;\n width: 0 !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n\n input::-webkit-date-and-time-value {\n text-align: inherit !important;\n }\n\n @tailwind components;\n\n @tailwind utilities;\n\n @layer utilities {\n .border-radius-overflow-fix {\n -webkit-mask-image: -webkit-radial-gradient(white, black);\n }\n\n @variants sm, md, lg, xl {\n .grid-rows-auto {\n grid-auto-rows: 1fr;\n }\n\n .icon-inline {\n --iron-icon-height: 1em;\n --iron-icon-width: 1em;\n }\n\n .bg-blurred {\n backdrop-filter: blur(25px);\n background: var(--lumo-tint-80pct);\n }\n\n .max-w-modal {\n max-width: 28rem;\n }\n\n .w-narrow-modal {\n width: 18rem;\n }\n\n .snap-x-mandatory {\n scroll-snap-type: x mandatory;\n }\n\n .snap-start {\n scroll-snap-align: start;\n }\n }\n }\n `,\n ];\n }\n };\n};\n\n/**\n * One of the base classes for each rel-specific element in the collection\n * providing shared TailwindCSS styles for Shadow DOM content.\n * This class MUST NOT be used on its own (hence the `abstract` keyword) or\n * referenced externally (outside of the package).\n *\n * @deprecated\n */\nexport abstract class Themeable extends ScopedElementsMixin(\n ResponsiveMixin(ThemeableMixin(LitElement))\n) {}\n"]}
@@ -164,7 +164,7 @@ export const TranslatableMixin = (BaseElement, defaultNS = '') => {
164
164
  .map((v, i, a) => `${v}:${[...a.slice(i + 1), key].join('.')}`),
165
165
  `shared:${key}`,
166
166
  ];
167
- return I18nElement.i18next.t(keys, options).toString();
167
+ return I18nElement.i18next.t(keys, { lng: this.lang, ...options }).toString();
168
168
  };
169
169
  }
170
170
  static get properties() {
@@ -1 +1 @@
1
- {"version":3,"file":"translatable.js","sourceRoot":"","sources":["../../src/mixins/translatable.ts"],"names":[],"mappings":"AACA,OAAO,OAAuD,MAAM,SAAS,CAAC;AAE9E,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,uBAAoB;AACxC,OAAO,EAAE,GAAG,EAAE,kBAAe;AAE7B;;;;;;;GAOG;AACH,MAAM,OAAgB,YAAa,SAAQ,SAAS;IA+DlD;;;;;OAKG;IACH,YAAY,SAAS,GAAG,QAAQ;QAC9B,KAAK,EAAE,CAAC;QAXF,WAAM,GAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAwB,CAAC,CAAC,CAAC,CAAC;QAEzD,SAAI,GAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAuB,CAAC,CAAC,CAAC,CAAC;QAU5D,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC;QACpB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IACvD,CAAC;IAxED,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,U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AAC,WAAW,CAA4B,CAAC;YAC/E,IAAI,CAAC,qBAAqB,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,mBAAmB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QAC5F,CAAC;QAED,gBAAgB;QAChB,OAAO,CAAC,iBAA2C;YACjD,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAEjC,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,WAAW,CAA4B,CAAC;YAC/E,IAAI,CAAC,WAAW;gBAAE,OAAO;YAEzB,IAAI,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,WAAW,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChF,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1F,CAAC;QAED,oBAAoB;;YAClB,KAAK,CAAC,oBAAoB,EAAE,CAAC;YAC7B,MAAA,IAAI,CAAC,qBAAqB,+CAA1B,IAAI,EAA2B;QACjC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Constructor, LitElement, PropertyDeclarations } from 'lit-element';\nimport i18next, { FormatFunction, StringMap, TFunction, i18n } from 'i18next';\n\nimport HttpApi from 'i18next-http-backend';\nimport { I18n } from '../elements/public/I18n/I18n';\nimport { Themeable } from './themeable';\nimport { cdn } from '../env';\n\n/**\n * One of the base classes for each rel-specific element in the collection,\n * providing internationalization capabilities to the derived components.\n * This class MUST NOT be used on its own (hence the `abstract` keyword) or\n * referenced externally (outside of the package).\n *\n * @deprecated\n */\nexport abstract class Translatable extends Themeable {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n lang: { type: String, noAccessor: true },\n ns: { type: String, noAccessor: true },\n };\n }\n\n /**\n * i18next formatter that converts given value to lowecase.\n * @see https://www.i18next.com/translation-function/formatting\n */\n private static __fLowercase: FormatFunction = (value): string => {\n return value.toLowerCase();\n };\n\n /**\n * i18next formatter that presents an array of serializable items\n * as `[0], [1], [...] and [length - 1]`. For example, given an array like\n * the following: `['a', 'b', 'c']`, it will output `'a, b and c'`.\n * @see https://www.i18next.com/translation-function/formatting\n */\n private static __fList: FormatFunction = (value): string => {\n return (value as string[])\n .map((v, i, a) => {\n if (i === 0) return v;\n const part = i === a.length - 1 ? ` $t(and) ` : ',';\n return `${part} ${v}`;\n })\n .join('');\n };\n\n /**\n * Chooses the right i18next formatter for the given template.\n * @see https://www.i18next.com/translation-function/formatting\n */\n private static __f: FormatFunction = (...args): string => {\n const value = args[0];\n const formats = args[1]?.split(' ') ?? [];\n\n return formats.reduce((result, format) => {\n switch (format) {\n case 'lowercase':\n return Translatable.__fLowercase(result);\n case 'list':\n return Translatable.__fList(result);\n default:\n return result;\n }\n }, value);\n };\n\n private static __whenI18NReady: Promise<TFunction>;\n\n private static __isI18NReady = false;\n\n private static __i18n: i18n;\n\n private __lang = (this._i18n.options.fallbackLng as string[])[0];\n\n private __ns = (this._i18n.options.fallbackNS as string[])[0];\n\n /**\n * Creates class instance and starts loading missing translations\n * in background. Triggers render when ready.\n *\n * @param defaultNS Name of the folder translations for this component are stored in. Usually a node name without vendor prefix.\n */\n constructor(defaultNS = 'global') {\n super();\n this.ns = defaultNS;\n this._whenI18nReady.then(() => this.requestUpdate());\n }\n\n /**\n * Contains the language this component presents its translatable\n * content in. Assigning a value to this property will load new\n * translations in background and trigger a render afterwards.\n *\n * **Example:** `\"en\"`\n */\n public get lang(): string {\n return this.__lang;\n }\n\n public set lang(value: string) {\n if (!value || value === 'undefined') return;\n this.__lang = value;\n this._i18n.loadLanguages(value).then(() => {\n if (this.__lang === value) this.requestUpdate();\n });\n }\n\n /**\n * The namespace to look for the translations in. We use this property to\n * sync namespace settings with the parent element and it's highly unlikely\n * that you'll ever need to set or read it in your code.\n *\n * **Example:** `\"admin\"`\n */\n public get ns(): string {\n return this.__ns;\n }\n\n public set ns(value: string) {\n this.__ns = value;\n this._i18n.loadNamespaces(value).then(() => {\n if (this.__ns === value) this.requestUpdate();\n });\n }\n\n private static __initI18N() {\n this.__i18n = i18next.createInstance();\n this.__i18n.use(HttpApi);\n\n this.__whenI18NReady = this.__i18n.init({\n ns: ['global'],\n supportedLngs: ['nl', 'en', 'es', 'sv', 'fi', 'fr', 'de', 'zh', 'no', 'it'],\n interpolation: { format: Translatable.__f },\n fallbackLng: 'en',\n fallbackNS: 'global',\n defaultNS: 'global',\n detection: {\n order: ['querystring', 'navigator', 'htmlTag', 'path', 'subdomain'],\n caches: [],\n },\n backend: {\n loadPath: `${cdn}/translations/{{ns}}/{{lng}}.json`,\n },\n });\n\n this.__whenI18NReady.then(() => (this.__isI18NReady = true));\n\n return this.__i18n;\n }\n\n protected get _i18n(): i18n {\n return Translatable.__i18n ?? Translatable.__initI18N();\n }\n\n protected get _whenI18nReady(): Promise<TFunction> {\n return Translatable.__whenI18NReady;\n }\n\n protected get _isI18nReady(): boolean {\n return Translatable.__isI18NReady;\n }\n\n protected get _t(): TFunction {\n const ns = [this.__ns, this._i18n.options.fallbackNS as string];\n return this._i18n.getFixedT(this.__lang, ns);\n }\n}\n\ntype Base = Constructor<LitElement> & { properties?: PropertyDeclarations };\ntype Translator = (key: string, options?: StringMap) => string;\n\nexport declare class TranslatableMixinHost {\n /** Optional ISO 639-1 code describing the language element content is written in. */\n lang: string;\n\n /**\n * Namespace used by this element.\n * @since 1.4.0\n */\n ns: string;\n\n /**\n * Translation function from i18next fixed to the current language and element namespace.\n * @since 1.4.0\n */\n get t(): Translator;\n}\n\nexport const TranslatableMixin = <T extends Base>(\n BaseElement: T,\n defaultNS = ''\n): T & Constructor<TranslatableMixinHost> & { defaultNS: string } => {\n return class TranslatableElement extends BaseElement {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n lang: { type: String },\n ns: { type: String },\n };\n }\n\n static get defaultNS(): string {\n return defaultNS;\n }\n\n lang = '';\n\n ns = defaultNS;\n\n t: Translator = (key, options) => {\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\n\n if (!I18nElement) return key;\n\n const keys = [\n ...[defaultNS, ...this.ns.split(' ').reverse()]\n .map(v => v.trim())\n .filter((v, i, a) => a.indexOf(v) === i && v.length > 0)\n .reverse()\n .map((v, i, a) => `${v}:${[...a.slice(i + 1), key].join('.')}`),\n `shared:${key}`,\n ];\n\n return I18nElement.i18next.t(keys, options).toString();\n };\n\n private __untrackTranslations?: () => void;\n\n connectedCallback(): void {\n super.connectedCallback();\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\n this.__untrackTranslations = I18nElement?.onTranslationChange(() => this.requestUpdate());\n }\n\n /** @readonly */\n updated(changedProperties: Map<keyof I18n, unknown>): void {\n super.updated(changedProperties);\n\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\n if (!I18nElement) return;\n\n if (changedProperties.has('lang')) I18nElement.i18next.loadLanguages(this.lang);\n if (changedProperties.has('ns')) I18nElement.i18next.loadNamespaces(this.ns.split(' '));\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.__untrackTranslations?.();\n }\n };\n};\n"]}
1
+ {"version":3,"file":"translatable.js","sourceRoot":"","sources":["../../src/mixins/translatable.ts"],"names":[],"mappings":"AACA,OAAO,OAAuD,MAAM,SAAS,CAAC;AAE9E,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,uBAAoB;AACxC,OAAO,EAAE,GAAG,EAAE,kBAAe;AAE7B;;;;;;;GAOG;AACH,MAAM,OAAgB,YAAa,SAAQ,SAAS;IA+DlD;;;;;OAKG;IACH,YAAY,SAAS,GAAG,QAAQ;QAC9B,KAAK,EAAE,CAAC;QAXF,WAAM,GAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAwB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'lit-element';\nimport i18next, { FormatFunction, StringMap, TFunction, i18n } from 'i18next';\n\nimport HttpApi from 'i18next-http-backend';\nimport { I18n } from '../elements/public/I18n/I18n';\nimport { Themeable } from './themeable';\nimport { cdn } from '../env';\n\n/**\n * One of the base classes for each rel-specific element in the collection,\n * providing internationalization capabilities to the derived components.\n * This class MUST NOT be used on its own (hence the `abstract` keyword) or\n * referenced externally (outside of the package).\n *\n * @deprecated\n */\nexport abstract class Translatable extends Themeable {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n lang: { type: String, noAccessor: true },\n ns: { type: String, noAccessor: true },\n };\n }\n\n /**\n * i18next formatter that converts given value to lowecase.\n * @see https://www.i18next.com/translation-function/formatting\n */\n private static __fLowercase: FormatFunction = (value): string => {\n return value.toLowerCase();\n };\n\n /**\n * i18next formatter that presents an array of serializable items\n * as `[0], [1], [...] and [length - 1]`. For example, given an array like\n * the following: `['a', 'b', 'c']`, it will output `'a, b and c'`.\n * @see https://www.i18next.com/translation-function/formatting\n */\n private static __fList: FormatFunction = (value): string => {\n return (value as string[])\n .map((v, i, a) => {\n if (i === 0) return v;\n const part = i === a.length - 1 ? ` $t(and) ` : ',';\n return `${part} ${v}`;\n })\n .join('');\n };\n\n /**\n * Chooses the right i18next formatter for the given template.\n * @see https://www.i18next.com/translation-function/formatting\n */\n private static __f: FormatFunction = (...args): string => {\n const value = args[0];\n const formats = args[1]?.split(' ') ?? [];\n\n return formats.reduce((result, format) => {\n switch (format) {\n case 'lowercase':\n return Translatable.__fLowercase(result);\n case 'list':\n return Translatable.__fList(result);\n default:\n return result;\n }\n }, value);\n };\n\n private static __whenI18NReady: Promise<TFunction>;\n\n private static __isI18NReady = false;\n\n private static __i18n: i18n;\n\n private __lang = (this._i18n.options.fallbackLng as string[])[0];\n\n private __ns = (this._i18n.options.fallbackNS as string[])[0];\n\n /**\n * Creates class instance and starts loading missing translations\n * in background. Triggers render when ready.\n *\n * @param defaultNS Name of the folder translations for this component are stored in. Usually a node name without vendor prefix.\n */\n constructor(defaultNS = 'global') {\n super();\n this.ns = defaultNS;\n this._whenI18nReady.then(() => this.requestUpdate());\n }\n\n /**\n * Contains the language this component presents its translatable\n * content in. Assigning a value to this property will load new\n * translations in background and trigger a render afterwards.\n *\n * **Example:** `\"en\"`\n */\n public get lang(): string {\n return this.__lang;\n }\n\n public set lang(value: string) {\n if (!value || value === 'undefined') return;\n this.__lang = value;\n this._i18n.loadLanguages(value).then(() => {\n if (this.__lang === value) this.requestUpdate();\n });\n }\n\n /**\n * The namespace to look for the translations in. We use this property to\n * sync namespace settings with the parent element and it's highly unlikely\n * that you'll ever need to set or read it in your code.\n *\n * **Example:** `\"admin\"`\n */\n public get ns(): string {\n return this.__ns;\n }\n\n public set ns(value: string) {\n this.__ns = value;\n this._i18n.loadNamespaces(value).then(() => {\n if (this.__ns === value) this.requestUpdate();\n });\n }\n\n private static __initI18N() {\n this.__i18n = i18next.createInstance();\n this.__i18n.use(HttpApi);\n\n this.__whenI18NReady = this.__i18n.init({\n ns: ['global'],\n supportedLngs: ['nl', 'en', 'es', 'sv', 'fi', 'fr', 'de', 'zh', 'no', 'it'],\n interpolation: { format: Translatable.__f },\n fallbackLng: 'en',\n fallbackNS: 'global',\n defaultNS: 'global',\n detection: {\n order: ['querystring', 'navigator', 'htmlTag', 'path', 'subdomain'],\n caches: [],\n },\n backend: {\n loadPath: `${cdn}/translations/{{ns}}/{{lng}}.json`,\n },\n });\n\n this.__whenI18NReady.then(() => (this.__isI18NReady = true));\n\n return this.__i18n;\n }\n\n protected get _i18n(): i18n {\n return Translatable.__i18n ?? Translatable.__initI18N();\n }\n\n protected get _whenI18nReady(): Promise<TFunction> {\n return Translatable.__whenI18NReady;\n }\n\n protected get _isI18nReady(): boolean {\n return Translatable.__isI18NReady;\n }\n\n protected get _t(): TFunction {\n const ns = [this.__ns, this._i18n.options.fallbackNS as string];\n return this._i18n.getFixedT(this.__lang, ns);\n }\n}\n\ntype Base = Constructor<LitElement> & { properties?: PropertyDeclarations };\ntype Translator = (key: string, options?: StringMap) => string;\n\nexport declare class TranslatableMixinHost {\n /** Optional ISO 639-1 code describing the language element content is written in. */\n lang: string;\n\n /**\n * Namespace used by this element.\n * @since 1.4.0\n */\n ns: string;\n\n /**\n * Translation function from i18next fixed to the current language and element namespace.\n * @since 1.4.0\n */\n get t(): Translator;\n}\n\nexport const TranslatableMixin = <T extends Base>(\n BaseElement: T,\n defaultNS = ''\n): T & Constructor<TranslatableMixinHost> & { defaultNS: string } => {\n return class TranslatableElement extends BaseElement {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n lang: { type: String },\n ns: { type: String },\n };\n }\n\n static get defaultNS(): string {\n return defaultNS;\n }\n\n lang = '';\n\n ns = defaultNS;\n\n t: Translator = (key, options) => {\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\n\n if (!I18nElement) return key;\n\n const keys = [\n ...[defaultNS, ...this.ns.split(' ').reverse()]\n .map(v => v.trim())\n .filter((v, i, a) => a.indexOf(v) === i && v.length > 0)\n .reverse()\n .map((v, i, a) => `${v}:${[...a.slice(i + 1), key].join('.')}`),\n `shared:${key}`,\n ];\n\n return I18nElement.i18next.t(keys, { lng: this.lang, ...options }).toString();\n };\n\n private __untrackTranslations?: () => void;\n\n connectedCallback(): void {\n super.connectedCallback();\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\n this.__untrackTranslations = I18nElement?.onTranslationChange(() => this.requestUpdate());\n }\n\n /** @readonly */\n updated(changedProperties: Map<keyof I18n, unknown>): void {\n super.updated(changedProperties);\n\n const I18nElement = customElements.get('foxy-i18n') as typeof I18n | undefined;\n if (!I18nElement) return;\n\n if (changedProperties.has('lang')) I18nElement.i18next.loadLanguages(this.lang);\n if (changedProperties.has('ns')) I18nElement.i18next.loadNamespaces(this.ns.split(' '));\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.__untrackTranslations?.();\n }\n };\n};\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/elements",
3
3
  "type": "module",
4
- "version": "1.14.0-beta.8",
4
+ "version": "1.14.2",
5
5
  "description": "E-commerce web components by Foxy.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1 +0,0 @@
1
- import{L as t,_ as e,j as i,h as s}from"./shared-63eaded9.js";import"./shared-0ced76a0.js";import{p as r}from"./shared-87ca7818.js";import"./shared-46ee137f.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{b as a,S as n,c as o}from"./shared-d01035c5.js";import"./shared-31d03530.js";import"./shared-4ba926ca.js";import{I as c,D as l}from"./shared-a3d2c48e.js";import{E as d}from"./shared-5d94bacb.js";import"./shared-ec861f31.js";import"./shared-bb824ab4.js";import"./foxy-i18n.js";import"./shared-60126eee.js";import{s as h}from"./shared-b0f0e8b5.js";class u extends CustomEvent{constructor(t){super("change",{detail:t})}}class m extends CustomEvent{constructor(t){super("submit",{detail:t,cancelable:!0})}}let _,p,g=t=>t;var y;!function(t){t[t.Excluded=0]="Excluded",t[t.BeforeEnter=1]="BeforeEnter",t[t.Default=2]="Default",t[t.Previous=3]="Previous",t[t.BeforeExit=4]="BeforeExit"}(y||(y={}));class f extends t{constructor(){super(...arguments),this.quantity=0,this.image=""}static get properties(){return e(e({},super.properties),{},{quantity:{attribute:!1},image:{attribute:!1}})}static get styles(){return[a.styles,i(_||(_=g`.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.blur-1{filter:blur(1px)}.blur-2{filter:blur(2px)}.grayscale{filter:grayscale()}.rotate-12{--tw-rotate:12deg}.-rotate-12{--tw-rotate:-12deg}.-rotate-24{--tw-rotate:-24deg}.translate-y-half{--tw-translate-y:50%}`))]}set empty(t){this.updateComplete.then((()=>{if(t){const[,...t]=this.__stack;t.forEach((t=>t.remove()))}else this.quantity>1&&this.__stack.length<2&&this.__insertImage(y.Previous,this.__stack[0])}))}set data({quantity:t,image:e}){this.quantity=t,this.image=e}render(){return s(p||(p=g`<div id="image" class="w-full h-full relative"></div>`))}firstUpdated(){const t=this.__insertImage(y.Default);this.quantity>1&&this.__insertImage(y.Previous,t)}updated(t){if(t.has("quantity")){const e=t.get("quantity");void 0!==e&&(this.quantity>e?this.__add():this.__remove())}t.has("image")&&this.__stack.forEach((t=>t.src=this.image))}get __container(){return this.shadowRoot.getElementById("image")}get __stack(){var t,e;return[...null!==(e=null===(t=this.__container)||void 0===t?void 0:t.querySelectorAll(":not(.opacity-0)"))&&void 0!==e?e:[]].reverse()}__add(){const[t,e]=this.__stack;this.quantity>1?(t&&this.__setImageState(t,y.Previous),e&&(this.__setImageState(e,y.BeforeExit),e.ontransitionend=()=>e.remove()),this.__setImageState(this.__insertImage(y.BeforeEnter),y.Default)):t&&this.__setImageState(t,y.Default)}__remove(){const[t,e]=this.__stack;let i;if(this.quantity>0?(e&&this.__setImageState(e,y.Default),i=t):(t&&this.__setImageState(t,y.Excluded),i=e),i&&(this.__setImageState(i,y.BeforeEnter),i.ontransitionend=()=>i.remove()),this.quantity>1){const t=this.__insertImage(y.BeforeExit,this.__container.firstElementChild);this.__setImageState(t,y.Previous)}}__insertImage(t,e=null){const i=new Image;return i.src=this.image,i.setAttribute("part","picture"),this.__setImageState(i,t),this.__container.insertBefore(i,e),i}__setImageState(t,e){t.offsetHeight,t.className=["absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back",["grayscale","shadow-m translate-y-half scale-110 rotate-12 opacity-0","shadow-m","blur-1 -rotate-12 opacity-25","blur-2 -rotate-24 opacity-0"][e]].join(" ")}}let v,b,w,x,q,I,$,E,S=t=>t;class D extends(n(t)){constructor(){super(...arguments),this.empty=!1,this.data=[]}static get properties(){return e(e({},super.properties),{},{empty:{attribute:!1},data:{attribute:!1}})}static get styles(){return[a.styles,i(v||(v=S`.w-preview{width:5.5rem}.h-preview{height:5.5rem}.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.grayscale{filter:grayscale()}.grid-2>:nth-child(1),.grid-3>:nth-child(1),.grid-4-plus>:nth-child(1),.grid-4>:nth-child(1){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(2){opacity:0;--tw-translate-x:100%;--tw-translate-y:var(--tw-translate-x)}.grid-2>:nth-child(2),.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){transform-origin:top right}.grid-1>:nth-child(3),.grid-2>:nth-child(3),.grid-3>:nth-child(3),.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(3),.grid-2>:nth-child(3){opacity:0;--tw-translate-y:100%}.grid-3>:nth-child(3){transform-origin:bottom right}.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){transform-origin:bottom left}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4),.grid-4-plus>:nth-child(4),.grid-4>:nth-child(4){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4){opacity:0;transform-origin:bottom left;--tw-translate-x:100%}.grid-1>:nth-child(4)>:first-child,.grid-2>:nth-child(4)>:first-child,.grid-3>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:first-child{transform:perspective(250px) rotateX(-90deg)}.grid-4-plus>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:last-child{transition-delay:.15s;transition-timing-function:ease-out}.grid-4-plus>:nth-child(4)>:last-child,.grid-4>:nth-child(4)>:first-child{transition-timing-function:ease-in}.grid-4-plus>:nth-child(4)>:last-child{transform:perspective(250px) rotateX(90deg)}.grid-1>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){opacity:0}.grid-1>:nth-child(5){--tw-translate-x:100%}.grid-2>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-translate-y:-100%}.grid-1>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){opacity:0}.grid-1>:nth-child(6){--tw-translate-y:100%}.grid-2>:nth-child(6),.grid-3>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-translate-x:-100%}`))]}render(){const t=this.data.length,e="rounded bg-contrast-10",i="transition-all duration-700 ease-out-back transform absolute inset-0",r=this.empty?"grayscale":"",a=t>4?"grid-4-plus":`grid-${Math.max(1,t)}`,n=h({exportparts:"picture",class:"w-full h-full",".empty":this.empty}),[o,c,l,d]=this.data;return s(b||(b=S` <div class="${0} w-preview h-preview relative font-lumo"> <div class="${0} ${0} origin-top-left"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> ${0} </div> <div class="${0} ${0} origin-top-right"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> <div class="${0} flex text-body transition duration-150 absolute inset-0"> ${0} </div> <div class="transition duration-150 absolute inset-0"> ${0} </div> </div> <div class="${0} ${0} origin-top-right"></div> <div class="${0} ${0} origin-bottom-left"></div> </div> `),a,i,r,o?s(w||(w=S`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,o):"",i,r,c?s(x||(x=S`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,c):"",i,r,l?s(q||(q=S`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,l):"",i,r,e,t>102?s(I||(I=S`<iron-icon icon="icons:more-horiz" class="m-auto w-xl h-xl"></iron-icon>`)):s($||($=S`<div class="m-auto text-xxxl">+${0}</div>`),t-3),d?s(E||(E=S`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,d):"",i,e,i,e)}}let k,C,A=t=>t;class N extends D{static get scopedElements(){return{"x-pic":f}}}class P extends D{static get scopedElements(){return{"x-pic":N}}}class j extends(n(t)){constructor(){super(...arguments),this.quantity=0,this.items=[]}static get scopedElements(){return{"x-picture":f,"x-bundle-grid":P}}static get properties(){return{quantity:{attribute:!1},image:{attribute:!1},items:{attribute:!1}}}static get styles(){return a.styles}render(){const{quantity:t,image:e=""}=this,i=0===t,r=h({class:"w-full h-full",exportparts:"picture"});if(0===this.items.length)return s(k||(k=A`<x-picture ...="${0}" .data="${0}"></x-picture>`),r,{quantity:t,image:e});{const e=new Array(Math.max(1,t)).fill(this.items);return s(C||(C=A`<x-bundle-grid ...="${0}" .empty="${0}" .data="${0}"></x-bundle-grid>`),r,i,e)}}}class F extends o{static get properties(){return e(e({},super.properties),{},{open:{type:Object},signatures:{type:Object,converter:t=>{const e=JSON.parse(t);for(const t of Object.keys(e))64!=e[t].length&&console.error("There is something wrong with the signature. It should have 64 characters.");return e}}})}signedName(t){return this.signatures&&this.signatures[t]?`${t}||${this.signatures[t]}${this.isOpen(t)?"||open":""}`:t}isOpen(t){return!(!this.open||!this.open[t])}}let T,O,B,L,R,z,V,M=t=>t;class Q extends F{constructor(){super("items-form"),this.rel="product_item",this.readonly=!1,this.quantity=0,this.total=this.__computeTotalPrice(),this.currency="",this.isItem=!0,this.isChildItem=!1,this.pid=Q.__newId(),this.__modified=!1,this.__childPrices=[],this.__images=[],this.__childrenCount=0,this.__itemDescription="",this.__handleQuantity={handleEvent:t=>{const e=Number(t.target.value);this.quantity=e,this.__modified=!0,this.__images=[this.getImageDescription()].concat(this.__images.slice(1,this.__images.length))}},this.__childItemsObserver=new MutationObserver(this.__observeItems.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__setCode(),this.__acknowledgeChildItems(),this.__changedChildItem(),this.__isValid()||console.error("Invalid item",this.value)}))}static get styles(){return[super.styles,i(T||(T=M`:host{--quantity-width:6.5rem;--preview-size:5.5rem;--threshold:20rem}.min-w-description::before{content:'';width:var(--threshold);display:block;overflow:hidden}.ml-description{--min-width:calc(var(--threshold) + var(--preview-size) + var(--lumo-space-l));--free-space:calc(100% - var(--min-width));--max-margin-left:calc(var(--preview-size) + var(--lumo-space-l));--final-margin-left:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-left));margin-left:var(--final-margin-left)}.mr-quantity{--min-width:var(--threshold);--free-space:calc(100% - var(--min-width));--max-margin-right:calc(var(--quantity-width) + var(--lumo-space-l));--final-margin-right:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-right));margin-right:var(--final-margin-right)}:host([data-bundled]:not(:last-of-type)) .separator::after{content:' ';display:block;position:absolute;width:100vw;border-bottom:solid thin var(--lumo-shade-10pct);left:0;bottom:0}.w-quantity{width:var(--quantity-width)}.w-preview{width:var(--preview-size)}.h-preview{height:var(--preview-size)}`))]}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"x-error-screen":d,"x-preview":j,"x-i18n":c}}static get properties(){return e(e({},super.properties),{},{__modified:{},readonly:{type:Boolean,reflect:!0},currency:{type:String},category:{type:String},code:{type:String,reflect:!0},expires:{type:String},height:{type:Number},image:{type:String},length:{type:Number},name:{type:String},parent_code:{type:String},price:{type:Number},quantity:{type:Number,reflect:!0},quantity_max:{type:Number},quantity_min:{type:String},shipto:{type:String},total:{type:Number,reflect:!0,attribute:"total"},url:{type:String},value:{type:Object},weight:{type:Number},width:{type:Number},__childPrices:{},__childrenCount:{},__images:{},alt:{type:String},isChildItem:{type:Boolean,reflect:!0,attribute:"data-bundled"},isItem:{type:Boolean,reflect:!0,attribute:"data-item"},open:{type:Object},pid:{type:Number,reflect:!0},items:{type:Array}})}get items(){const t=[];return this.__onEachChildItem([e=>t.push(e.value)]),t}set items(t){this.__createItems(t)}get value(){const t={};for(let e=0;e<this.attributes.length;e++)t[this.attributes[e].name]=this.attributes[e].value;return t.items=this.items,t}set value(t){this.__itemDescription="";for(const e in t){let i="";if("description"!=e){if("object"==typeof t[e])i=JSON.stringify(t[e]);else{const s=e;(t[s]&&"undefined"!==t[s]||0===t[s])&&(i=t[e].toString())}this.setAttribute(e,t[e]?i:"")}else this.__itemDescription=t[e]}}updated(t){t.forEach(((t,e)=>{"__itemDescription"!=e&&"isChildItem"!=e||this.__updateDescriptionEl()})),this.__setTotalPrice(),this.dispatchEvent(new Event("change"))}render(){var t;if(!this.__isValid())return s(O||(O=M`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`));const e=`font-lumo text-body text-s leading-m transition duration-100 ${this.quantity?"":"removed opacity-50"}`;if(this.isChildItem)return s(B||(B=M` <article part="item" class="py-s w-full relative separator item-summary flex justify-between ${0}"> <div class="description flex-1"> <h1 class="text-header font-medium">${0}</h1> <section class="description text-secondary"> <slot></slot> </section> </div> ${0} </article> `),e,this.name,this.quantity<2?"":s(L||(L=M` <section class="quantity font-medium text-tertiary whitespace-nowrap"> ${0} </section> `),this._t("item.items",{quantity:this.quantity})));{const i=(null!==(t=this.price)&&void 0!==t?t:0)+this.__childPrices.reduce(((t,e)=>t+e),0),r=this.__translateAmount(i*this.quantity),a=this.__translateAmount(i);return s(R||(R=M` <article part="item" class="p-l relative item ${0} ${0}"> <x-preview class="preview float-left w-preview h-preview mr-l mb-l" exportparts="picture" .image="${0}" .quantity="${0}" .items="${0}"> </x-preview> <section class="description min-w-description ml-description"> <h1 class="text-header font-medium text-l leading-none mr-quantity mb-s"> ${0} </h1> <div class="item-description text-secondary mr-quantity mb-s"> <slot></slot> </div> <div class="child-items mb-s"> <slot name="items"></slot> </div> ${0} </section> <section class="quantity w-quantity absolute top-0 right-0 m-l"> <vaadin-integer-field class="w-full p-0" name="quantity" @change="${0}" value="${0}" min="0" has-controls ?readonly="${0}"> </vaadin-integer-field> ${0} </section> </article> `),e,this.__modified?"modified":"",this.image,this.quantity,[...this.querySelectorAll("[data-bundled]")].map((t=>{var e;return{quantity:t.quantity,image:null!==(e=t.image)&&void 0!==e?e:""}})),this.name,a?s(z||(z=M`<div class="font-medium price text-l">${0}</div>`),a):"",this.__handleQuantity,this.quantity,this.readonly,this.quantity>1?s(V||(V=M` <x-i18n .ns="${0}" .lang="${0}" .opts="${0}" class="price-total text-secondary text-xs text-center block mt-xs" key="price.total"> </x-i18n> `),this.ns,this.lang,{amount:r}):"")}}getImageDescription(){return{src:this.image,alt:this.alt,quantity:this.quantity}}signedName(t){const e=super.signedName(t);return`${this.pid.toString()}:${e}`}static __newId(){const t=Q.__existingIds.reduce(((t,e)=>e>t?e:t),0)+1;return Q.__existingIds.push(t),t}__updateDescriptionEl(){if(this.__itemDescription){let t=this.shadowRoot.querySelector("data-item-description");t||(t=document.createElement("p"),t.dataset.itemDescription="true",this.__addSlottedEl(t)),t.innerText=this.__itemDescription}else{const t=this.shadowRoot.querySelector("data-item-description");t&&t.remove()}}__addSlottedEl(t){const e=this.shadowRoot.querySelector("article");e&&e.appendChild(t)}__setCode(){this.code||(this.code=`RAND${Math.random()}`)}__createItems(t){t.forEach((t=>{const e=document.createElement(this.tagName);e.value=t,e.currency=this.currency,e.__computeTotalPrice(),this.__acknowledgeItem(e),this.appendChild(e)}))}__setTotalPrice(){this.total=this.__computeTotalPrice()}__computeTotalPrice(){if(!this.__childPrices)return this.price?this.price*this.quantity:0;let t=0;return this.__childPrices.forEach((e=>{t+=e})),t+=this.price,t*=this.quantity,t}__isValid(){const t=[];return this.name&&this.name.length||t.push("The name attribute of an item is required."),this.price||0===this.price||t.push("The price attribute of an item is required."),this.price&&this.price<0&&t.push("Item added with negative price."),this.quantity_min&&this.quantity&&this.quantity<this.quantity_min&&t.push("Quantity amount is less than minimum quantity."),this.quantity_max&&this.quantity&&this.quantity>this.quantity_max&&t.push("Quantity amount is more than maximum quantity."),console.error(...t),!t.length}__translateAmount(t){return this.currency?t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"}):""}__observeItems(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.nodeType===Node.DOCUMENT_NODE&&this.__acknowledgeItem(t)}))})),this.__setTotalPrice()}__acknowledgeChildItems(){var t;null===(t=this.shadowRoot)||void 0===t||t.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t))),this.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t)))}__acknowledgeItem(t){t.addEventListener("change",this.__changedChildItem.bind(this)),t.currency=this.currency,t.isItem=!1,t.isChildItem=!0,this.code&&(t.parent_code=this.code)}__changedChildItem(){const t=[],e=[];let i=0;this.__onEachChildItem([e=>{void 0!==e.total&&t.push(e.total)},t=>{e.push(t.getImageDescription())},()=>i+=1]),this.image&&0===e.length&&e.push(this.getImageDescription()),this.__childPrices=t,this.__images=e,this.__childrenCount=i,this.__setTotalPrice()}__onEachChildItem(t){const e=this.querySelectorAll("[data-bundled]");for(const i of e)for(const e of t)e(i)}}Q.__existingIds=[];let W,J,U,X,H,G,K=t=>t;class Y extends F{constructor(){super("items-form"),this.readonly=!1,this.target="_top",this.cart="checkout",this.sub_modify="replace",this.sub_restart="auto",this.frequencies=[],this.handleSubmit={handleEvent:()=>{null!==this.__data&&this.dispatchEvent(new m(this.__data))&&this.shadowRoot.querySelector("form").submit()}},this.__hasValidItems=!1,this.__total=0,this.__handleFrequency={handleEvent:t=>{const e=t.detail.replace(/([wydm])\w*/,"$1").replace(/ /g,"").replace(/^0/,"");Y.__validFrequency(e)?this.sub_frequency=e:this.sub_frequency="",this.__updateData()}},this.__data=new FormData,this.__childItemsObserver=new MutationObserver(this.__observeChildren.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}))}static get scopedElements(){return{"x-error-screen":d,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":l,"x-item":Q}}static get properties(){return e(e({},super.properties),{},{currency:{type:String},readonly:{type:Boolean},cart:{type:String,converter:t=>t&&!["checkout","add"].includes(t)?null:t},target:{type:String},store:{type:String,attribute:"store"},sub_frequency:{type:String},sub_startdate:{type:String,converter:t=>Y.__validDate(t)?t:(console.error("Invalid start date",t),"")},sub_enddate:{type:String,converter:t=>Y.__validDateFuture(t)?t:(console.error("Invalid end date",t),"")},sub_token:{type:String},sub_modify:{type:String,converter:t=>""===t||"append"===t?"":"replace"},sub_restart:{type:String,converter:t=>"true"===t?t:"auto"},frequencies:{converter:t=>{if(!t)return[];const e=JSON.parse(t);if(!Array.isArray(e))return console.error("Invalid frequency","Frequency options must be an array."),[];for(const t of e)if(!Y.__validFrequency(t))return console.error("Invalid frequency","Invalid frequency option.\n Please, check https://wiki.foxycart.com/v/2.0/products#subscription_product_options for possible values.\n Each frequency must be a in the format:\n - 1d (a number followed by d, for day)\n - 1w (a number followed by w, for week)\n - 1m (a number followed by m, for month)\n - 1y (a number followed by y, for year)\n or .5m (no other decimals are allowed, and this is only for months)\n ",t),[];return e.filter(Y.__validFrequency)}},items:{type:Array},__hasValidItems:{attribute:!1},__total:{attribute:!1},__data:{attribute:!1}})}get items(){const t=[];return this.__itemElements.forEach((e=>{const i=new Proxy(e,{set:function(t,e,i){const s=Object.keys(t.value);return!("string"!=typeof e||!s.includes(e))&&(t[e]=i,!0)},get:function(t,e){return t.value[e]}});t.push(i)})),t}set items(t){this.__removeItems(),this.__createItemsFromItemArray(t)}get total(){return this.__total}render(){var t;return this.store&&this.currency?s(J||(J=K` <div> <form class="overflow-hidden" method="POST" target="${0}" action="https://${0}/cart" data-testid="form" class="hidden" hidden> ${0} </form> <section class="items"> <slot></slot> </section> ${0} </div> `),this.target,this.store,this.__data?s(U||(U=K` ${0}`),[...this.__data.entries()].map((([t,e])=>s(X||(X=K`<input type="hidden" name="${0}" value="${0}">`),t,e)))):"",this.readonly?"":s(H||(H=K` <section class="actions flex flex-wrap justify-end m-m"> ${0} <vaadin-button class="m-s w-full sm-w-auto" theme="primary" data-testid="submit" ?disabled="${0}" @click="${0}"> <span class="total"> ${0} </span> </vaadin-button> </section> `),this.frequencies&&this.frequencies.length?s(G||(G=K` <x-dropdown type="text" name="frequency" class="subscription m-s w-full sm-w-auto" lang="${0}" .value="${0}" .items="${0}" .getText="${0}" @change="${0}"> </x-dropdown> `),this.lang,null!==(t=this.sub_frequency)&&void 0!==t?t:"0",this.frequencies.concat(["0"]),this.__translateFrequency.bind(this),this.__handleFrequency):"",!this.__hasValidItems,this.handleSubmit,this.__submitBtnText(this.__translateAmount(this.total)))):s(W||(W=K`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`))}addItems(t){for(const e of t){const t=this.createItem(e);this.appendChild(t),this.__acknowledgeItemElement(t)}}removeItems(t){this.__removeItems((e=>t.includes(e.pid)))}updated(){this.dispatchEvent(new u(this.__data))}createItem(t){const e=this.constructor.getScopedTagName("x-item"),i=document.createElement(e);return i.value=t,i.currency=this.currency,i.readonly=this.readonly,i}__submitBtnText(t){if(this.sub_frequency&&"0"!=this.sub_frequency){const e=r(this.sub_frequency);return 1===e.count?this._t("checkout.subscribe_single_unit",{value:t,period:this._t(e.units).toLowerCase()}):this._t("checkout.subscribe_muiltiple_units",{value:t,period:this.__translateFrequency(this.sub_frequency).toLowerCase()})}return this._t("checkout.buy",{value:t})}get __itemElements(){return this.querySelectorAll("[data-item]")}__createItemsFromItemArray(t){this.addItems(t)}__removeItems(t=(()=>!0)){this.__itemElements.forEach((e=>{t(e)&&e.remove()}))}__addSignature(t,e,i){return`${t}||${e}${i?"||open":""}`}__formDataFill(t){let e=0;return this.__itemElements.forEach((i=>{e+=this.__formDataAddItem(t,i)})),this.__formDataAddCartWideSubscriptionFields(t),e}__formDataCustomInputs(t){this.querySelectorAll("[name]").forEach((e=>{const i=e;"INPUT"==i.tagName&&["checkbox","radio"].includes(i.type)&&!i.checked||"OPTION"!=i.tagName&&i.value&&["number","string"].includes(typeof i.value)&&t.set(i.name,i.value)}))}__isAttributeReserved(t){return["alt","currency","description","isChildren","isItem","items","open","pid","signatures","slot","total"].includes(t)}__formDataAddItem(t,e,i=null){let s=0;if(this.__validItem(e)){if(!e.value.pid)throw new Error("Attempt to convert a item without a propper ID");i&&i.getAttribute("code")&&e.setAttribute("parent_code",i.getAttribute("code"));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s];if(!this.__isAttributeReserved(r.name)&&!r.name.startsWith("data-")){let s=e[r.name];e.code&&["string","number"].includes(typeof s)&&(i&&"quantity"==r.name&&(s=Number(r.value)*i.quantity),t.set(e.signedName(r.name),s.toString()))}}s+=1,this.__formDataAddSubscriptionFields(t,e)}const r=e.querySelectorAll("[data-bundled]");if(r&&e.quantity>0)for(const i of r)s+=this.__formDataAddItem(t,i,e);return s}__formDataAddSubscriptionFields(t,e){if(this.sub_frequency)for(const i of["sub_frequency","sub_startdate","sub_enddate"])this[i]&&t.set(e.signedName(i),this[i])}__formDataAddCartWideSubscriptionFields(t){this.sub_frequency&&(this.sub_token&&t.set(this.signedName("sub_token"),this.sub_token),t.set(this.signedName("sub_modify"),this.sub_modify),t.set(this.signedName("sub_restart"),this.sub_restart))}__formDataAddCartFields(t){this.cart?t.set("cart",this.cart):t.delete("cart")}static __validDate(t){return null!=t&&(t.match(/^(\d{1,2}|\d{8})$/)?!(t.match(/^\d{2}$/)&&Number(t)>31):!(t.match(/^\.5m/)||!Y.__validFrequency(t)))}static __validDateFuture(t){let e=!1;if(Y.__validDate(t))if(t.match(/^\d{8}/)){e=(new Date).toISOString().replace(/(-|T.*)/g,"")<=t}else e=!0;return e}static __validFrequency(t){return!!t&&!!t.match(/^(\.5m|\d+[dwmy])$/)}__observeChildren(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.addEventListener("change",this.__itemChange.bind(this))}))})),this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}__itemChange(){this.__computeTotalPrice(),this.__updateData()}__computeTotalPrice(){let t=0;this.__itemElements.forEach((e=>{const i=e;i.total&&(t+=Number(i.total))})),this.__total=Number(t.toFixed(2))}__acknowledgeItemElements(){this.__itemElements.forEach((t=>{const e=t;this.__acknowledgeItemElement(e)}))}__acknowledgeItemElement(t){t.addEventListener("change",this.__itemChange.bind(this)),t.currency=this.currency}__validItem(t){const e=t.getAttribute("pid"),i=Number(t.getAttribute("quantity")),s=Number(t.getAttribute("price"));return!!(e&&i>0&&s>=0)}__translateFrequency(t){if(t.startsWith("0"))return this._t("frequency_once");if(".5m"===t)return this._t("frequency_0_5m");const{count:e,units:i}=r(t);return this._t("frequency",{units:this._t(i,{count:e}),count:e})}__translateAmount(t){return t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"})}__updateData(){this.__data=null;if(!this.shadowRoot.querySelector("form"))return;const t=new FormData,e=this.__formDataFill(t);this.__hasValidItems=!!e,this.__formDataAddCartFields(t),this.__formDataCustomInputs(t),this.__data=t}}customElements.define("foxy-items-form",Y),customElements.define("foxy-item",Q);export{Y as I,j as P,Q as a};