@zonos/elements 1.3.21 → 1.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{cart-921f0a47.js → cart-f963b239.js} +69 -30
- package/dist/cjs/{getBorderRadius-9ad763e1.js → getBorderRadius-332422ab.js} +1 -1
- package/dist/cjs/index.cjs.js +5 -4
- package/dist/cjs/{isDarkColor-3d021ecc.js → isDarkColor-3ddf6511.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{submitGtag-71790233.js → submitGtag-8d562ad4.js} +2 -2
- package/dist/cjs/zonos-address_8.cjs.entry.js +4 -4
- package/dist/cjs/zonos-badge_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-banner.cjs.entry.js +1 -1
- package/dist/cjs/zonos-button_3.cjs.entry.js +82 -43
- package/dist/cjs/zonos-card_2.cjs.entry.js +4 -4
- package/dist/cjs/zonos-cart-items_11.cjs.entry.js +19 -29
- package/dist/cjs/zonos-checkout.cjs.entry.js +11 -7
- package/dist/cjs/zonos-controller.cjs.entry.js +4 -4
- package/dist/cjs/zonos-country-flag.cjs.entry.js +4 -4
- package/dist/cjs/zonos-country-select_3.cjs.entry.js +11 -9
- package/dist/cjs/zonos-elements.cjs.js +1 -1
- package/dist/cjs/zonos-hello-dialog.cjs.entry.js +12 -12
- package/dist/cjs/zonos-hello.cjs.entry.js +10 -6
- package/dist/cjs/zonos-input.cjs.entry.js +2 -2
- package/dist/cjs/zonos-logo.cjs.entry.js +1 -1
- package/dist/cjs/zonos-notification.cjs.entry.js +1 -1
- package/dist/cjs/zonos-payment.cjs.entry.js +4 -4
- package/dist/cjs/zonos-select-dialog-header_2.cjs.entry.js +1 -1
- package/dist/cjs/zonos-shipping-rich-radio.cjs.entry.js +2 -2
- package/dist/cjs/zonos-text.cjs.entry.js +1 -2
- package/dist/cjs/{zonosStore-1063de5e.js → zonosStore-768d6ca0.js} +2 -1
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.css +7 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-items/zonos-cart-items.js +4 -4
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-restricted-items/zonos-cart-restricted-items.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.css +7 -0
- package/dist/collection/components/checkout/zonos-checkout/zonos-cart-subtotal/zonos-cart-subtotal.js +5 -5
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout-payment/zonos-checkout-payment.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-checkout.js +6 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-review/zonos-review.js +2 -2
- package/dist/collection/components/checkout/zonos-checkout/zonos-shipping/zonos-shipping.js +3 -3
- package/dist/collection/components/common/zonos-button/zonos-button.css +7 -2
- package/dist/collection/components/common/zonos-button/zonos-button.js +74 -39
- package/dist/collection/components/common/zonos-text/zonos-text.js +0 -18
- package/dist/collection/components/hello/zonos-hello/zonos-hello.js +6 -3
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.js +8 -5
- package/dist/collection/components/hello/zonos-hello-dialog/zonos-hello-dialog.js +8 -8
- package/dist/collection/components/main/zonos-controller.js +2 -2
- package/dist/collection/components/store/hello/localization.js +2 -2
- package/dist/collection/components/store/zonosStore.js +3 -2
- package/dist/collection/components/utils/api/getExchangeRate.js +20 -5
- package/dist/collection/components/utils/hello/currencyConversion/currencyConvertAndFormat.js +1 -1
- package/dist/collection/components/utils/hello/currencyConversion/currencyDisplay.js +1 -1
- package/dist/collection/components/utils/hello/currencyConversion/currencyFormat.js +32 -17
- package/dist/collection/components/utils/hello/currencyConversion/defaultCurrencyConverter.js +12 -2
- package/dist/collection/components/utils/isElementUsingDarkTheme.js +5 -0
- package/dist/collection/scripts/_zonosBase.js +2 -1
- package/dist/esm/{cart-d3c98a81.js → cart-efecbea6.js} +69 -30
- package/dist/esm/{getBorderRadius-393bf797.js → getBorderRadius-a2e46e26.js} +1 -1
- package/dist/esm/index.js +5 -4
- package/dist/esm/{isDarkColor-454ec221.js → isDarkColor-69ed8e39.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{submitGtag-acdb8bd7.js → submitGtag-a7b8a86e.js} +2 -2
- package/dist/esm/zonos-address_8.entry.js +4 -4
- package/dist/esm/zonos-badge_2.entry.js +1 -1
- package/dist/esm/zonos-banner.entry.js +1 -1
- package/dist/esm/zonos-button_3.entry.js +82 -43
- package/dist/esm/zonos-card_2.entry.js +4 -4
- package/dist/esm/zonos-cart-items_11.entry.js +19 -29
- package/dist/esm/zonos-checkout.entry.js +11 -7
- package/dist/esm/zonos-controller.entry.js +4 -4
- package/dist/esm/zonos-country-flag.entry.js +4 -4
- package/dist/esm/zonos-country-select_3.entry.js +11 -9
- package/dist/esm/zonos-elements.js +1 -1
- package/dist/esm/zonos-hello-dialog.entry.js +12 -12
- package/dist/esm/zonos-hello.entry.js +10 -6
- package/dist/esm/zonos-input.entry.js +2 -2
- package/dist/esm/zonos-logo.entry.js +1 -1
- package/dist/esm/zonos-notification.entry.js +1 -1
- package/dist/esm/zonos-payment.entry.js +4 -4
- package/dist/esm/zonos-select-dialog-header_2.entry.js +1 -1
- package/dist/esm/zonos-shipping-rich-radio.entry.js +2 -2
- package/dist/esm/zonos-text.entry.js +1 -2
- package/dist/esm/{zonosStore-0ce57f37.js → zonosStore-93da32b4.js} +2 -1
- package/dist/esm-es5/{cart-d3c98a81.js → cart-efecbea6.js} +1 -1
- package/dist/esm-es5/{getBorderRadius-393bf797.js → getBorderRadius-a2e46e26.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/{isDarkColor-454ec221.js → isDarkColor-69ed8e39.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{submitGtag-acdb8bd7.js → submitGtag-a7b8a86e.js} +1 -1
- package/dist/esm-es5/zonos-address_8.entry.js +1 -1
- package/dist/esm-es5/zonos-badge_2.entry.js +1 -1
- package/dist/esm-es5/zonos-banner.entry.js +1 -1
- package/dist/esm-es5/zonos-button_3.entry.js +1 -1
- package/dist/esm-es5/zonos-card_2.entry.js +1 -1
- package/dist/esm-es5/zonos-cart-items_11.entry.js +1 -1
- package/dist/esm-es5/zonos-checkout.entry.js +1 -1
- package/dist/esm-es5/zonos-controller.entry.js +1 -1
- package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
- package/dist/esm-es5/zonos-country-select_3.entry.js +1 -1
- package/dist/esm-es5/zonos-elements.js +1 -1
- package/dist/esm-es5/zonos-hello-dialog.entry.js +1 -1
- package/dist/esm-es5/zonos-hello.entry.js +1 -1
- package/dist/esm-es5/zonos-input.entry.js +1 -1
- package/dist/esm-es5/zonos-logo.entry.js +1 -1
- package/dist/esm-es5/zonos-notification.entry.js +1 -1
- package/dist/esm-es5/zonos-payment.entry.js +1 -1
- package/dist/esm-es5/zonos-select-dialog-header_2.entry.js +1 -1
- package/dist/esm-es5/zonos-shipping-rich-radio.entry.js +1 -1
- package/dist/esm-es5/zonos-text.entry.js +1 -1
- package/dist/esm-es5/{zonosStore-0ce57f37.js → zonosStore-93da32b4.js} +1 -1
- package/dist/scripts/index.d.ts +26 -10
- package/dist/scripts/index.js +1 -1
- package/dist/scripts/loadZonos.js +1 -1
- package/dist/scripts/zonos.js +1 -1
- package/dist/types/components/common/zonos-button/zonos-button.d.ts +1 -0
- package/dist/types/components/common/zonos-text/zonos-text.d.ts +0 -4
- package/dist/types/components/hello/zonos-hello-dialog/zonos-hello-dialog-footer/zonos-hello-dialog-footer.d.ts +1 -0
- package/dist/types/components/store/hello/localization.d.ts +2 -2
- package/dist/types/components/store/zonosStore.d.ts +6 -2
- package/dist/types/components/utils/api/getExchangeRate.d.ts +9 -10
- package/dist/types/components/utils/hello/currencyConversion/currencyFormat.d.ts +5 -1
- package/dist/types/components/utils/isElementUsingDarkTheme.d.ts +1 -0
- package/dist/types/components.d.ts +0 -8
- package/dist/types/scripts/_zonosBase.d.ts +21 -1
- package/dist/types/types/checkout/CheckoutConfig.d.ts +6 -2
- package/dist/zonos-elements/index.esm.js +1 -1
- package/dist/zonos-elements/p-102c670d.entry.js +1 -0
- package/dist/zonos-elements/{p-3668f365.entry.js → p-13940c52.entry.js} +1 -1
- package/dist/zonos-elements/{p-0e6fe6c8.system.entry.js → p-140bb400.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-15c903ff.js → p-18432252.js} +1 -1
- package/dist/zonos-elements/{p-f03b33ec.system.entry.js → p-1e07c616.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-42a7a726.system.entry.js → p-20ab8daf.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-fc2f3e2a.system.entry.js → p-2641f474.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-c15b36c1.system.entry.js → p-283aa6f9.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3c97c44d.entry.js → p-298b5d95.entry.js} +1 -1
- package/dist/zonos-elements/p-2d3940dc.entry.js +1 -0
- package/dist/zonos-elements/{p-d1b8dcd8.system.entry.js → p-33f83b9a.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b13e630b.js → p-348adf28.js} +1 -1
- package/dist/zonos-elements/p-36f8a3df.system.js +1 -0
- package/dist/zonos-elements/{p-b9ed8a66.system.entry.js → p-3bee1a04.system.entry.js} +1 -1
- package/dist/zonos-elements/p-49061c5d.entry.js +1 -0
- package/dist/zonos-elements/{p-b202a015.entry.js → p-57d70603.entry.js} +1 -1
- package/dist/zonos-elements/{p-d18990b0.entry.js → p-5b7438ef.entry.js} +1 -1
- package/dist/zonos-elements/p-5ca32f4f.entry.js +1 -0
- package/dist/zonos-elements/p-5edc4f18.system.entry.js +1 -0
- package/dist/zonos-elements/p-678daa20.system.entry.js +1 -0
- package/dist/zonos-elements/{p-14bea5e6.system.entry.js → p-68e3ef26.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-9da3b3b3.system.entry.js → p-6e717c40.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-2d3e3735.js → p-795a3ed5.js} +1 -1
- package/dist/zonos-elements/{p-67373528.entry.js → p-7d2fc0fd.entry.js} +1 -1
- package/dist/zonos-elements/{p-1406d696.system.entry.js → p-85a49fb8.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-3115e7a7.system.js → p-884b41a8.system.js} +1 -1
- package/dist/zonos-elements/p-8a65433a.entry.js +1 -0
- package/dist/zonos-elements/{p-d03e101b.system.entry.js → p-8df58197.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-d5feef4c.js → p-95ffff25.js} +1 -1
- package/dist/zonos-elements/{p-ebb36e4d.entry.js → p-968df90a.entry.js} +1 -1
- package/dist/zonos-elements/{p-23393abc.system.entry.js → p-9a299a98.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-ce4c48f6.entry.js → p-a20f6ba3.entry.js} +1 -1
- package/dist/zonos-elements/{p-f0afca6c.system.js → p-a52afd83.system.js} +1 -1
- package/dist/zonos-elements/{p-0a4f341b.entry.js → p-bbe5d0f0.entry.js} +1 -1
- package/dist/zonos-elements/{p-dd02f2eb.entry.js → p-c0f0edbe.entry.js} +1 -1
- package/dist/zonos-elements/{p-971e73c3.system.entry.js → p-c2328652.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-474cb030.entry.js → p-c53f7199.entry.js} +1 -1
- package/dist/zonos-elements/{p-8f3f1a1b.system.js → p-c7360a6c.system.js} +1 -1
- package/dist/zonos-elements/{p-72191005.system.entry.js → p-c77c056d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-bfe6f84f.system.entry.js → p-d0a2b1ba.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-f16b80a3.system.js → p-d0c53fba.system.js} +1 -1
- package/dist/zonos-elements/p-d6f829c2.entry.js +1 -0
- package/dist/zonos-elements/{p-2c57097c.entry.js → p-d8255adf.entry.js} +1 -1
- package/dist/zonos-elements/{p-824e1e83.system.js → p-dafc6260.system.js} +1 -1
- package/dist/zonos-elements/{p-eb6ddb2f.js → p-df267420.js} +1 -1
- package/dist/zonos-elements/p-e0bf9666.system.js +1 -1
- package/dist/zonos-elements/{p-f4c921f8.entry.js → p-e5f7ff0f.entry.js} +1 -1
- package/dist/zonos-elements/{p-75d52d98.system.entry.js → p-e625f68d.system.entry.js} +1 -1
- package/dist/zonos-elements/{p-b925e897.system.entry.js → p-ecaed308.system.entry.js} +1 -1
- package/dist/zonos-elements/p-edfb5021.entry.js +1 -0
- package/dist/zonos-elements/zonos-elements.esm.js +1 -1
- package/package.json +4 -1
- package/dist/collection/components/utils/formatCurrency.js +0 -9
- package/dist/types/components/utils/formatCurrency.d.ts +0 -5
- package/dist/zonos-elements/p-14da9ed0.entry.js +0 -1
- package/dist/zonos-elements/p-3edcbb56.entry.js +0 -1
- package/dist/zonos-elements/p-5968c6ad.entry.js +0 -1
- package/dist/zonos-elements/p-59913049.entry.js +0 -1
- package/dist/zonos-elements/p-957301d0.system.entry.js +0 -1
- package/dist/zonos-elements/p-9e4b35d4.system.entry.js +0 -1
- package/dist/zonos-elements/p-d79e83bd.entry.js +0 -1
- package/dist/zonos-elements/p-eb765228.entry.js +0 -1
- package/dist/zonos-elements/p-f3a6de62.entry.js +0 -1
- package/dist/zonos-elements/p-fc5df354.system.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const zonosStore = require('./zonosStore-
|
|
3
|
+
const zonosStore = require('./zonosStore-768d6ca0.js');
|
|
4
4
|
const logError = require('./logError-4e2f2020.js');
|
|
5
|
-
const isDarkColor = require('./isDarkColor-
|
|
6
|
-
const getBorderRadius = require('./getBorderRadius-
|
|
5
|
+
const isDarkColor = require('./isDarkColor-3ddf6511.js');
|
|
6
|
+
const getBorderRadius = require('./getBorderRadius-332422ab.js');
|
|
7
7
|
|
|
8
8
|
const stringsArabic = {
|
|
9
9
|
'${percentage} GST due on any order above ${threshold} along with an import entry transaction fee and MPI levy.': {
|
|
@@ -5760,25 +5760,40 @@ const getCountryLandedCost = async (countryCode) => {
|
|
|
5760
5760
|
return json || null;
|
|
5761
5761
|
};
|
|
5762
5762
|
|
|
5763
|
+
const defaultUsExchangeRate = {
|
|
5764
|
+
exchangeRate: {
|
|
5765
|
+
rate: 1,
|
|
5766
|
+
targetFormat: {
|
|
5767
|
+
currencyCode: 'USD',
|
|
5768
|
+
decimalDelimiter: '.',
|
|
5769
|
+
scale: 2,
|
|
5770
|
+
symbol: '$',
|
|
5771
|
+
symbolLocation: 'before',
|
|
5772
|
+
thousandsDelimiter: ',',
|
|
5773
|
+
},
|
|
5774
|
+
},
|
|
5775
|
+
maxAge: null,
|
|
5776
|
+
};
|
|
5763
5777
|
const getExchangeRate = async ({ country, isGuaranteed, sourceCurrency, targetCurrency, }) => {
|
|
5764
5778
|
var _a;
|
|
5765
|
-
// If source currency matches target currency (US -> US) and is not a guaranteed rate, return
|
|
5779
|
+
// If source currency matches target currency (US -> US) and is not a guaranteed rate, return default exchange rate so we still format properly.
|
|
5766
5780
|
if (sourceCurrency === targetCurrency && !isGuaranteed) {
|
|
5767
|
-
return
|
|
5781
|
+
return defaultUsExchangeRate;
|
|
5768
5782
|
}
|
|
5769
5783
|
const url = `${"https://v1.route.js.zonos.com"}/api/zonos-elements/exchange-rates?sourceCurrency=${sourceCurrency}&targetCurrency=${targetCurrency}&isGuaranteed=${isGuaranteed}&country=${country}`;
|
|
5770
5784
|
const { errors, json } = await handleFetch(url);
|
|
5771
5785
|
if (errors.length || !json) {
|
|
5772
5786
|
logError.logError(`Error fetching country landed cost: ${(_a = errors.find(Boolean)) === null || _a === void 0 ? void 0 : _a.message}`);
|
|
5773
|
-
return
|
|
5787
|
+
return defaultUsExchangeRate;
|
|
5774
5788
|
}
|
|
5775
|
-
const {
|
|
5789
|
+
const { rate, targetFormat } = json.exchangeRateCreate;
|
|
5790
|
+
const maxAge = json.maxAge;
|
|
5776
5791
|
if (rate) {
|
|
5777
5792
|
sessionStorage.setItem(country + '_rate', JSON.stringify(rate));
|
|
5778
5793
|
const exchangeRate = { rate, targetFormat };
|
|
5779
5794
|
return { exchangeRate, maxAge };
|
|
5780
5795
|
}
|
|
5781
|
-
return
|
|
5796
|
+
return defaultUsExchangeRate;
|
|
5782
5797
|
};
|
|
5783
5798
|
|
|
5784
5799
|
const getLocaleMessages = async ({ countryCode, localeTo, storeId, }) => {
|
|
@@ -5849,41 +5864,55 @@ const currencyConvert = (value) => {
|
|
|
5849
5864
|
return Number(fixedValue);
|
|
5850
5865
|
};
|
|
5851
5866
|
|
|
5852
|
-
const currencyFormat = (
|
|
5853
|
-
if (
|
|
5867
|
+
const currencyFormat = ({ amount, currency, }) => {
|
|
5868
|
+
if (isNaN(amount) || (amount !== 0 && !amount)) {
|
|
5854
5869
|
return '';
|
|
5855
5870
|
}
|
|
5871
|
+
const overrideCurrencyFormat = zonosStore.zonosStore.overrideCurrencyFormat;
|
|
5856
5872
|
const { exchangeRate } = localizationStore;
|
|
5873
|
+
const targetCurrency = currency || localizationStore.targetCurrency;
|
|
5874
|
+
// Use user-defined currency format
|
|
5875
|
+
if (typeof overrideCurrencyFormat === 'function') {
|
|
5876
|
+
return overrideCurrencyFormat({
|
|
5877
|
+
amount: amount,
|
|
5878
|
+
countryCode: targetCurrency,
|
|
5879
|
+
});
|
|
5880
|
+
}
|
|
5857
5881
|
const { targetFormat } = exchangeRate || {};
|
|
5858
|
-
if (!targetFormat) {
|
|
5859
|
-
|
|
5882
|
+
if (!targetFormat || !exchangeRate) {
|
|
5883
|
+
// Return the amount as a string if no exchange rate is available
|
|
5884
|
+
return `${amount.toString()} ${targetCurrency}`;
|
|
5860
5885
|
}
|
|
5861
|
-
const minimumFractionDigits =
|
|
5862
|
-
// browsers can autoformat the currency based on the users language setting
|
|
5863
|
-
// unless the browser is Internet Explorer, because Internet Explorer is stupid
|
|
5886
|
+
const minimumFractionDigits = targetFormat.scale || 2;
|
|
5864
5887
|
const isIE = window.navigator.userAgent.indexOf('MSIE ') !== -1;
|
|
5865
5888
|
const numberFormatExists = typeof Intl === 'object' && Intl && typeof Intl.NumberFormat === 'function';
|
|
5866
|
-
if (
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
minimumFractionDigits: minimumFractionDigits,
|
|
5870
|
-
style: 'currency',
|
|
5871
|
-
}).format(value);
|
|
5872
|
-
}
|
|
5873
|
-
else {
|
|
5874
|
-
let formattedNumber = Number(value)
|
|
5889
|
+
if (isIE || !numberFormatExists) {
|
|
5890
|
+
// use native number formatting if it's IE.
|
|
5891
|
+
const formattedNumber = Number(amount)
|
|
5875
5892
|
.toFixed(minimumFractionDigits)
|
|
5876
5893
|
.replace('.', '|dec|')
|
|
5877
5894
|
.replace(',', targetFormat.thousandsDelimiter || '')
|
|
5878
5895
|
.replace('|dec|', targetFormat.decimalDelimiter || '');
|
|
5879
|
-
const result = `${
|
|
5896
|
+
const result = `${formattedNumber}${targetFormat.currencyCode !== 'USD' ? ` ${targetFormat.currencyCode}` : ''}`;
|
|
5880
5897
|
return result;
|
|
5881
5898
|
}
|
|
5899
|
+
const currencyDisplay = (overrideCurrencyFormat === null || overrideCurrencyFormat === void 0 ? void 0 : overrideCurrencyFormat.currencyDisplay) || 'symbol';
|
|
5900
|
+
const formatedNumber = new Intl.NumberFormat(window.navigator.language, {
|
|
5901
|
+
currency: targetCurrency,
|
|
5902
|
+
currencyDisplay,
|
|
5903
|
+
minimumFractionDigits: minimumFractionDigits,
|
|
5904
|
+
style: 'currency',
|
|
5905
|
+
}).format(amount);
|
|
5906
|
+
// Move currency code to the end of the string if currencyDisplay is 'code'
|
|
5907
|
+
const result = currencyDisplay === 'code'
|
|
5908
|
+
? `${formatedNumber.replace(new RegExp(`${targetCurrency}\\s+`), '')} ${targetCurrency}`
|
|
5909
|
+
: formatedNumber;
|
|
5910
|
+
return result;
|
|
5882
5911
|
};
|
|
5883
5912
|
|
|
5884
5913
|
const currencyConvertAndFormat = (value) => {
|
|
5885
5914
|
const convertedValue = currencyConvert(value);
|
|
5886
|
-
const formattedValue = currencyFormat(convertedValue);
|
|
5915
|
+
const formattedValue = currencyFormat({ amount: convertedValue });
|
|
5887
5916
|
return formattedValue;
|
|
5888
5917
|
};
|
|
5889
5918
|
|
|
@@ -5944,16 +5973,26 @@ const convertCurrency = (element) => {
|
|
|
5944
5973
|
return;
|
|
5945
5974
|
}
|
|
5946
5975
|
const currentIntlValue = element.getAttribute('data-zintl');
|
|
5976
|
+
// get rate
|
|
5977
|
+
const currentIntlRateValue = parseFloat(element.getAttribute('data-zrate') || '1');
|
|
5947
5978
|
const currentCountryValue = element.getAttribute('data-zcountry-code');
|
|
5948
5979
|
// do nothing if the target currency is the same
|
|
5949
|
-
const isExchangeRateReady = localizationStore.
|
|
5950
|
-
|
|
5980
|
+
const isExchangeRateReady = localizationStore.exchangeRate &&
|
|
5981
|
+
localizationStore.targetCurrency ===
|
|
5982
|
+
localizationStore.exchangeRate.targetFormat.currencyCode;
|
|
5983
|
+
const rate = ((_a = localizationStore.exchangeRate) === null || _a === void 0 ? void 0 : _a.rate) || 1;
|
|
5951
5984
|
// if the current value on the element is different from the current intl value, update the data-zintl attribute
|
|
5952
5985
|
if (isExchangeRateReady &&
|
|
5986
|
+
// Update currency if the value is not yet formatted
|
|
5953
5987
|
(element.textContent !== currentIntlValue ||
|
|
5988
|
+
// Update rate when new rate is available
|
|
5989
|
+
rate !== currentIntlRateValue ||
|
|
5990
|
+
// Update currency when the country code changes
|
|
5954
5991
|
currentCountryValue !== localizationStore.selectedCountryCode)) {
|
|
5955
5992
|
const observedFormattedValue = currencyConvertAndFormat(amount);
|
|
5956
5993
|
element.textContent = observedFormattedValue;
|
|
5994
|
+
// save the new rate to the data-zrate attribute
|
|
5995
|
+
element.setAttribute('data-zrate', rate.toString());
|
|
5957
5996
|
// save the new value to the data-zintl attribute
|
|
5958
5997
|
element.setAttribute('data-zintl', observedFormattedValue);
|
|
5959
5998
|
element.setAttribute('data-zcountry-code', localizationStore.selectedCountryCode || '');
|
|
@@ -5985,7 +6024,7 @@ const currencyDisplay = () => {
|
|
|
5985
6024
|
zonosStore.zonosStore.currencyConverter({
|
|
5986
6025
|
convert: currencyConvert,
|
|
5987
6026
|
convertAndFormat: currencyConvertAndFormat,
|
|
5988
|
-
format: currencyFormat,
|
|
6027
|
+
format: (value) => currencyFormat({ amount: value }),
|
|
5989
6028
|
selector: currencyElementSelector,
|
|
5990
6029
|
});
|
|
5991
6030
|
}
|
|
@@ -6023,7 +6062,7 @@ const setZCountryUrlParam = (selectedCountryCode) => {
|
|
|
6023
6062
|
}
|
|
6024
6063
|
};
|
|
6025
6064
|
|
|
6026
|
-
const { onChange: localizationStoreOnUpdate, state: localizationStore } = zonosStore.createStore({
|
|
6065
|
+
const { dispose: localizationDispose, onChange: localizationStoreOnUpdate, state: localizationStore, } = zonosStore.createStore({
|
|
6027
6066
|
countryLandedCost: null,
|
|
6028
6067
|
customMessages: [],
|
|
6029
6068
|
exchangeRate: null,
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -236,8 +236,8 @@ const zonosLoadUrl = (() => {
|
|
|
236
236
|
}
|
|
237
237
|
return null;
|
|
238
238
|
})();
|
|
239
|
-
const ZONOS_URL = zonosLoadUrl || "https://v1.3.
|
|
240
|
-
const JS_DELIVR_ZONOS_URL = "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.
|
|
239
|
+
const ZONOS_URL = zonosLoadUrl || "https://v1.3.22.js.zonos.com";
|
|
240
|
+
const JS_DELIVR_ZONOS_URL = "https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.22";
|
|
241
241
|
const INTER_FONT_URL = 'https://rsms.me';
|
|
242
242
|
const GOOGLE_FONT_URL = 'https://fonts.googleapis.com';
|
|
243
243
|
const INTER_FONT_REGEX = /^https:\/\/rsms\.me\/inter\/inter\.css(.*)$/;
|
|
@@ -257,12 +257,12 @@ Zonos.isBigCommerce = false;
|
|
|
257
257
|
Zonos.isNpm = true;
|
|
258
258
|
Zonos.internationalHideSelector = '';
|
|
259
259
|
Zonos.zonosQaUrl = null;
|
|
260
|
-
Zonos.version = `v${"1.3.
|
|
260
|
+
Zonos.version = `v${"1.3.22"}`;
|
|
261
261
|
Zonos.modeAlerted = false;
|
|
262
262
|
Zonos.tempCartData = null;
|
|
263
263
|
Zonos.getCurrentTimestamp = () => new Date().getTime();
|
|
264
264
|
Zonos.zonosController = null;
|
|
265
|
-
Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, storeId, zonosApiKey, }) => {
|
|
265
|
+
Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSettings, onCountryChange, overrideCurrencyFormat, storeId, zonosApiKey, }) => {
|
|
266
266
|
if (_a.doneInit) {
|
|
267
267
|
// do nothing if zonos is already initializeds
|
|
268
268
|
return;
|
|
@@ -291,6 +291,7 @@ Zonos.init = async ({ appearance, checkoutSettings, currencyConverter, helloSett
|
|
|
291
291
|
currencyConverter,
|
|
292
292
|
helloSettings,
|
|
293
293
|
onCountryChange,
|
|
294
|
+
overrideCurrencyFormat,
|
|
294
295
|
},
|
|
295
296
|
zonosApiKey,
|
|
296
297
|
});
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
|
10
10
|
await appGlobals.globalScripts();
|
|
11
|
-
return index.bootstrapLazy([["zonos-checkout.cjs",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"open":[32],"stripe":[32],"submitLoading":[32],"paymentError":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"domesticRedirectedBtnSelector":[32],"legacyCheckoutHiddenBtnSelector":[32],"isLegacyCheckout":[32],"confirmDialogOpen":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[4,"keydown","handleKeyPress"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],"mobile":["handleMobileChange"]}]]],["zonos-hello.cjs",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]],{"appearanceSettingsOverride":["handleAppearanceSettingsOverrideChange"]}]]],["zonos-controller.cjs",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]},[[8,"locationchange","handleLocationChange"]]]]],["zonos-component.cjs",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link.cjs",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo.cjs",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-text.cjs",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"
|
|
11
|
+
return index.bootstrapLazy([["zonos-checkout.cjs",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"open":[32],"stripe":[32],"submitLoading":[32],"paymentError":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"domesticRedirectedBtnSelector":[32],"legacyCheckoutHiddenBtnSelector":[32],"isLegacyCheckout":[32],"confirmDialogOpen":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[4,"keydown","handleKeyPress"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],"mobile":["handleMobileChange"]}]]],["zonos-hello.cjs",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]],{"appearanceSettingsOverride":["handleAppearanceSettingsOverrideChange"]}]]],["zonos-controller.cjs",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]},[[8,"locationchange","handleLocationChange"]]]]],["zonos-component.cjs",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link.cjs",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo.cjs",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-text.cjs",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"ready":[32]}]]],["zonos-hello-dialog.cjs",[[1,"zonos-hello-dialog",{"isOpen":[4,"is-open"],"setIsOpen":[16],"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettings":[16],"restrictedItems":[16],"welcomeMessage":[32],"showCountrySelect":[32],"showLanguageSelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["zonos-notification.cjs",[[1,"zonos-notification",{"notificationArray":[32],"showNotification":[64]}]]],["zonos-payment.cjs",[[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32]},null,{"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}]]],["zonos-shipping-rich-radio.cjs",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"initialSelectedValue":[8,"initial-selected-value"],"selectedItem":[32]}]]],["zonos-badge_2.cjs",[[1,"zonos-badge",{"bold":[4],"badgeColor":[1,"badge-color"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4]}],[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}]]],["zonos-input.cjs",[[1,"zonos-input",{"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"inputSize":[1,"input-size"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"inputPlaceholder":[1,"input-placeholder"],"value":[32]},null,{"inputValue":["onInputValueChange"]}]]],["zonos-banner.cjs",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["zonos-button_3.cjs",[[17,"zonos-button",{"buttonColor":[1,"button-color"],"backgroundColor":[1,"background-color"],"borderStyle":[1,"border-style"],"isDisabled":[4,"is-disabled"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"variant":[1],"noBackground":[4,"no-background"],"withBoxShadow":[4,"with-box-shadow"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-spinner",{"size":[2],"spinnerColor":[1,"spinner-color"]}],[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"iconColor":[1,"icon-color"],"content":[1],"size":[2]}]]],["zonos-select-dialog-header_2.cjs",[[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}],[1,"zonos-v-stack",{"spacing":[2]}]]],["zonos-card_2.cjs",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-card",{"actions":[16],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}]]],["zonos-country-flag.cjs",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-country-select_3.cjs",[[1,"zonos-country-select",{"handleOnClose":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16],"setShowLanguageSelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}]]],["zonos-address_8.cjs",[[1,"zonos-address-update-dialog",{"continueLoading":[4,"continue-loading"],"dialogLoading":[4,"dialog-loading"],"dialogOpen":[4,"dialog-open"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"shippingAddress":[16],"billingAddress":[16],"translatedShippingAddress":[16],"translatedBillingAddress":[16],"showErrorBanner":[32],"translatedShippingAddressState":[32],"translatedBillingAddressState":[32]},null,{"translatedShippingAddress":["watchTranslatedShippingAddress"],"translatedBillingAddress":["watchTranslatedBillingAddress"]}],[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"stripe":[32],"isDirtyAddress":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-checkbox",{"backgroundColor":[1,"background-color"],"label":[1],"isChecked":[4,"is-checked"],"isDisabled":[4,"is-disabled"],"size":[2],"fontSize":[1,"font-size"],"borderStyle":[1,"border-style"]},[[1,"click","onClick"]]],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"defaultEmail":[1,"default-email"],"stripe":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"minHeight":[1,"min-height"],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"borderStyle":[1,"border-style"],"noCloseButton":[4,"no-close-button"],"noClickOutside":[4,"no-click-outside"],"mobile":[4],"isLoading":[4,"is-loading"],"isMobile":[32]},[[9,"resize","handleWindowResize"],[4,"keydown","handleKeyDown"]]],[1,"zonos-address-display",{"currentAddress":[16],"addressType":[1,"address-type"]}],[1,"zonos-address-form",{"currentAddress":[16],"translatedAddress":[16],"addressType":[1,"address-type"],"localAddress":[32]},null,{"translatedAddress":["watchCurrentAddress"]}],[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32],"iframe":[32]}]]],["zonos-cart-items_11.cjs",[[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"defaultAddress":[16],"showErrorBanner":[32],"shippingCountry":[32],"isCheckingForRestrictedItems":[32],"isValidatingAddress":[32],"invalidShippingCharacterList":[32],"invalidBillingCharacterList":[32],"openAddressValidationDialog":[32]}],[1,"zonos-checkout-footer",{"mobile":[4],"dataTheme":[1,"data-theme"],"showLanguageDialog":[32],"isMobile":[32]},[[4,"click","handleGlobalClick"]],{"mobile":["handleMobileChange"]}],[2,"zonos-checkout-payment",{"paymentError":[4,"payment-error"],"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"showErrorBanner":[32]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"isSelecting":[32],"showErrorBanner":[32],"serviceLevels":[32]}],[1,"zonos-cart-restricted-items",{"hide":[4],"errorImages":[32],"internalCollapsed":[32],"firstRender":[32]}],[1,"zonos-cart-subtotal"],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32],"order":[32]}],[1,"zonos-confirm-dialog",{"dialogTitle":[1,"dialog-title"],"dialogIntent":[1,"dialog-intent"],"dialogSubtitle":[1,"dialog-subtitle"],"submitBtnColor":[1,"submit-btn-color"],"dialogConfirmBtnText":[1,"dialog-confirm-btn-text"],"dialogCancelBtnText":[1,"dialog-cancel-btn-text"],"isMobile":[4,"is-mobile"],"dialogOpen":[4,"dialog-open"],"noClickOutside":[4,"no-click-outside"]},[[4,"keydown","handleKeyDown"]]],[1,"zonos-checkout-progress-tabs",{"tabColor":[1,"tab-color"],"backgroundColor":[1,"background-color"],"setTabItems":[64],"setTabSelected":[64]}],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{"errorImages":[32]}]]]], options);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.setNonce = index.setNonce;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const cart = require('./cart-
|
|
4
|
-
const zonosStore = require('./zonosStore-
|
|
3
|
+
const cart = require('./cart-f963b239.js');
|
|
4
|
+
const zonosStore = require('./zonosStore-768d6ca0.js');
|
|
5
5
|
const logError = require('./logError-4e2f2020.js');
|
|
6
6
|
|
|
7
7
|
const trackConversionEvent = async (eventName, metadata) => {
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b071017b.js');
|
|
6
|
-
const cart = require('./cart-
|
|
6
|
+
const cart = require('./cart-f963b239.js');
|
|
7
7
|
const isCheckoutMobile = require('./isCheckoutMobile-f491ca7c.js');
|
|
8
8
|
const logError = require('./logError-4e2f2020.js');
|
|
9
9
|
const containsNonLatinChars = require('./containsNonLatinChars-2be5129b.js');
|
|
10
|
-
const zonosStore = require('./zonosStore-
|
|
10
|
+
const zonosStore = require('./zonosStore-768d6ca0.js');
|
|
11
11
|
const classes = require('./classes-b7918f56.js');
|
|
12
12
|
const RemoveIcon$1 = require('./RemoveIcon-081ac073.js');
|
|
13
|
-
const getBorderRadius = require('./getBorderRadius-
|
|
14
|
-
const isDarkColor = require('./isDarkColor-
|
|
13
|
+
const getBorderRadius = require('./getBorderRadius-332422ab.js');
|
|
14
|
+
const isDarkColor = require('./isDarkColor-3ddf6511.js');
|
|
15
15
|
|
|
16
16
|
const zonosAddressCss = ".sc-zonos-address-h{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";
|
|
17
17
|
const ZonosAddressStyle0 = zonosAddressCss;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b071017b.js');
|
|
6
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const zonosStore = require('./zonosStore-768d6ca0.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
8
|
|
|
9
9
|
const zonosBadgeCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex}:host .zonos--badge-content{display:-ms-flexbox;display:flex;gap:8px;font-size:var(--zonos-elements-font-size-s);padding:4px 8px;text-align:center;border-radius:var(--zonos-elements-radius-6);background-color:var(--zonos-elements-gray-100);color:var(--zonos-elements-gray-800);-ms-flex-align:center;align-items:center}:host p{font-weight:600;line-height:16px}:host .icon-right svg{-ms-flex-order:2;order:2}:host .small{padding:2px 8px}:host .rounded{border-radius:20px}:host .bold{background-color:var(--zonos-elements-gray-600);color:var(--zonos-elements-gray-100)}:host .blue{background-color:var(--zonos-elements-blue-100);color:var(--zonos-elements-blue-800)}:host .blue.bold{background-color:var(--zonos-elements-blue-600);color:var(--zonos-elements-blue-100)}:host .green{background-color:var(--zonos-elements-green-100);color:var(--zonos-elements-green-800)}:host .green.bold{background-color:var(--zonos-elements-green-600);color:var(--zonos-elements-green-100)}:host .red{background-color:var(--zonos-elements-red-100);color:var(--zonos-elements-red-800)}:host .red.bold{background-color:var(--zonos-elements-red-600);color:var(--zonos-elements-red-100)}:host .orange{background-color:var(--zonos-elements-orange-100);color:var(--zonos-elements-orange-800)}:host .orange.bold{background-color:var(--zonos-elements-orange-600);color:var(--zonos-elements-orange-100)}:host .purple{background-color:var(--zonos-elements-purple-100);color:var(--zonos-elements-purple-800)}:host .purple.bold{background-color:var(--zonos-elements-purple-600);color:var(--zonos-elements-purple-100)}:host .cyan{background-color:var(--zonos-elements-cyan-100);color:var(--zonos-elements-cyan-800)}:host .cyan.bold{background-color:var(--zonos-elements-cyan-600);color:var(--zonos-elements-cyan-100)}";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b071017b.js');
|
|
6
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const zonosStore = require('./zonosStore-768d6ca0.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
8
|
|
|
9
9
|
const zonosBannerCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{border-radius:var(--zonos-elements-radius-10);padding:16px;background:var(--zonos-elements-gray-100)}:host .zonos--container{display:grid;-ms-flex-align:center;align-items:center;grid-template-areas:\"icon header\" \". content\";grid-template-columns:32px auto 0}:host .zonos--icon-wrapper{grid-area:icon;display:-ms-flexbox;display:flex;justify-self:start}:host .zonos--header-wrapper{margin-top:0px;grid-area:header}:host .zonos--content-wrapper{grid-area:content;margin-top:4px}:host(.info){background-color:var(--zonos-elements-blue-100);border:1px solid var(--zonos-elements-blue-200)}:host(.success){background-color:var(--zonos-elements-green-100);border:1px solid var(--zonos-elements-green-200)}:host(.error){background-color:var(--zonos-elements-red-100);border:1px solid var(--zonos-elements-red-200)}:host(.warning){background-color:var(--zonos-elements-orange-100);border:1px solid var(--zonos-elements-orange-200)}";
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b071017b.js');
|
|
6
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const zonosStore = require('./zonosStore-768d6ca0.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const getBorderRadius = require('./getBorderRadius-
|
|
8
|
+
const getBorderRadius = require('./getBorderRadius-332422ab.js');
|
|
9
9
|
const isColorVariable = require('./isColorVariable-6f5a9608.js');
|
|
10
|
-
const isDarkColor = require('./isDarkColor-
|
|
10
|
+
const isDarkColor = require('./isDarkColor-3ddf6511.js');
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Get theme for button text based on background color
|
|
@@ -23,6 +23,11 @@ const getButtonTheme = (overrideBackground) => {
|
|
|
23
23
|
return buttonTheme;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
// This is to determine if variable of the element is using dark theme, so we can invert the color if needed
|
|
27
|
+
const isElementUsingDarkTheme = (element) => isDarkColor.isDarkColor(window
|
|
28
|
+
.getComputedStyle(element)
|
|
29
|
+
.getPropertyValue('--zonos-elements-gray-0'));
|
|
30
|
+
|
|
26
31
|
/**
|
|
27
32
|
* Filter out all of the undefined values from the object so we don't have undefined css variable values
|
|
28
33
|
*/
|
|
@@ -36,7 +41,7 @@ const styles = (props) => {
|
|
|
36
41
|
}, {});
|
|
37
42
|
};
|
|
38
43
|
|
|
39
|
-
const zonosButtonCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;border-radius:var(--border-radius, var(--zonos-elements-radius-10))}:host .zonos--spinner-wrapper{position:absolute;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background-color:var(--zonos-elements-surface-color);-ms-flex-pack:center;justify-content:center;border-radius:var(--zonos-elements-radius-10);gap:8px}:host button{width:100%;position:relative;font-size:14px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--zonos-elements-surface-color);border:none;outline:1px solid var(--zonos-elements-surface-color);border-radius:var(--border-radius, var(--zonos-elements-radius-10));-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);font-weight:500;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-family:var(--font-family, Inter), Inter;letter-spacing:normal;cursor:pointer;white-space:nowrap;padding:8px 24px;color:var(--color, var(--zonos-elements-gray-1200));margin:1px;}:host button:not([disabled]):hover{background-image:var(--zonos-elements-button-standard-hover)}:host button:not([disabled]):active{background:var(--zonos-elements-gray-700)}:host button:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button.with-box-shadow{-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard)}:host button.sm.no-background,:host button.md.no-background,:host button.lg.no-background{background:none;outline:none}:host button.sm.no-padding-left,:host button.md.no-padding-left,:host button.lg.no-padding-left{padding-left:0}:host button.sm.no-padding-right,:host button.md.no-padding-right,:host button.lg.no-padding-right{padding-right:0}:host button[disabled]{cursor:not-allowed;background-color:var(--background-color, var(--zonos-elements-gray-200))}:host button[disabled] .zonos--spinner-wrapper{background-color:var(--background-color, var(--zonos-elements-gray-200))}:host button:active{-webkit-transform:scale(0.99);transform:scale(0.99)}:host button.sm{height:var(--zonos-elements-size-sm);line-height:var(--zonos-elements-size-sm);padding:4px 8px}:host button.sm:not(.has-content).has-icon{padding:0 4px}:host button.md{height:var(--zonos-elements-size-md);line-height:var(--zonos-elements-size-md);padding:8px 16px}:host button.md:not(.has-content).has-icon{padding:0 8px}:host button.lg{height:var(--zonos-elements-size-lg);line-height:var(--zonos-elements-size-lg);padding:12px 24px}:host button.lg:not(.has-content).has-icon{padding:0 16px}:host button:not(.only-icon).has-icon{gap:8px}@media (max-width: 400px){:host button:not(.only-icon).has-icon{font-size:var(--zonos-elements-font-size-s)}}:host button.override-background{background-color:var(--background-color, var(--zonos-elements-gray-0));color:var(--color, var(--zonos-elements-gray-1200));outline:1px solid var(--background-color, var(--zonos-elements-gray-0))}:host button.override-background:disabled{opacity:0.8}:host button.override-background:not(:disabled):hover{opacity:0.9}:host button:not(.override-background){}:host button:not(.override-background).primary{background:var(--zonos-elements-blue-600);outline:1px solid var(--zonos-elements-blue-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).primary:not([disabled]):hover{background-image:var(--zonos-elements-button-primary-hover)}:host button:not(.override-background).primary:not([disabled]):active{background:var(--zonos-elements-blue-700)}:host button:not(.override-background).primary:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).primary[disabled]{background:var(--zonos-elements-blue-400)}:host button:not(.override-background).primary[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-blue-400)}:host button:not(.override-background).primary .zonos--spinner-wrapper{background-color:var(--zonos-elements-blue-600)}:host button:not(.override-background).success{background:var(--zonos-elements-green-600);outline:1px solid var(--zonos-elements-green-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).success:not([disabled]):hover{background-image:var(--zonos-elements-button-success-hover)}:host button:not(.override-background).success:not([disabled]):active{background:var(--zonos-elements-green-700)}:host button:not(.override-background).success:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).success[disabled]{background:var(--zonos-elements-green-400)}:host button:not(.override-background).success[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-green-400)}:host button:not(.override-background).danger{background:var(--zonos-elements-red-600);outline:1px solid var(--zonos-elements-red-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).danger:not([disabled]):hover{background-image:var(--zonos-elements-button-danger-hover)}:host button:not(.override-background).danger:not([disabled]):active{background:var(--zonos-elements-red-700)}:host button:not(.override-background).danger:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).danger[disabled]{background:var(--zonos-elements-red-400)}:host button:not(.override-background).danger[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-red-400)}:host button:not(.override-background).warning{background:var(--zonos-elements-orange-600);outline:1px solid var(--zonos-elements-orange-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).warning:not([disabled]):hover{background-image:var(--zonos-elements-button-warning-hover)}:host button:not(.override-background).warning:not([disabled]):active{background:var(--zonos-elements-orange-700)}:host button:not(.override-background).warning:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).warning[disabled]{background:var(--zonos-elements-orange-400)}:host button:not(.override-background).warning[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-orange-400)}:host button:not(.override-background).subtle{background:transparent;color:var(--color);outline:none}:host button:not(.override-background).subtle:not([disabled]):hover{background:var(--zonos-elements-gray-
|
|
44
|
+
const zonosButtonCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;border-radius:var(--border-radius, var(--zonos-elements-radius-10))}:host .zonos--spinner-wrapper{position:absolute;top:0;left:0;right:0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;background-color:var(--zonos-elements-surface-color);-ms-flex-pack:center;justify-content:center;border-radius:var(--zonos-elements-radius-10);gap:8px}:host button{width:100%;position:relative;font-size:14px;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--zonos-elements-surface-color);border:none;outline:1px solid var(--zonos-elements-surface-color);border-radius:var(--border-radius, var(--zonos-elements-radius-10));-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);font-weight:500;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-family:var(--font-family, Inter), Inter;letter-spacing:normal;cursor:pointer;white-space:nowrap;padding:8px 24px;color:var(--color, var(--zonos-elements-gray-1200));margin:1px;}:host button:not([disabled]):hover{background-image:var(--zonos-elements-button-standard-hover)}:host button:not([disabled]):active{background:var(--zonos-elements-gray-700)}:host button:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button.with-box-shadow{-webkit-box-shadow:var(--zonos-elements-shadow-button-standard);box-shadow:var(--zonos-elements-shadow-button-standard)}:host button.sm.no-background,:host button.md.no-background,:host button.lg.no-background{background:none;outline:none}:host button.sm.no-padding-left,:host button.md.no-padding-left,:host button.lg.no-padding-left{padding-left:0}:host button.sm.no-padding-right,:host button.md.no-padding-right,:host button.lg.no-padding-right{padding-right:0}:host button[disabled]{cursor:not-allowed;background-color:var(--background-color, var(--zonos-elements-gray-200))}:host button[disabled] .zonos--spinner-wrapper{background-color:var(--background-color, var(--zonos-elements-gray-200))}:host button:active{-webkit-transform:scale(0.99);transform:scale(0.99)}:host button.sm{height:var(--zonos-elements-size-sm);line-height:var(--zonos-elements-size-sm);padding:4px 8px}:host button.sm:not(.has-content).has-icon{padding:0 4px}:host button.md{height:var(--zonos-elements-size-md);line-height:var(--zonos-elements-size-md);padding:8px 16px}:host button.md:not(.has-content).has-icon{padding:0 8px}:host button.lg{height:var(--zonos-elements-size-lg);line-height:var(--zonos-elements-size-lg);padding:12px 24px}:host button.lg:not(.has-content).has-icon{padding:0 16px}:host button:not(.only-icon).has-icon{gap:8px}@media (max-width: 400px){:host button:not(.only-icon).has-icon{font-size:var(--zonos-elements-font-size-s)}}:host button.override-background{background-color:var(--background-color, var(--zonos-elements-gray-0));color:var(--color, var(--zonos-elements-gray-1200));outline:1px solid var(--background-color, var(--zonos-elements-gray-0))}:host button.override-background:disabled{opacity:0.8}:host button.override-background:not(:disabled):hover{opacity:0.9}:host button:not(.override-background){}:host button:not(.override-background).primary{background:var(--zonos-elements-blue-600);outline:1px solid var(--zonos-elements-blue-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).primary:not([disabled]):hover{background-image:var(--zonos-elements-button-primary-hover)}:host button:not(.override-background).primary:not([disabled]):active{background:var(--zonos-elements-blue-700)}:host button:not(.override-background).primary:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).primary[disabled]{background:var(--zonos-elements-blue-400)}:host button:not(.override-background).primary[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-blue-400)}:host button:not(.override-background).primary .zonos--spinner-wrapper{background-color:var(--zonos-elements-blue-600)}:host button:not(.override-background).success{background:var(--zonos-elements-green-600);outline:1px solid var(--zonos-elements-green-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).success:not([disabled]):hover{background-image:var(--zonos-elements-button-success-hover)}:host button:not(.override-background).success:not([disabled]):active{background:var(--zonos-elements-green-700)}:host button:not(.override-background).success:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).success[disabled]{background:var(--zonos-elements-green-400)}:host button:not(.override-background).success[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-green-400)}:host button:not(.override-background).danger{background:var(--zonos-elements-red-600);outline:1px solid var(--zonos-elements-red-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).danger:not([disabled]):hover{background-image:var(--zonos-elements-button-danger-hover)}:host button:not(.override-background).danger:not([disabled]):active{background:var(--zonos-elements-red-700)}:host button:not(.override-background).danger:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).danger[disabled]{background:var(--zonos-elements-red-400)}:host button:not(.override-background).danger[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-red-400)}:host button:not(.override-background).warning{background:var(--zonos-elements-orange-600);outline:1px solid var(--zonos-elements-orange-600);color:var(--zonos-elements-gray-0)}:host button:not(.override-background).warning:not([disabled]):hover{background-image:var(--zonos-elements-button-warning-hover)}:host button:not(.override-background).warning:not([disabled]):active{background:var(--zonos-elements-orange-700)}:host button:not(.override-background).warning:not([disabled]):focus{-webkit-box-shadow:var(--zonos-elements-focus-button);box-shadow:var(--zonos-elements-focus-button)}:host button:not(.override-background).warning[disabled]{background:var(--zonos-elements-orange-400)}:host button:not(.override-background).warning[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-orange-400)}:host button:not(.override-background).subtle{background:transparent;color:var(--color);outline:none}:host button:not(.override-background).subtle:not([disabled]):hover{background:var(--zonos-elements-gray-900)}:host button:not(.override-background).subtle:not([disabled]):active{background:var(--zonos-elements-gray-800)}:host button:not(.override-background).subtle:not([disabled]).dark-hover-subtle:hover{background:var(--zonos-elements-gray-100)}:host button:not(.override-background).subtle:not([disabled]).dark-hover-subtle:active{background:var(--zonos-elements-gray-200)}:host button:not(.override-background).subtle:focus{-webkit-box-shadow:var(--zonos-elements-button-focus-ring);box-shadow:var(--zonos-elements-button-focus-ring)}:host button:not(.override-background).subtle[disabled] .content{opacity:0.6}:host button:not(.override-background).subtle[disabled] .zonos--spinner-wrapper{background-color:var(--zonos-elements-gray-0)}:host button:not(.override-background).outline{background:transparent;outline:1px solid var(--zonos-elements-gray-700)}:host button:not(.override-background).outline:not([disabled]):hover{background-color:var(--zonos-elements-gray-100)}:host button:not(.override-background).outline:not([disabled]):active{background:var(--zonos-elements-gray-200)}:host .zonos--footer-country-flag{height:18px;width:18px;position:relative;overflow:hidden;border-radius:30px;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);z-index:10;justify-self:center;border-radius:var(--zonos-elements-radius-4);width:24px}";
|
|
40
45
|
const ZonosButtonStyle0 = zonosButtonCss;
|
|
41
46
|
|
|
42
47
|
const ZonosButton = class {
|
|
@@ -49,6 +54,69 @@ const ZonosButton = class {
|
|
|
49
54
|
this.hasContent = true;
|
|
50
55
|
};
|
|
51
56
|
this.getColorVarProperty = (color) => color.replace('var(', '').replace(')', '');
|
|
57
|
+
this.getButtonStyle = () => {
|
|
58
|
+
/**
|
|
59
|
+
* If the parent component pass in the variant prop with `undefined` value, it would not re-assign the `undefined` value with the default value.
|
|
60
|
+
* So need to re-assign the variant prop with the default value if the value is `undefined` here.
|
|
61
|
+
*/
|
|
62
|
+
const variant = this.variant || 'standard';
|
|
63
|
+
// use the variable if it's a color variable, otherwise use the color
|
|
64
|
+
const color = this.buttonColor && isColorVariable.isColorVariable(this.buttonColor)
|
|
65
|
+
? `var(--zonos-elements-${this.buttonColor})`
|
|
66
|
+
: this.buttonColor;
|
|
67
|
+
const actualTextColor = window
|
|
68
|
+
.getComputedStyle(this.ele)
|
|
69
|
+
.getPropertyValue(this.getColorVarProperty(color || '')) ||
|
|
70
|
+
color ||
|
|
71
|
+
'';
|
|
72
|
+
/**
|
|
73
|
+
* Determine if the button should use dark hover subtle
|
|
74
|
+
* If variable = LIGHT && text color = LIGHT, use white hover subtle
|
|
75
|
+
* If variable = LIGHT && text color = DARK, use dark hover subtle
|
|
76
|
+
* If variable = DARK && text color = LIGHT, use dark hover subtle (invert hover color)
|
|
77
|
+
* If variable = DARK && text color = DARK, use white hover subtle (invert hover color)
|
|
78
|
+
*/
|
|
79
|
+
const isLightVariable = !isElementUsingDarkTheme(this.ele);
|
|
80
|
+
const isTextLight = !isDarkColor.isDarkColor(actualTextColor);
|
|
81
|
+
const useDarkHoverSubtle = (isLightVariable && !isTextLight) || (!isLightVariable && isTextLight);
|
|
82
|
+
switch (variant) {
|
|
83
|
+
case 'subtle': {
|
|
84
|
+
// Background color is not used for subtle variant
|
|
85
|
+
return {
|
|
86
|
+
color,
|
|
87
|
+
useDarkHoverSubtle,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
default: {
|
|
91
|
+
// use the variable if it's a color variable, otherwise use the color
|
|
92
|
+
const backgroundColor = this.backgroundColor && isColorVariable.isColorVariable(this.backgroundColor)
|
|
93
|
+
? `var(--zonos-elements-${this.backgroundColor})`
|
|
94
|
+
: this.backgroundColor;
|
|
95
|
+
// use override background if it exists, otherwise use color from setting
|
|
96
|
+
const overrideBackground = backgroundColor || zonosStore.zonosStore.appearance.colorSecondary;
|
|
97
|
+
const backgroundActualColor = overrideBackground &&
|
|
98
|
+
isColorVariable.isColorVariable(this.getColorVarProperty(overrideBackground))
|
|
99
|
+
? window
|
|
100
|
+
.getComputedStyle(this.ele)
|
|
101
|
+
.getPropertyValue(this.getColorVarProperty(overrideBackground))
|
|
102
|
+
: overrideBackground;
|
|
103
|
+
// set contrast color if background color is dark for all variants except subtle
|
|
104
|
+
const contrastColor = this.variant !== 'subtle' &&
|
|
105
|
+
backgroundActualColor &&
|
|
106
|
+
isDarkColor.isDarkColor(backgroundActualColor)
|
|
107
|
+
? 'white'
|
|
108
|
+
: color;
|
|
109
|
+
return {
|
|
110
|
+
backgroundColor: overrideBackground,
|
|
111
|
+
color: contrastColor,
|
|
112
|
+
spinnerColor: backgroundActualColor && isDarkColor.isDarkColor(backgroundActualColor)
|
|
113
|
+
? 'white'
|
|
114
|
+
: 'black',
|
|
115
|
+
useDarkHoverSubtle,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
52
120
|
this.buttonColor = undefined;
|
|
53
121
|
this.backgroundColor = undefined;
|
|
54
122
|
this.borderStyle = undefined;
|
|
@@ -82,48 +150,20 @@ const ZonosButton = class {
|
|
|
82
150
|
this.iconChangeHandler();
|
|
83
151
|
}
|
|
84
152
|
render() {
|
|
153
|
+
const { backgroundColor, color, spinnerColor, useDarkHoverSubtle } = this.getButtonStyle();
|
|
85
154
|
const disabled = this.loading || this.isDisabled;
|
|
86
|
-
/**
|
|
87
|
-
* If the parent component pass in the variant prop with `undefined` value, it would not re-assign the `undefined` value with the default value.
|
|
88
|
-
* So need to re-assign the variant prop with the default value if the value is `undefined` here.
|
|
89
|
-
*/
|
|
90
155
|
const variant = this.variant || 'standard';
|
|
91
|
-
//
|
|
92
|
-
const
|
|
93
|
-
? `var(--zonos-elements-${this.backgroundColor})`
|
|
94
|
-
: this.backgroundColor;
|
|
95
|
-
// use override background if it exists, otherwise use color from setting
|
|
96
|
-
const overrideBackground = backgroundColor || zonosStore.zonosStore.appearance.colorSecondary;
|
|
97
|
-
// only set theme for button to change text color if variant is standard and override background is set
|
|
98
|
-
const buttonTheme = variant === 'standard' ? getButtonTheme(overrideBackground) : undefined;
|
|
156
|
+
// // only set theme for button to change text color if variant is standard and override background is set
|
|
157
|
+
const buttonTheme = variant === 'standard' ? getButtonTheme(backgroundColor) : undefined;
|
|
99
158
|
const borderStyle = getBorderRadius.getBorderRadius({
|
|
100
159
|
overrideBorderStyle: this.borderStyle,
|
|
101
160
|
});
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
? window
|
|
105
|
-
.getComputedStyle(this.ele)
|
|
106
|
-
.getPropertyValue(this.getColorVarProperty(overrideBackground))
|
|
107
|
-
: overrideBackground;
|
|
108
|
-
// use the variable if it's a color variable, otherwise use the color
|
|
109
|
-
const color = this.buttonColor && isColorVariable.isColorVariable(this.buttonColor)
|
|
110
|
-
? `var(--zonos-elements-${this.buttonColor})`
|
|
111
|
-
: this.buttonColor;
|
|
112
|
-
// set contrast color if background color is dark for all variants except subtle
|
|
113
|
-
const contrastColor = this.variant !== 'subtle' &&
|
|
114
|
-
backgroundActualColor &&
|
|
115
|
-
isDarkColor.isDarkColor(backgroundActualColor)
|
|
116
|
-
? 'white'
|
|
117
|
-
: color;
|
|
118
|
-
const spinnerColor = backgroundActualColor && isDarkColor.isDarkColor(backgroundActualColor)
|
|
119
|
-
? 'white'
|
|
120
|
-
: 'black';
|
|
121
|
-
return (index.h(index.Host, { key: '00d085d600a759366f4a2de8617d81831c0ce16b', class: classes.classes(['zonos--elements']), "data-theme": this.theme || buttonTheme, disabled: disabled, style: styles({
|
|
122
|
-
'--background-color': overrideBackground,
|
|
161
|
+
return (index.h(index.Host, { key: 'a07724884592f96388174eb751bc3349391e2bf6', class: classes.classes(['zonos--elements']), "data-theme": this.theme || buttonTheme, disabled: disabled, style: styles({
|
|
162
|
+
'--background-color': backgroundColor,
|
|
123
163
|
'--border-radius': borderStyle,
|
|
124
|
-
'--color':
|
|
164
|
+
'--color': color,
|
|
125
165
|
'--font-family': zonosStore.zonosStoreFontFamily(),
|
|
126
|
-
}) }, index.h("button", { key: '
|
|
166
|
+
}) }, index.h("button", { key: 'd34d62c7582abdb6aee6a1ec7fefb89bcc7a31ac', class: classes.classes([
|
|
127
167
|
this.hasIcon && 'has-icon',
|
|
128
168
|
this.hasContent && 'has-content',
|
|
129
169
|
this.noBackground && 'no-background',
|
|
@@ -131,13 +171,12 @@ const ZonosButton = class {
|
|
|
131
171
|
this.noPaddingRight && 'no-padding-right',
|
|
132
172
|
this.iconRight && 'icon-right',
|
|
133
173
|
this.withBoxShadow && 'with-box-shadow',
|
|
174
|
+
useDarkHoverSubtle && 'dark-hover-subtle',
|
|
134
175
|
variant,
|
|
135
176
|
this.size,
|
|
136
177
|
// only override background if variant is set to standard
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
'override-background',
|
|
140
|
-
]), disabled: disabled }, this.loading && (index.h("div", { key: '4462430185736b45b11bd18f08d1e3c6177f192f', class: "zonos--spinner-wrapper" }, index.h("zonos-spinner", { key: 'c866ff989b95929e8d6a44d950dc943531f1dc0c', size: 16, spinnerColor: spinnerColor }))), !this.loading && !this.iconRight && this.icon, index.h("slot", { key: 'a57d0b3924eef51bf3938261c8d823e9d8aa0206', onSlotchange: this.handleSlotChange }), !this.loading && this.iconRight && this.icon)));
|
|
178
|
+
backgroundColor && variant === 'standard' && 'override-background',
|
|
179
|
+
]), disabled: disabled }, this.loading && (index.h("div", { key: 'aaa929d205d5a4cec679f3ee7ef6097801dc69d0', class: "zonos--spinner-wrapper" }, index.h("zonos-spinner", { key: '372b0a8504ecb0af54c7f68a67d6ad400bb13173', size: 16, spinnerColor: spinnerColor }))), !this.loading && !this.iconRight && this.icon, index.h("slot", { key: '0eefacfb7af58abf8049fd72180ba82f09ef9a34', onSlotchange: this.handleSlotChange }), !this.loading && this.iconRight && this.icon)));
|
|
141
180
|
}
|
|
142
181
|
static get delegatesFocus() { return true; }
|
|
143
182
|
get ele() { return index.getElement(this); }
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-b071017b.js');
|
|
6
|
-
const zonosStore = require('./zonosStore-
|
|
6
|
+
const zonosStore = require('./zonosStore-768d6ca0.js');
|
|
7
7
|
const classes = require('./classes-b7918f56.js');
|
|
8
|
-
const cart = require('./cart-
|
|
8
|
+
const cart = require('./cart-f963b239.js');
|
|
9
9
|
const ILanguage = require('./ILanguage-d247b45b.js');
|
|
10
10
|
require('./logError-4e2f2020.js');
|
|
11
|
-
require('./isDarkColor-
|
|
12
|
-
require('./getBorderRadius-
|
|
11
|
+
require('./isDarkColor-3ddf6511.js');
|
|
12
|
+
require('./getBorderRadius-332422ab.js');
|
|
13
13
|
|
|
14
14
|
const zonosCardCss = ":host{font-family:var(--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .styled-card{border:var(--zonos-elements-border);border-radius:var(--zonos-elements-radius-6);padding:var(--spacing, 24px);text-align:left}:host .styled-card hr{margin-left:calc(var(--spacing, 24px) * -1);margin-right:calc(var(--spacing, 24px) * -1)}:host .styled-card .card-header{margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-bottom:var(--spacing, 24px);border-bottom:var(--zonos-elements-border);height:65px;line-height:65px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host .styled-card .card-header h5{margin-bottom:0;-ms-flex:1;flex:1}:host .styled-card .card-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;margin:calc(var(--spacing, 24px) * -1);padding:var(--spacing, 24px);border-top:var(--zonos-elements-border);background:var(--zonos-elements-surface-color-secondary);margin-top:var(--spacing, 24px);border-bottom-left-radius:var(--zonos-elements-radius-8);border-bottom-right-radius:var(--zonos-elements-radius-8);height:var(--footerHeight)}";
|
|
15
15
|
const ZonosCardStyle0 = zonosCardCss;
|