stripe-pwa-elements 4.0.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/factory-tenFFIul.js +1200 -0
- package/dist/cjs/{factory-da3xAKkz.js → i18n-FhEOc8vz.js} +6 -1131
- package/dist/cjs/ion-icon_2.cjs.entry.js +723 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/stripe-address-element.cjs.entry.js +12 -4
- package/dist/cjs/stripe-card-element-modal.cjs.entry.js +3 -2
- package/dist/cjs/{stripe-card-element_2.cjs.entry.js → stripe-card-element.cjs.entry.js} +15 -82
- package/dist/cjs/stripe-currency-selector.cjs.entry.js +11 -3
- package/dist/cjs/stripe-elements.cjs.js +1 -1
- package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +31 -5
- package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +11 -3
- package/dist/cjs/stripe-payment-element.cjs.entry.js +106 -161
- package/dist/cjs/stripe-payment-element.helpers-DukP33RI.js +122 -0
- package/dist/cjs/stripe-payment-request-button.cjs.entry.js +23 -16
- package/dist/cjs/stripe-payment-sheet.cjs.entry.js +506 -0
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/stripe-address-element/stripe-address-element.js +7 -0
- package/dist/collection/components/stripe-card-element/stripe-card-element.js +10 -2
- package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +4 -3
- package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +7 -0
- package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +25 -0
- package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +7 -0
- package/dist/collection/components/stripe-modal/stripe-modal.css +23 -1
- package/dist/collection/components/stripe-modal/stripe-modal.js +147 -6
- package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +94 -37
- package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +17 -10
- package/dist/collection/components/stripe-payment-sheet/payment-sheet-state.js +179 -0
- package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.css +68 -0
- package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.helpers.js +90 -0
- package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.js +544 -0
- package/dist/collection/services/express-checkout-element-manager.js +36 -2
- package/dist/collection/services/stripe-service.js +37 -5
- package/dist/collection/utils/focus.js +76 -0
- package/dist/collection/utils/i18n.js +6 -0
- package/dist/components/factory.js +1 -1
- package/dist/components/i18n.js +1 -0
- package/dist/components/stripe-address-element.js +1 -1
- package/dist/components/stripe-card-element-modal.js +1 -1
- package/dist/components/stripe-card-element2.js +1 -1
- package/dist/components/stripe-currency-selector.js +1 -1
- package/dist/components/stripe-express-checkout-element.js +1 -1
- package/dist/components/stripe-link-authentication-element.js +1 -1
- package/dist/components/stripe-modal2.js +1 -1
- package/dist/components/stripe-payment-element.helpers.js +1 -0
- package/dist/components/stripe-payment-element.js +1 -1
- package/dist/components/stripe-payment-request-button2.js +1 -1
- package/dist/components/stripe-payment-sheet.d.ts +11 -0
- package/dist/components/stripe-payment-sheet.js +1 -0
- package/dist/esm/factory-Cd6OGTWN.js +1198 -0
- package/dist/esm/{factory-DeqoYLf_.js → i18n-B6JoQetF.js} +7 -1131
- package/dist/esm/ion-icon_2.entry.js +720 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/stripe-address-element.entry.js +9 -1
- package/dist/esm/stripe-card-element-modal.entry.js +3 -2
- package/dist/esm/{stripe-card-element_2.entry.js → stripe-card-element.entry.js} +13 -79
- package/dist/esm/stripe-currency-selector.entry.js +9 -1
- package/dist/esm/stripe-elements.js +1 -1
- package/dist/esm/stripe-express-checkout-element.entry.js +27 -1
- package/dist/esm/stripe-link-authentication-element.entry.js +9 -1
- package/dist/esm/stripe-payment-element.entry.js +98 -153
- package/dist/esm/stripe-payment-element.helpers-CipV87b8.js +117 -0
- package/dist/esm/stripe-payment-request-button.entry.js +18 -11
- package/dist/esm/stripe-payment-sheet.entry.js +504 -0
- package/dist/stripe-elements/{p-38e7b187.entry.js → p-4891edf0.entry.js} +1 -1
- package/dist/stripe-elements/p-5338bc5e.entry.js +1 -0
- package/dist/stripe-elements/p-6a9c8b7a.entry.js +1 -0
- package/dist/stripe-elements/p-7fe4a287.entry.js +1 -0
- package/dist/stripe-elements/p-915b86ed.entry.js +1 -0
- package/dist/stripe-elements/p-B6JoQetF.js +1 -0
- package/dist/stripe-elements/p-C7MQk9FK.js +1 -0
- package/dist/stripe-elements/p-DFAhQS0n.js +1 -0
- package/dist/stripe-elements/p-b06a254f.entry.js +1 -0
- package/dist/stripe-elements/p-b91c4fa7.entry.js +1 -0
- package/dist/stripe-elements/p-ba791c8f.entry.js +1 -0
- package/dist/stripe-elements/p-e7372ca7.entry.js +1 -0
- package/dist/stripe-elements/p-f892e375.entry.js +1 -0
- package/dist/stripe-elements/stripe-elements.esm.js +1 -1
- package/dist/types/components/stripe-address-element/stripe-address-element.d.ts +6 -0
- package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +8 -1
- package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +2 -1
- package/dist/types/components/stripe-currency-selector/stripe-currency-selector.d.ts +6 -0
- package/dist/types/components/stripe-express-checkout-element/stripe-express-checkout-element.d.ts +11 -0
- package/dist/types/components/stripe-link-authentication-element/stripe-link-authentication-element.d.ts +6 -0
- package/dist/types/components/stripe-modal/stripe-modal.d.ts +44 -0
- package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +18 -0
- package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +7 -2
- package/dist/types/components/stripe-payment-sheet/payment-sheet-state.d.ts +104 -0
- package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.d.ts +112 -0
- package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.helpers.d.ts +95 -0
- package/dist/types/components.d.ts +169 -10
- package/dist/types/index.d.ts +2 -0
- package/dist/types/services/interfaces.d.ts +2 -0
- package/dist/types/services/stripe-service.d.ts +12 -3
- package/dist/types/utils/focus.d.ts +15 -0
- package/package.json +5 -3
- package/readme.md +46 -10
- package/dist/cjs/ion-icon.cjs.entry.js +0 -431
- package/dist/components/utils.js +0 -1
- package/dist/esm/ion-icon.entry.js +0 -429
- package/dist/stripe-elements/p--sA2m1ad.js +0 -1
- package/dist/stripe-elements/p-44495284.entry.js +0 -1
- package/dist/stripe-elements/p-4ba675fa.entry.js +0 -1
- package/dist/stripe-elements/p-5cf62945.entry.js +0 -1
- package/dist/stripe-elements/p-c24ae181.entry.js +0 -1
- package/dist/stripe-elements/p-d9e86451.entry.js +0 -1
- package/dist/stripe-elements/p-f09c86a0.entry.js +0 -1
- package/dist/stripe-elements/p-f64f394d.entry.js +0 -1
- package/dist/stripe-elements/p-f6d2425e.entry.js +0 -1
|
@@ -0,0 +1,720 @@
|
|
|
1
|
+
import { e as getAssetPath, r as registerInstance, f as Build, h, d as Host, g as getElement, a as createEvent } from './index-C6bbmyga.js';
|
|
2
|
+
import { c as checkPlatform, i as i18n } from './i18n-B6JoQetF.js';
|
|
3
|
+
|
|
4
|
+
let CACHED_MAP;
|
|
5
|
+
const getIconMap = () => {
|
|
6
|
+
if (typeof window === 'undefined') {
|
|
7
|
+
return new Map();
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
if (!CACHED_MAP) {
|
|
11
|
+
const win = window;
|
|
12
|
+
win.Ionicons = win.Ionicons || {};
|
|
13
|
+
CACHED_MAP = win.Ionicons.map = win.Ionicons.map || new Map();
|
|
14
|
+
}
|
|
15
|
+
return CACHED_MAP;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const getUrl = (i) => {
|
|
19
|
+
let url = getSrc(i.src);
|
|
20
|
+
if (url) {
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
url = getName(i.name, i.icon, i.mode, i.ios, i.md);
|
|
24
|
+
if (url) {
|
|
25
|
+
return getNamedUrl(url, i);
|
|
26
|
+
}
|
|
27
|
+
if (i.icon) {
|
|
28
|
+
url = getSrc(i.icon);
|
|
29
|
+
if (url) {
|
|
30
|
+
return url;
|
|
31
|
+
}
|
|
32
|
+
url = getSrc(i.icon[i.mode]);
|
|
33
|
+
if (url) {
|
|
34
|
+
return url;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
};
|
|
39
|
+
const getNamedUrl = (iconName, iconEl) => {
|
|
40
|
+
const url = getIconMap().get(iconName);
|
|
41
|
+
if (url) {
|
|
42
|
+
return url;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
return getAssetPath(`svg/${iconName}.svg`);
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
console.log('e', e);
|
|
49
|
+
/**
|
|
50
|
+
* In the custom elements build version of ionicons, referencing an icon
|
|
51
|
+
* by name will throw an invalid URL error because the asset path is not defined.
|
|
52
|
+
* This catches that error and logs something that is more developer-friendly.
|
|
53
|
+
* We also include a reference to the ion-icon element so developers can
|
|
54
|
+
* figure out which instance of ion-icon needs to be updated.
|
|
55
|
+
*/
|
|
56
|
+
console.warn(`[Ionicons Warning]: Could not load icon with name "${iconName}". Ensure that the icon is registered using addIcons or that the icon SVG data is passed directly to the icon component.`, iconEl);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const getName = (iconName, icon, mode, ios, md) => {
|
|
60
|
+
// default to "md" if somehow the mode wasn't set
|
|
61
|
+
mode = (mode && toLower(mode)) === 'ios' ? 'ios' : 'md';
|
|
62
|
+
// if an icon was passed in using the ios or md attributes
|
|
63
|
+
// set the iconName to whatever was passed in
|
|
64
|
+
if (ios && mode === 'ios') {
|
|
65
|
+
iconName = toLower(ios);
|
|
66
|
+
}
|
|
67
|
+
else if (md && mode === 'md') {
|
|
68
|
+
iconName = toLower(md);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
if (!iconName && icon && !isSrc(icon)) {
|
|
72
|
+
iconName = icon;
|
|
73
|
+
}
|
|
74
|
+
if (isStr(iconName)) {
|
|
75
|
+
iconName = toLower(iconName);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (!isStr(iconName) || iconName.trim() === '') {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
// only allow alpha characters and dash
|
|
82
|
+
const invalidChars = iconName.replace(/[a-z]|-|\d/gi, '');
|
|
83
|
+
if (invalidChars !== '') {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return iconName;
|
|
87
|
+
};
|
|
88
|
+
const getSrc = (src) => {
|
|
89
|
+
if (isStr(src)) {
|
|
90
|
+
src = src.trim();
|
|
91
|
+
if (isSrc(src)) {
|
|
92
|
+
return src;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
};
|
|
97
|
+
const isSrc = (str) => str.length > 0 && /(\/|\.)/.test(str);
|
|
98
|
+
const isStr = (val) => typeof val === 'string';
|
|
99
|
+
const toLower = (val) => val.toLowerCase();
|
|
100
|
+
/**
|
|
101
|
+
* Elements inside of web components sometimes need to inherit global attributes
|
|
102
|
+
* set on the host. For example, the inner input in `ion-input` should inherit
|
|
103
|
+
* the `title` attribute that developers set directly on `ion-input`. This
|
|
104
|
+
* helper function should be called in componentWillLoad and assigned to a variable
|
|
105
|
+
* that is later used in the render function.
|
|
106
|
+
*
|
|
107
|
+
* This does not need to be reactive as changing attributes on the host element
|
|
108
|
+
* does not trigger a re-render.
|
|
109
|
+
*/
|
|
110
|
+
const inheritAttributes = (el, attributes = []) => {
|
|
111
|
+
const attributeObject = {};
|
|
112
|
+
attributes.forEach((attr) => {
|
|
113
|
+
if (el.hasAttribute(attr)) {
|
|
114
|
+
const value = el.getAttribute(attr);
|
|
115
|
+
if (value !== null) {
|
|
116
|
+
attributeObject[attr] = el.getAttribute(attr);
|
|
117
|
+
}
|
|
118
|
+
el.removeAttribute(attr);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return attributeObject;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Returns `true` if the document or host element
|
|
125
|
+
* has a `dir` set to `rtl`. The host value will always
|
|
126
|
+
* take priority over the root document value.
|
|
127
|
+
*/
|
|
128
|
+
const isRTL = (hostEl) => {
|
|
129
|
+
if (hostEl) {
|
|
130
|
+
if (hostEl.dir !== '') {
|
|
131
|
+
return hostEl.dir.toLowerCase() === 'rtl';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return (document === null || document === void 0 ? void 0 : document.dir.toLowerCase()) === 'rtl';
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const validateContent = (svgContent) => {
|
|
138
|
+
const div = document.createElement('div');
|
|
139
|
+
div.innerHTML = svgContent;
|
|
140
|
+
// setup this way to ensure it works on our buddy IE
|
|
141
|
+
for (let i = div.childNodes.length - 1; i >= 0; i--) {
|
|
142
|
+
if (div.childNodes[i].nodeName.toLowerCase() !== 'svg') {
|
|
143
|
+
div.removeChild(div.childNodes[i]);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// must only have 1 root element
|
|
147
|
+
const svgElm = div.firstElementChild;
|
|
148
|
+
if (svgElm && svgElm.nodeName.toLowerCase() === 'svg') {
|
|
149
|
+
const svgClass = svgElm.getAttribute('class') || '';
|
|
150
|
+
svgElm.setAttribute('class', (svgClass + ' s-ion-icon').trim());
|
|
151
|
+
// root element must be an svg
|
|
152
|
+
// lets double check we've got valid elements
|
|
153
|
+
// do not allow scripts
|
|
154
|
+
if (isValid(svgElm)) {
|
|
155
|
+
return div.innerHTML;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return '';
|
|
159
|
+
};
|
|
160
|
+
const isValid = (elm) => {
|
|
161
|
+
if (elm.nodeType === 1) {
|
|
162
|
+
if (elm.nodeName.toLowerCase() === 'script') {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
for (let i = 0; i < elm.attributes.length; i++) {
|
|
166
|
+
const name = elm.attributes[i].name;
|
|
167
|
+
if (isStr(name) && name.toLowerCase().indexOf('on') === 0) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
for (let i = 0; i < elm.childNodes.length; i++) {
|
|
172
|
+
if (!isValid(elm.childNodes[i])) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return true;
|
|
178
|
+
};
|
|
179
|
+
const isSvgDataUrl = (url) => url.startsWith('data:image/svg+xml');
|
|
180
|
+
const isEncodedDataUrl = (url) => url.indexOf(';utf8,') !== -1;
|
|
181
|
+
|
|
182
|
+
const ioniconContent = new Map();
|
|
183
|
+
const requests = new Map();
|
|
184
|
+
let parser;
|
|
185
|
+
/**
|
|
186
|
+
* Safely fallback to an empty svg
|
|
187
|
+
*/
|
|
188
|
+
function safeFallback(url) {
|
|
189
|
+
const svg = '';
|
|
190
|
+
ioniconContent.set(url, svg);
|
|
191
|
+
return svg;
|
|
192
|
+
}
|
|
193
|
+
const getSvgContent = (url, sanitize) => {
|
|
194
|
+
/**
|
|
195
|
+
* See if we already have a request for this url
|
|
196
|
+
*/
|
|
197
|
+
const req = requests.get(url);
|
|
198
|
+
if (req) {
|
|
199
|
+
return req;
|
|
200
|
+
}
|
|
201
|
+
if (typeof fetch !== 'undefined' && typeof document !== 'undefined') {
|
|
202
|
+
/**
|
|
203
|
+
* If the url is a data url of an svg, then try to parse it
|
|
204
|
+
* with the DOMParser. This works with content security policies enabled.
|
|
205
|
+
*/
|
|
206
|
+
if (isSvgDataUrl(url) && isEncodedDataUrl(url)) {
|
|
207
|
+
return Promise.resolve(getSvgByUrl(url));
|
|
208
|
+
}
|
|
209
|
+
return fetchSvg(url, sanitize);
|
|
210
|
+
}
|
|
211
|
+
return Promise.resolve(safeFallback(url));
|
|
212
|
+
};
|
|
213
|
+
function getSvgByUrl(url) {
|
|
214
|
+
if (!parser) {
|
|
215
|
+
/**
|
|
216
|
+
* Create an instance of the DOM parser. This creates a single
|
|
217
|
+
* parser instance for the entire app, which is more efficient.
|
|
218
|
+
*/
|
|
219
|
+
parser = new DOMParser();
|
|
220
|
+
}
|
|
221
|
+
const doc = parser.parseFromString(url, 'text/html');
|
|
222
|
+
const svg = doc.querySelector('svg');
|
|
223
|
+
if (svg) {
|
|
224
|
+
ioniconContent.set(url, svg.outerHTML);
|
|
225
|
+
return svg.outerHTML;
|
|
226
|
+
}
|
|
227
|
+
throw new Error(`Could not parse svg from ${url}`);
|
|
228
|
+
}
|
|
229
|
+
function fetchSvg(url, sanitize) {
|
|
230
|
+
/**
|
|
231
|
+
* We don't already have a request
|
|
232
|
+
*/
|
|
233
|
+
const req = fetch(url)
|
|
234
|
+
.then((rsp) => {
|
|
235
|
+
/**
|
|
236
|
+
* When fetching from a file:// URL, some browsers return
|
|
237
|
+
* a 0 status code even when the request succeeds so don't
|
|
238
|
+
* rely on rsp.ok as the only signal of success.
|
|
239
|
+
*/
|
|
240
|
+
return rsp
|
|
241
|
+
.text()
|
|
242
|
+
.then((svgContent) => {
|
|
243
|
+
if (svgContent && sanitize !== false) {
|
|
244
|
+
svgContent = validateContent(svgContent);
|
|
245
|
+
}
|
|
246
|
+
const svg = svgContent || '';
|
|
247
|
+
ioniconContent.set(url, svg);
|
|
248
|
+
return svg;
|
|
249
|
+
})
|
|
250
|
+
.catch(() => safeFallback(url));
|
|
251
|
+
})
|
|
252
|
+
.catch(() => safeFallback(url));
|
|
253
|
+
/**
|
|
254
|
+
* Cache for the same requests
|
|
255
|
+
*/
|
|
256
|
+
requests.set(url, req);
|
|
257
|
+
return req;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const iconCss = () => `:host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;box-sizing:content-box !important}:host .ionicon{stroke:currentColor}.ionicon-fill-none{fill:none}.ionicon-stroke-width{stroke-width:var(--ionicon-stroke-width, 32px)}.icon-inner,.ionicon,svg{display:block;height:100%;width:100%}@supports (background: -webkit-named-image(i)){:host(.icon-rtl) .icon-inner{transform:scaleX(-1)}}@supports not selector(:dir(rtl)) and selector(:host-context([dir='rtl'])){:host(.icon-rtl) .icon-inner{transform:scaleX(-1)}}:host(.flip-rtl):host-context([dir='rtl']) .icon-inner{transform:scaleX(-1)}@supports selector(:dir(rtl)){:host(.flip-rtl:dir(rtl)) .icon-inner{transform:scaleX(-1)}:host(.flip-rtl:dir(ltr)) .icon-inner{transform:scaleX(1)}}:host(.icon-small){font-size:1.125rem !important}:host(.icon-large){font-size:2rem !important}:host(.ion-color){color:var(--ion-color-base) !important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary, #3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary, #0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary, #f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success, #10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning, #ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger, #f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light, #f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium, #989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark, #222428)}`;
|
|
261
|
+
|
|
262
|
+
const Icon = class {
|
|
263
|
+
constructor(hostRef) {
|
|
264
|
+
registerInstance(this, hostRef);
|
|
265
|
+
this.iconName = null;
|
|
266
|
+
this.inheritedAttributes = {};
|
|
267
|
+
this.didLoadIcon = false;
|
|
268
|
+
this.isVisible = false;
|
|
269
|
+
/**
|
|
270
|
+
* The mode determines which platform styles to use.
|
|
271
|
+
*/
|
|
272
|
+
this.mode = getIonMode();
|
|
273
|
+
/**
|
|
274
|
+
* If enabled, ion-icon will be loaded lazily when it's visible in the viewport.
|
|
275
|
+
* Default, `false`.
|
|
276
|
+
*/
|
|
277
|
+
this.lazy = false;
|
|
278
|
+
/**
|
|
279
|
+
* When set to `false`, SVG content that is HTTP fetched will not be checked
|
|
280
|
+
* if the response SVG content has any `<script>` elements, or any attributes
|
|
281
|
+
* that start with `on`, such as `onclick`.
|
|
282
|
+
* @default true
|
|
283
|
+
*/
|
|
284
|
+
this.sanitize = true;
|
|
285
|
+
}
|
|
286
|
+
componentWillLoad() {
|
|
287
|
+
this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);
|
|
288
|
+
}
|
|
289
|
+
connectedCallback() {
|
|
290
|
+
/**
|
|
291
|
+
* purposely do not return the promise here because loading
|
|
292
|
+
* the svg file should not hold up loading the app
|
|
293
|
+
* only load the svg if it's visible
|
|
294
|
+
*/
|
|
295
|
+
this.waitUntilVisible(this.el, '50px', () => {
|
|
296
|
+
this.isVisible = true;
|
|
297
|
+
this.loadIcon();
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Loads the icon after the component has finished rendering.
|
|
302
|
+
*/
|
|
303
|
+
componentDidLoad() {
|
|
304
|
+
/**
|
|
305
|
+
* Addresses an Angular issue where property values are assigned after the 'connectedCallback' but prior to the registration of watchers.
|
|
306
|
+
* This enhancement ensures the loading of an icon when the component has finished rendering and the icon has yet to apply the SVG data.
|
|
307
|
+
* This modification pertains to the usage of Angular's binding syntax:
|
|
308
|
+
* `<ion-icon [name]="myIconName"></ion-icon>`
|
|
309
|
+
*/
|
|
310
|
+
if (!this.didLoadIcon) {
|
|
311
|
+
this.loadIcon();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Disconnect the IntersectionObserver.
|
|
316
|
+
*/
|
|
317
|
+
disconnectedCallback() {
|
|
318
|
+
if (this.io) {
|
|
319
|
+
this.io.disconnect();
|
|
320
|
+
this.io = undefined;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Wait until the icon is visible in the viewport.
|
|
325
|
+
* @param el - The element to observe.
|
|
326
|
+
* @param rootMargin - The root margin of the observer.
|
|
327
|
+
* @param cb - The callback to call when the element is visible.
|
|
328
|
+
*/
|
|
329
|
+
waitUntilVisible(el, rootMargin, cb) {
|
|
330
|
+
/**
|
|
331
|
+
* IntersectionObserver is a browser API that allows you to observe
|
|
332
|
+
* the visibility of an element relative to a root element. It is
|
|
333
|
+
* supported in all modern browsers, except IE and when server-side
|
|
334
|
+
* rendering.
|
|
335
|
+
*/
|
|
336
|
+
const hasIntersectionObserverSupport = Boolean(Build.isBrowser && this.lazy && typeof window !== 'undefined' && window.IntersectionObserver);
|
|
337
|
+
/**
|
|
338
|
+
* browser doesn't support IntersectionObserver
|
|
339
|
+
* so just fallback to always show it
|
|
340
|
+
*/
|
|
341
|
+
if (!hasIntersectionObserverSupport) {
|
|
342
|
+
return cb();
|
|
343
|
+
}
|
|
344
|
+
const io = (this.io = new window.IntersectionObserver((data) => {
|
|
345
|
+
if (data[0].isIntersecting) {
|
|
346
|
+
io.disconnect();
|
|
347
|
+
this.io = undefined;
|
|
348
|
+
cb();
|
|
349
|
+
}
|
|
350
|
+
}, { rootMargin }));
|
|
351
|
+
io.observe(el);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Watch for changes to the icon name, src, icon, ios, or md properties.
|
|
355
|
+
* When a change is detected, the icon will be loaded.
|
|
356
|
+
*/
|
|
357
|
+
loadIcon() {
|
|
358
|
+
if (Build.isBrowser && this.isVisible) {
|
|
359
|
+
const url = getUrl(this);
|
|
360
|
+
if (url) {
|
|
361
|
+
if (ioniconContent.has(url)) {
|
|
362
|
+
// sync if it's already loaded
|
|
363
|
+
this.svgContent = ioniconContent.get(url);
|
|
364
|
+
}
|
|
365
|
+
else {
|
|
366
|
+
// async if it hasn't been loaded
|
|
367
|
+
getSvgContent(url, this.sanitize).then(() => (this.svgContent = ioniconContent.get(url)));
|
|
368
|
+
}
|
|
369
|
+
this.didLoadIcon = true;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
this.iconName = getName(this.name, this.icon, this.mode, this.ios, this.md);
|
|
373
|
+
}
|
|
374
|
+
render() {
|
|
375
|
+
const { flipRtl, iconName, inheritedAttributes, el } = this;
|
|
376
|
+
const mode = this.mode || 'md';
|
|
377
|
+
/**
|
|
378
|
+
* we have designated that arrows & chevrons should automatically flip (unless flip-rtl
|
|
379
|
+
* is set to false) because "back" is left in ltr and right in rtl, and "forward" is the opposite
|
|
380
|
+
*/
|
|
381
|
+
const shouldAutoFlip = iconName
|
|
382
|
+
? (iconName.includes('arrow') || iconName.includes('chevron')) && flipRtl !== false
|
|
383
|
+
: false;
|
|
384
|
+
/**
|
|
385
|
+
* if shouldBeFlippable is true, the icon should change direction when `dir` changes
|
|
386
|
+
*/
|
|
387
|
+
const shouldBeFlippable = flipRtl || shouldAutoFlip;
|
|
388
|
+
return (h(Host, Object.assign({ key: '0578c899781ca145dd8205acd9670af39b57cf2e', role: "img", class: Object.assign(Object.assign({ [mode]: true }, createColorClasses(this.color)), { [`icon-${this.size}`]: !!this.size, 'flip-rtl': shouldBeFlippable, 'icon-rtl': shouldBeFlippable && isRTL(el) }) }, inheritedAttributes), Build.isBrowser && this.svgContent ? (h("div", { class: "icon-inner", innerHTML: this.svgContent })) : (h("div", { class: "icon-inner" }))));
|
|
389
|
+
}
|
|
390
|
+
static get assetsDirs() { return ["svg"]; }
|
|
391
|
+
get el() { return getElement(this); }
|
|
392
|
+
static get watchers() { return {
|
|
393
|
+
"name": [{
|
|
394
|
+
"loadIcon": 0
|
|
395
|
+
}],
|
|
396
|
+
"src": [{
|
|
397
|
+
"loadIcon": 0
|
|
398
|
+
}],
|
|
399
|
+
"icon": [{
|
|
400
|
+
"loadIcon": 0
|
|
401
|
+
}],
|
|
402
|
+
"ios": [{
|
|
403
|
+
"loadIcon": 0
|
|
404
|
+
}],
|
|
405
|
+
"md": [{
|
|
406
|
+
"loadIcon": 0
|
|
407
|
+
}]
|
|
408
|
+
}; }
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* Get the mode of the document.
|
|
412
|
+
* @returns The mode of the document.
|
|
413
|
+
*/
|
|
414
|
+
const getIonMode = () => (Build.isBrowser && typeof document !== 'undefined' && document.documentElement.getAttribute('mode')) || 'md';
|
|
415
|
+
/**
|
|
416
|
+
* Create color classes for the icon.
|
|
417
|
+
* @param color - The color of the icon.
|
|
418
|
+
* @returns The color classes for the icon.
|
|
419
|
+
*/
|
|
420
|
+
const createColorClasses = (color) => {
|
|
421
|
+
return color
|
|
422
|
+
? {
|
|
423
|
+
'ion-color': true,
|
|
424
|
+
[`ion-color-${color}`]: true,
|
|
425
|
+
}
|
|
426
|
+
: null;
|
|
427
|
+
};
|
|
428
|
+
Icon.style = iconCss();
|
|
429
|
+
|
|
430
|
+
const TABBABLE_SELECTOR = [
|
|
431
|
+
'a[href]',
|
|
432
|
+
'area[href]',
|
|
433
|
+
'button:not([disabled])',
|
|
434
|
+
'input:not([disabled]):not([type="hidden"])',
|
|
435
|
+
'select:not([disabled])',
|
|
436
|
+
'textarea:not([disabled])',
|
|
437
|
+
'iframe',
|
|
438
|
+
'audio[controls]',
|
|
439
|
+
'video[controls]',
|
|
440
|
+
'summary',
|
|
441
|
+
'[contenteditable]:not([contenteditable="false"])',
|
|
442
|
+
'[tabindex]',
|
|
443
|
+
].join(',');
|
|
444
|
+
/**
|
|
445
|
+
* Whether the element can be reached with the Tab key.
|
|
446
|
+
* Elements hidden with `display: none` / `visibility: hidden` are excluded when the browser supports `checkVisibility()`.
|
|
447
|
+
*/
|
|
448
|
+
const isTabbable = (element) => {
|
|
449
|
+
if (!element.matches(TABBABLE_SELECTOR)) {
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
const tabindex = element.getAttribute('tabindex');
|
|
453
|
+
if (tabindex !== null && Number(tabindex) < 0) {
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
if (element.hasAttribute('hidden') || element.closest('[inert]') !== null) {
|
|
457
|
+
return false;
|
|
458
|
+
}
|
|
459
|
+
const { checkVisibility } = element;
|
|
460
|
+
if (typeof checkVisibility === 'function' && !checkVisibility.call(element, { visibilityProperty: true })) {
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
return true;
|
|
464
|
+
};
|
|
465
|
+
const getComposedChildren = (node) => {
|
|
466
|
+
if (node instanceof Element && node.tagName === 'SLOT') {
|
|
467
|
+
const slot = node;
|
|
468
|
+
const assigned = typeof slot.assignedElements === 'function' ? slot.assignedElements({ flatten: true }) : [];
|
|
469
|
+
// Fall back to the slot's default content when nothing is assigned
|
|
470
|
+
return assigned.length > 0 ? assigned : Array.from(slot.children);
|
|
471
|
+
}
|
|
472
|
+
if (node instanceof Element && node.shadowRoot != null) {
|
|
473
|
+
return Array.from(node.shadowRoot.children);
|
|
474
|
+
}
|
|
475
|
+
return Array.from(node.children);
|
|
476
|
+
};
|
|
477
|
+
/**
|
|
478
|
+
* Collect tabbable elements under `root` in DOM order, following the composed (flattened) tree:
|
|
479
|
+
* open shadow roots are entered and `<slot>` elements are replaced by their assigned elements.
|
|
480
|
+
* Positive `tabindex` ordering is not taken into account.
|
|
481
|
+
*/
|
|
482
|
+
const getTabbableElements = (root) => {
|
|
483
|
+
const result = [];
|
|
484
|
+
const walk = (node) => {
|
|
485
|
+
for (const child of getComposedChildren(node)) {
|
|
486
|
+
if (isTabbable(child)) {
|
|
487
|
+
result.push(child);
|
|
488
|
+
}
|
|
489
|
+
walk(child);
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
walk(root);
|
|
493
|
+
return result;
|
|
494
|
+
};
|
|
495
|
+
/**
|
|
496
|
+
* Return the focused element, descending into open shadow roots.
|
|
497
|
+
*/
|
|
498
|
+
const getDeepActiveElement = (doc = document) => {
|
|
499
|
+
var _a, _b;
|
|
500
|
+
let active = (_a = doc.activeElement) !== null && _a !== void 0 ? _a : null;
|
|
501
|
+
while (((_b = active === null || active === void 0 ? void 0 : active.shadowRoot) === null || _b === void 0 ? void 0 : _b.activeElement) != null) {
|
|
502
|
+
active = active.shadowRoot.activeElement;
|
|
503
|
+
}
|
|
504
|
+
return active;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
const stripeModalCss = () => `:root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}:host{box-sizing:border-box}:host *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}:host button{cursor:pointer}:host{display:block}.modal-row{opacity:0;pointer-events:none;will-change:transform;visibility:hidden}.modal-row.open{opacity:1;pointer-events:auto;visibility:visible;position:fixed;top:0;left:0;width:100%;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:1ch;background:rgba(0, 0, 0, 0.3)}.modal-row .modal-child{transform:translateY(100%);transition:transform 420ms ease;position:relative}.modal-row .modal-child .modal-loading{display:none;position:absolute;top:160px;left:50%;transform:translateX(-50%);width:24px;height:24px}.modal-row .modal-child.loading .modal-loading{display:flex;justify-content:center;align-items:center}.modal-row .modal-child.loading .modal-loading svg{width:24px;height:24px}.modal-row .modal-child.loading .modal-content{visibility:hidden}.modal-row.open .modal-child{transform:translateY(0%)}.modal-child{padding:16px 8px 24px;background-color:#fff;width:100%}.modal-close-button-wrap{padding-left:8px}.modal-close-button-wrap .modal-close-button{display:block;width:32px;cursor:pointer;border-radius:4px}.modal-close-button-wrap .modal-close-button:focus-visible{outline:2px solid var(--color-label, #000);outline-offset:2px}.modal-close-button-wrap .modal-close-button ion-icon{width:32px;display:block;fill:var(--color-label)}.modal-child:focus{outline:none}.focus-guard{position:absolute;width:1px;height:1px;overflow:hidden}`;
|
|
508
|
+
|
|
509
|
+
const StripeModal = class {
|
|
510
|
+
constructor(hostRef) {
|
|
511
|
+
registerInstance(this, hostRef);
|
|
512
|
+
this.close = createEvent(this, "close", 7);
|
|
513
|
+
/**
|
|
514
|
+
* If true, the modal display close button
|
|
515
|
+
*/
|
|
516
|
+
this.showCloseButton = true;
|
|
517
|
+
/**
|
|
518
|
+
* Modal state.
|
|
519
|
+
* If true, the modal will open
|
|
520
|
+
*/
|
|
521
|
+
this.open = false;
|
|
522
|
+
/**
|
|
523
|
+
* Effect `this.open`. This is for animation.
|
|
524
|
+
* Ionic Ref: https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/accordion/accordion.tsx#L83
|
|
525
|
+
*/
|
|
526
|
+
this.renderedOpen = false;
|
|
527
|
+
/**
|
|
528
|
+
* The element that had focus before the modal opened. Focus returns to it when the modal closes.
|
|
529
|
+
*/
|
|
530
|
+
this.returnFocusElement = null;
|
|
531
|
+
/**
|
|
532
|
+
* Set when the modal opens; the initial focus is moved after the open state has been rendered.
|
|
533
|
+
*/
|
|
534
|
+
this.shouldFocusOnRender = false;
|
|
535
|
+
/**
|
|
536
|
+
* The last element inside the modal that received focus.
|
|
537
|
+
* `FocusEvent.relatedTarget` is `null` when focus crosses an iframe boundary (e.g. leaving a Stripe Elements field),
|
|
538
|
+
* so the guards fall back to this value to tell which way focus is moving.
|
|
539
|
+
*/
|
|
540
|
+
this.lastFocusedInside = null;
|
|
541
|
+
this.handleKeyDown = (event) => {
|
|
542
|
+
if (!this.open || event.key !== 'Escape') {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
// Escape that cancels an IME composition (keyCode 229) or that a slotted widget (e.g. an autocomplete popup) already handled must not close the modal
|
|
546
|
+
if (event.isComposing || event.keyCode === 229 || event.defaultPrevented) {
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
// Prevent an outer modal (or the page) from also reacting to the same key press
|
|
550
|
+
event.preventDefault();
|
|
551
|
+
event.stopPropagation();
|
|
552
|
+
this.closeModal();
|
|
553
|
+
};
|
|
554
|
+
/**
|
|
555
|
+
* Whether focus came from a focusable element inside the modal (not from the container itself or from outside).
|
|
556
|
+
* The guards use it to tell Tab from Shift+Tab: a guard cannot see the key, but it can see where focus came from.
|
|
557
|
+
*/
|
|
558
|
+
this.handleFocusIn = (event) => {
|
|
559
|
+
var _a, _b;
|
|
560
|
+
const target = ((_b = (_a = event.composedPath) === null || _a === void 0 ? void 0 : _a.call(event)[0]) !== null && _b !== void 0 ? _b : event.target);
|
|
561
|
+
if ((target === null || target === void 0 ? void 0 : target.classList) !== undefined && !target.classList.contains('focus-guard')) {
|
|
562
|
+
this.lastFocusedInside = target;
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
this.handleStartGuardFocus = (event) => {
|
|
566
|
+
// Shift+Tab from the first element wraps to the last; Tab from the container (or from outside) enters at the first
|
|
567
|
+
this.cameFromFocusableInside(event) ? this.focusLastElement() : this.focusFirstElement();
|
|
568
|
+
};
|
|
569
|
+
this.handleEndGuardFocus = (event) => {
|
|
570
|
+
// Tab from the last element wraps to the first; Shift+Tab from outside enters at the last
|
|
571
|
+
this.isInsideModal(this.getFocusOrigin(event)) ? this.focusFirstElement() : this.focusLastElement();
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
onOpenChange(open) {
|
|
575
|
+
if (open) {
|
|
576
|
+
this.rememberFocus();
|
|
577
|
+
this.openModalAnimation();
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
this.renderedOpen = false;
|
|
581
|
+
this.shouldFocusOnRender = false;
|
|
582
|
+
this.lastFocusedInside = null;
|
|
583
|
+
this.close.emit();
|
|
584
|
+
this.restoreFocus();
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Toggle modal state
|
|
589
|
+
*/
|
|
590
|
+
async toggleModal() {
|
|
591
|
+
this.open ? await this.closeModal() : await this.openModal();
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Open the modal
|
|
595
|
+
*/
|
|
596
|
+
async openModal() {
|
|
597
|
+
this.open = true;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Close the modal
|
|
601
|
+
*/
|
|
602
|
+
async closeModal() {
|
|
603
|
+
this.open = false;
|
|
604
|
+
}
|
|
605
|
+
componentDidLoad() {
|
|
606
|
+
const platformName = checkPlatform();
|
|
607
|
+
if (platformName) {
|
|
608
|
+
this.el.classList.add(platformName);
|
|
609
|
+
}
|
|
610
|
+
if (this.open) {
|
|
611
|
+
this.rememberFocus();
|
|
612
|
+
this.openModalAnimation();
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
componentDidRender() {
|
|
616
|
+
if (this.shouldFocusOnRender && this.renderedOpen) {
|
|
617
|
+
this.shouldFocusOnRender = false;
|
|
618
|
+
this.focusFirstElement();
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
rememberFocus() {
|
|
622
|
+
var _a;
|
|
623
|
+
if (typeof document === 'undefined') {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
const active = getDeepActiveElement(document);
|
|
627
|
+
// Ignore focus that is already inside the modal and the default document focus
|
|
628
|
+
if (active === null || active === document.body || this.el.contains(active) || ((_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(active)) === true) {
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
this.returnFocusElement = active;
|
|
632
|
+
}
|
|
633
|
+
restoreFocus() {
|
|
634
|
+
const target = this.returnFocusElement;
|
|
635
|
+
this.returnFocusElement = null;
|
|
636
|
+
if (target != null && target.isConnected && typeof target.focus === 'function') {
|
|
637
|
+
target.focus();
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
getTabbableElements() {
|
|
641
|
+
if (this.dialogElement === undefined) {
|
|
642
|
+
return [];
|
|
643
|
+
}
|
|
644
|
+
return getTabbableElements(this.dialogElement).filter(element => !element.classList.contains('focus-guard'));
|
|
645
|
+
}
|
|
646
|
+
isInsideModal(node) {
|
|
647
|
+
var _a;
|
|
648
|
+
return node !== null && (this.el.contains(node) || ((_a = this.dialogElement) === null || _a === void 0 ? void 0 : _a.contains(node)) === true);
|
|
649
|
+
}
|
|
650
|
+
getFocusOrigin(event) {
|
|
651
|
+
var _a;
|
|
652
|
+
return (_a = event.relatedTarget) !== null && _a !== void 0 ? _a : this.lastFocusedInside;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Whether focus came from a focusable element inside the modal (not from the container itself or from outside).
|
|
656
|
+
* The guards use it to tell Tab from Shift+Tab: a guard cannot see the key, but it can see where focus came from.
|
|
657
|
+
*/
|
|
658
|
+
cameFromFocusableInside(event) {
|
|
659
|
+
const from = this.getFocusOrigin(event);
|
|
660
|
+
return from !== this.dialogElement && this.isInsideModal(from);
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Slotted content is hidden (and therefore not focusable) while the open transition runs.
|
|
664
|
+
* When it ends, move focus from the placeholder (container / close button) into the content, unless the user already moved it.
|
|
665
|
+
*/
|
|
666
|
+
focusContentAfterLoading() {
|
|
667
|
+
var _a;
|
|
668
|
+
if (!this.open || this.contentElement === undefined) {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
const active = getDeepActiveElement(document);
|
|
672
|
+
const focusIsIdle = active === null || active === document.body || active === this.dialogElement || active === this.closeButtonElement;
|
|
673
|
+
if (!focusIsIdle) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
(_a = getTabbableElements(this.contentElement)[0]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
677
|
+
}
|
|
678
|
+
focusFirstElement() {
|
|
679
|
+
var _a;
|
|
680
|
+
const [first] = this.getTabbableElements();
|
|
681
|
+
(_a = (first !== null && first !== void 0 ? first : this.dialogElement)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
682
|
+
}
|
|
683
|
+
focusLastElement() {
|
|
684
|
+
var _a, _b;
|
|
685
|
+
const elements = this.getTabbableElements();
|
|
686
|
+
(_b = ((_a = elements[elements.length - 1]) !== null && _a !== void 0 ? _a : this.dialogElement)) === null || _b === void 0 ? void 0 : _b.focus();
|
|
687
|
+
}
|
|
688
|
+
openModalAnimation() {
|
|
689
|
+
this.shouldFocusOnRender = true;
|
|
690
|
+
if (!this.el.shadowRoot) {
|
|
691
|
+
this.renderedOpen = true;
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
const modalChild = this.el.shadowRoot.querySelector('.modal-child');
|
|
695
|
+
modalChild.classList.add('loading');
|
|
696
|
+
modalChild.style.willChange = 'transform';
|
|
697
|
+
modalChild.addEventListener('transitionend', () => {
|
|
698
|
+
modalChild.style.willChange = 'auto';
|
|
699
|
+
modalChild.classList.remove('loading');
|
|
700
|
+
this.focusContentAfterLoading();
|
|
701
|
+
}, { once: true });
|
|
702
|
+
requestAnimationFrame(() => {
|
|
703
|
+
this.renderedOpen = this.open;
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
render() {
|
|
707
|
+
const { renderedOpen, showCloseButton } = this;
|
|
708
|
+
const guardTabIndex = renderedOpen ? 0 : -1;
|
|
709
|
+
return (h(Host, { key: '684539aa83388bec518e73bbd8aa19e73cfde07d', role: renderedOpen ? 'dialog' : undefined, "aria-modal": renderedOpen ? 'true' : undefined, onKeyDown: this.handleKeyDown, onFocusin: this.handleFocusIn }, h("div", { key: 'db6f1088c1ef7e35aefba06faaf3e9c2dcaa3419', class: `modal-row${renderedOpen ? ' open' : ''}`, onClick: () => this.closeModal() }, h("div", { key: '89c783c793261566b77ba962da730a973e8cbd8d', class: "modal-child", tabindex: "-1", ref: el => (this.dialogElement = el), onClick: e => e.stopPropagation() }, h("div", { key: '0e329b32c25509134f5a25adb266b03dd0bd71d8', class: "focus-guard", tabindex: guardTabIndex, onFocus: this.handleStartGuardFocus }), showCloseButton ? (h("div", { class: "modal-close-button-wrap" }, h("button", { type: "button", class: "modal-close-button", "aria-label": i18n.t('Close'), ref: el => (this.closeButtonElement = el), onClick: () => this.closeModal() }, h("ion-icon", { name: "close", size: "large", "aria-hidden": "true" })))) : null, h("div", { key: 'f2b5dcbc72ba3178dd920ceecd4fd339f69598d7', class: "modal-loading" }, h("svg", { key: '1f7afb6cc48be8fc84f9b69678f2c8ca1e2b145e', version: "1.1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 2400 2400" }, h("g", { key: 'ed40edfeabe02bf198b194eb04777e1f4a6b203e', "stroke-width": "200", "stroke-linecap": "round", stroke: "currentColor", fill: "none", id: "spinner" }, h("line", { key: '03c9170ee9e566227fddcc9037a92c48ed954b89', x1: "1200", y1: "600", x2: "1200", y2: "100" }), h("line", { key: '302aec0abf20ee8afe66245ecbc9d5e2adbade82', opacity: "0.5", x1: "1200", y1: "2300", x2: "1200", y2: "1800" }), h("line", { key: 'd3bea8de4d689a5c5c423a72dd23a0fbc64c29dd', opacity: "0.917", x1: "900", y1: "680.4", x2: "650", y2: "247.4" }), h("line", { key: '543e33091e87bf85c3a0e4d4881babdffbe4b825', opacity: "0.417", x1: "1750", y1: "2152.6", x2: "1500", y2: "1719.6" }), h("line", { key: '5c2e0a3722955a8ee17b57f3061097f18681ba7e', opacity: "0.833", x1: "680.4", y1: "900", x2: "247.4", y2: "650" }), h("line", { key: '1100d48a500bfca6075243cf69be9e6f575bdae6', opacity: "0.333", x1: "2152.6", y1: "1750", x2: "1719.6", y2: "1500" }), h("line", { key: '6c3f7c309a5ed15c6ffce11925efe09dbc8e6f3b', opacity: "0.75", x1: "600", y1: "1200", x2: "100", y2: "1200" }), h("line", { key: '7708c31b141f3a151e8dc78c89b20442f34ce1e2', opacity: "0.25", x1: "2300", y1: "1200", x2: "1800", y2: "1200" }), h("line", { key: 'd419fc4006e8063f9bbc35b4cb2a9a88010c623a', opacity: "0.667", x1: "680.4", y1: "1500", x2: "247.4", y2: "1750" }), h("line", { key: '78ccaf11a6e7c3183d210b787ce9374bd7c4aff4', opacity: "0.167", x1: "2152.6", y1: "650", x2: "1719.6", y2: "900" }), h("line", { key: 'acb1444de9fcd9aa1a3182d759d3b8aeb0906284', opacity: "0.583", x1: "900", y1: "1719.6", x2: "650", y2: "2152.6" }), h("line", { key: '6adef9d6a54f302c8da7c84cae32851723ce25cc', opacity: "0.083", x1: "1750", y1: "247.4", x2: "1500", y2: "680.4" }), h("animateTransform", { key: '7acf982514091f6c3ec9bd4ddfc660f3286ddd4e', attributeName: "transform", attributeType: "XML", type: "rotate", keyTimes: "0;0.08333;0.16667;0.25;0.33333;0.41667;0.5;0.58333;0.66667;0.75;0.83333;0.91667", values: "0 1199 1199;30 1199 1199;60 1199 1199;90 1199 1199;120 1199 1199;150 1199 1199;180 1199 1199;210 1199 1199;240 1199 1199;270 1199 1199;300 1199 1199;330 1199 1199", dur: "0.83333s", begin: "0s", repeatCount: "indefinite", calcMode: "discrete" })))), h("div", { key: '120bebc59c0fc013cb2bfbaf8957ad3731e1ddf4', class: "modal-content", ref: el => (this.contentElement = el) }, h("slot", { key: '0f371823f8fddd61e2b0ce24a59477103d979875' })), h("div", { key: 'fa8436f70871d59055dab2cf0fcfe5d4577328c1', class: "focus-guard", tabindex: guardTabIndex, onFocus: this.handleEndGuardFocus })))));
|
|
710
|
+
}
|
|
711
|
+
get el() { return getElement(this); }
|
|
712
|
+
static get watchers() { return {
|
|
713
|
+
"open": [{
|
|
714
|
+
"onOpenChange": 0
|
|
715
|
+
}]
|
|
716
|
+
}; }
|
|
717
|
+
};
|
|
718
|
+
StripeModal.style = stripeModalCss();
|
|
719
|
+
|
|
720
|
+
export { Icon as ion_icon, StripeModal as stripe_modal };
|