@ionic/core 8.4.4-dev.11738863153.1dafb0b9 → 8.4.4-dev.11739906326.1989484f
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/components/checkbox.js +4 -6
- package/components/content.js +4 -4
- package/components/ion-select.js +4 -6
- package/components/ion-tab-button.js +1 -1
- package/components/ion-tab.js +2 -2
- package/components/ion-tabs.js +1 -2
- package/components/ion-toggle.js +4 -6
- package/components/modal.js +35 -259
- package/components/radio.js +37 -5
- package/css/core.css.map +1 -1
- package/css/ionic.bundle.css.map +1 -1
- package/dist/cjs/ion-app_8.cjs.entry.js +4 -4
- package/dist/cjs/ion-checkbox.cjs.entry.js +4 -5
- package/dist/cjs/ion-modal.cjs.entry.js +35 -258
- package/dist/cjs/ion-radio_2.cjs.entry.js +35 -5
- package/dist/cjs/ion-select_3.cjs.entry.js +4 -5
- package/dist/cjs/ion-tab-bar_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-tab_2.cjs.entry.js +3 -4
- package/dist/cjs/ion-toggle.cjs.entry.js +4 -5
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/checkbox/checkbox.js +4 -23
- package/dist/collection/components/content/content.js +4 -4
- package/dist/collection/components/modal/animations/ios.enter.js +4 -50
- package/dist/collection/components/modal/animations/ios.leave.js +2 -24
- package/dist/collection/components/modal/animations/md.enter.js +5 -52
- package/dist/collection/components/modal/animations/md.leave.js +3 -26
- package/dist/collection/components/modal/animations/sheet.js +2 -11
- package/dist/collection/components/modal/gestures/sheet.js +10 -79
- package/dist/collection/components/modal/modal.ios.css +0 -16
- package/dist/collection/components/modal/modal.js +7 -32
- package/dist/collection/components/modal/modal.md.css +0 -6
- package/dist/collection/components/radio/radio.ios.css +52 -15
- package/dist/collection/components/radio/radio.js +70 -3
- package/dist/collection/components/radio/radio.md.css +52 -15
- package/dist/collection/components/select/select.js +4 -23
- package/dist/collection/components/tab/tab.js +2 -2
- package/dist/collection/components/tab-button/tab-button.js +1 -1
- package/dist/collection/components/tabs/tabs.js +1 -2
- package/dist/collection/components/toggle/toggle.js +4 -23
- package/dist/docs.json +73 -89
- package/dist/esm/ion-app_8.entry.js +4 -4
- package/dist/esm/ion-checkbox.entry.js +4 -5
- package/dist/esm/ion-modal.entry.js +35 -258
- package/dist/esm/ion-radio_2.entry.js +35 -5
- package/dist/esm/ion-select_3.entry.js +4 -5
- package/dist/esm/ion-tab-bar_2.entry.js +1 -1
- package/dist/esm/ion-tab_2.entry.js +3 -4
- package/dist/esm/ion-toggle.entry.js +4 -5
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/ion-app_8.entry.js +1 -1
- package/dist/esm-es5/ion-checkbox.entry.js +1 -1
- package/dist/esm-es5/ion-modal.entry.js +1 -1
- package/dist/esm-es5/ion-radio_2.entry.js +1 -1
- package/dist/esm-es5/ion-select_3.entry.js +1 -1
- package/dist/esm-es5/ion-tab-bar_2.entry.js +1 -1
- package/dist/esm-es5/ion-tab_2.entry.js +1 -1
- package/dist/esm-es5/ion-toggle.entry.js +1 -1
- package/dist/esm-es5/ionic.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/html.html-data.json +8 -16
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-1a11f49f.entry.js +4 -0
- package/dist/ionic/p-1b1af767.system.entry.js +4 -0
- package/dist/ionic/p-2172893e.system.entry.js +4 -0
- package/dist/ionic/p-322c5fb4.system.js +1 -1
- package/dist/ionic/p-4ec778aa.entry.js +4 -0
- package/dist/ionic/p-5ab1b709.entry.js +4 -0
- package/dist/ionic/{p-8ac07653.system.entry.js → p-69666e8a.system.entry.js} +2 -2
- package/dist/ionic/{p-1199e388.system.entry.js → p-797eeea8.system.entry.js} +1 -1
- package/dist/ionic/p-908d6080.entry.js +4 -0
- package/dist/ionic/p-92a0f863.entry.js +4 -0
- package/dist/ionic/p-98ff6b32.entry.js +4 -0
- package/dist/ionic/p-a0eb506c.system.entry.js +4 -0
- package/dist/ionic/p-bc64bd27.system.entry.js +4 -0
- package/dist/ionic/p-e06057c9.entry.js +4 -0
- package/dist/ionic/{p-bdf2cb2e.system.entry.js → p-ebf042e0.system.entry.js} +1 -1
- package/dist/ionic/p-f55baa37.entry.js +4 -0
- package/dist/ionic/{p-9f364443.system.entry.js → p-fd1c40cc.system.entry.js} +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +0 -6
- package/dist/types/components/modal/animations/sheet.d.ts +0 -1
- package/dist/types/components/modal/gestures/sheet.d.ts +1 -1
- package/dist/types/components/modal/modal-interface.d.ts +0 -1
- package/dist/types/components/modal/modal.d.ts +0 -11
- package/dist/types/components/radio/radio.d.ts +19 -0
- package/dist/types/components/select/select.d.ts +0 -6
- package/dist/types/components/toggle/toggle.d.ts +0 -6
- package/dist/types/components.d.ts +16 -32
- package/hydrate/index.js +95 -291
- package/hydrate/index.mjs +95 -291
- package/package.json +1 -1
- package/dist/ionic/p-0430c2e0.entry.js +0 -4
- package/dist/ionic/p-126be614.system.entry.js +0 -4
- package/dist/ionic/p-6c95736e.entry.js +0 -4
- package/dist/ionic/p-6d6cedc5.entry.js +0 -4
- package/dist/ionic/p-722ec9c7.entry.js +0 -4
- package/dist/ionic/p-783411f1.entry.js +0 -4
- package/dist/ionic/p-7ddc46c3.system.entry.js +0 -4
- package/dist/ionic/p-98e41e4f.system.entry.js +0 -4
- package/dist/ionic/p-d57a57d6.entry.js +0 -4
- package/dist/ionic/p-d7dd8fb1.entry.js +0 -4
- package/dist/ionic/p-e3171ff3.entry.js +0 -4
- package/dist/ionic/p-e6376b93.system.entry.js +0 -4
|
@@ -7,7 +7,7 @@ import { clamp, raf, getElementRoot } from "../../../utils/helpers";
|
|
|
7
7
|
import { FOCUS_TRAP_DISABLE_CLASS } from "../../../utils/overlays";
|
|
8
8
|
import { getBackdropValueForSheet } from "../utils";
|
|
9
9
|
import { calculateSpringStep, handleCanDismiss } from "./utils";
|
|
10
|
-
export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, animation, breakpoints = [],
|
|
10
|
+
export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, animation, breakpoints = [], getCurrentBreakpoint, onDismiss, onBreakpointChange) => {
|
|
11
11
|
// Defaults for the sheet swipe animation
|
|
12
12
|
const defaultBackdrop = [
|
|
13
13
|
{ offset: 0, opacity: 'var(--backdrop-opacity)' },
|
|
@@ -24,10 +24,6 @@ export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpo
|
|
|
24
24
|
{ offset: 1, transform: 'translateY(100%)' },
|
|
25
25
|
],
|
|
26
26
|
BACKDROP_KEYFRAMES: backdropBreakpoint !== 0 ? customBackdrop : defaultBackdrop,
|
|
27
|
-
CONTENT_KEYFRAMES: [
|
|
28
|
-
{ offset: 0, maxHeight: '100%' },
|
|
29
|
-
{ offset: 1, maxHeight: '0%' },
|
|
30
|
-
],
|
|
31
27
|
};
|
|
32
28
|
const contentEl = baseEl.querySelector('ion-content');
|
|
33
29
|
const height = wrapperEl.clientHeight;
|
|
@@ -35,11 +31,10 @@ export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpo
|
|
|
35
31
|
let offset = 0;
|
|
36
32
|
let canDismissBlocksGesture = false;
|
|
37
33
|
const canDismissMaxStep = 0.95;
|
|
38
|
-
const maxBreakpoint = breakpoints[breakpoints.length - 1];
|
|
39
|
-
const minBreakpoint = breakpoints[0];
|
|
40
34
|
const wrapperAnimation = animation.childAnimations.find((ani) => ani.id === 'wrapperAnimation');
|
|
41
35
|
const backdropAnimation = animation.childAnimations.find((ani) => ani.id === 'backdropAnimation');
|
|
42
|
-
const
|
|
36
|
+
const maxBreakpoint = breakpoints[breakpoints.length - 1];
|
|
37
|
+
const minBreakpoint = breakpoints[0];
|
|
43
38
|
const enableBackdrop = () => {
|
|
44
39
|
baseEl.style.setProperty('pointer-events', 'auto');
|
|
45
40
|
backdropEl.style.setProperty('pointer-events', 'auto');
|
|
@@ -62,31 +57,6 @@ export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpo
|
|
|
62
57
|
*/
|
|
63
58
|
baseEl.classList.add(FOCUS_TRAP_DISABLE_CLASS);
|
|
64
59
|
};
|
|
65
|
-
/**
|
|
66
|
-
* Toggles the visible modal footer when `expandToScroll` is disabled.
|
|
67
|
-
* @param footer The footer to show.
|
|
68
|
-
*/
|
|
69
|
-
const swapFooterVisibility = (footer) => {
|
|
70
|
-
const originalFooter = baseEl.querySelector('ion-footer');
|
|
71
|
-
if (!originalFooter) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const clonedFooter = wrapperEl.nextElementSibling;
|
|
75
|
-
const footerToHide = footer === 'original' ? clonedFooter : originalFooter;
|
|
76
|
-
const footerToShow = footer === 'original' ? originalFooter : clonedFooter;
|
|
77
|
-
footerToShow.style.removeProperty('display');
|
|
78
|
-
footerToShow.removeAttribute('aria-hidden');
|
|
79
|
-
const page = baseEl.querySelector('.ion-page');
|
|
80
|
-
if (footer === 'original') {
|
|
81
|
-
page.style.removeProperty('padding-bottom');
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
const pagePadding = footerToShow.clientHeight;
|
|
85
|
-
page.style.setProperty('padding-bottom', `${pagePadding}px`);
|
|
86
|
-
}
|
|
87
|
-
footerToHide.style.setProperty('display', 'none');
|
|
88
|
-
footerToHide.setAttribute('aria-hidden', 'true');
|
|
89
|
-
};
|
|
90
60
|
/**
|
|
91
61
|
* After the entering animation completes,
|
|
92
62
|
* we need to set the animation to go from
|
|
@@ -98,7 +68,6 @@ export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpo
|
|
|
98
68
|
if (wrapperAnimation && backdropAnimation) {
|
|
99
69
|
wrapperAnimation.keyframes([...SheetDefaults.WRAPPER_KEYFRAMES]);
|
|
100
70
|
backdropAnimation.keyframes([...SheetDefaults.BACKDROP_KEYFRAMES]);
|
|
101
|
-
contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.keyframes([...SheetDefaults.CONTENT_KEYFRAMES]);
|
|
102
71
|
animation.progressStart(true, 1 - currentBreakpoint);
|
|
103
72
|
/**
|
|
104
73
|
* If backdrop is not enabled, then content
|
|
@@ -115,7 +84,7 @@ export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpo
|
|
|
115
84
|
disableBackdrop();
|
|
116
85
|
}
|
|
117
86
|
}
|
|
118
|
-
if (contentEl && currentBreakpoint !== maxBreakpoint
|
|
87
|
+
if (contentEl && currentBreakpoint !== maxBreakpoint) {
|
|
119
88
|
contentEl.scrollY = false;
|
|
120
89
|
}
|
|
121
90
|
const canStart = (detail) => {
|
|
@@ -129,13 +98,6 @@ export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpo
|
|
|
129
98
|
*/
|
|
130
99
|
const contentEl = findClosestIonContent(detail.event.target);
|
|
131
100
|
currentBreakpoint = getCurrentBreakpoint();
|
|
132
|
-
/**
|
|
133
|
-
* If we have expandToScroll disabled, we should not allow the swipe gesture to start
|
|
134
|
-
* if the content is being swiped.
|
|
135
|
-
*/
|
|
136
|
-
if (!expandToScroll && contentEl) {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
101
|
if (currentBreakpoint === 1 && contentEl) {
|
|
140
102
|
/**
|
|
141
103
|
* The modal should never swipe to close on the content with a refresher.
|
|
@@ -166,15 +128,6 @@ export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpo
|
|
|
166
128
|
* Remove undefined check
|
|
167
129
|
*/
|
|
168
130
|
canDismissBlocksGesture = baseEl.canDismiss !== undefined && baseEl.canDismiss !== true && minBreakpoint === 0;
|
|
169
|
-
/**
|
|
170
|
-
* If expandToScroll is disabled, we need to swap
|
|
171
|
-
* the footer visibility to the original, so if the modal
|
|
172
|
-
* is dismissed, the footer dismisses with the modal
|
|
173
|
-
* and doesn't stay on the screen after the modal is gone.
|
|
174
|
-
*/
|
|
175
|
-
if (!expandToScroll) {
|
|
176
|
-
swapFooterVisibility('original');
|
|
177
|
-
}
|
|
178
131
|
/**
|
|
179
132
|
* If we are pulling down, then it is possible we are pulling on the content.
|
|
180
133
|
* We do not want scrolling to happen at the same time as the gesture.
|
|
@@ -290,19 +243,6 @@ export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpo
|
|
|
290
243
|
opacity: `calc(var(--backdrop-opacity) * ${getBackdropValueForSheet(snapToBreakpoint, backdropBreakpoint)})`,
|
|
291
244
|
},
|
|
292
245
|
]);
|
|
293
|
-
if (contentAnimation) {
|
|
294
|
-
/**
|
|
295
|
-
* The modal content should scroll at any breakpoint when expandToScroll
|
|
296
|
-
* is disabled. In order to do this, the content needs to be completely
|
|
297
|
-
* viewable so scrolling can access everything. Otherwise, the default
|
|
298
|
-
* behavior would show the content off the screen and only allow
|
|
299
|
-
* scrolling when the sheet is fully expanded.
|
|
300
|
-
*/
|
|
301
|
-
contentAnimation.keyframes([
|
|
302
|
-
{ offset: 0, maxHeight: `${(1 - breakpointOffset) * 100}%` },
|
|
303
|
-
{ offset: 1, maxHeight: `${snapToBreakpoint * 100}%` },
|
|
304
|
-
]);
|
|
305
|
-
}
|
|
306
246
|
animation.progressStep(0);
|
|
307
247
|
}
|
|
308
248
|
/**
|
|
@@ -310,14 +250,6 @@ export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpo
|
|
|
310
250
|
* snapping animation completes.
|
|
311
251
|
*/
|
|
312
252
|
gesture.enable(false);
|
|
313
|
-
/**
|
|
314
|
-
* If expandToScroll is disabled, we need to swap
|
|
315
|
-
* the footer visibility to the cloned one so the footer
|
|
316
|
-
* doesn't flicker when the sheet's height is animated.
|
|
317
|
-
*/
|
|
318
|
-
if (!expandToScroll && shouldRemainOpen) {
|
|
319
|
-
swapFooterVisibility('cloned');
|
|
320
|
-
}
|
|
321
253
|
if (shouldPreventDismiss) {
|
|
322
254
|
handleCanDismiss(baseEl, animation);
|
|
323
255
|
}
|
|
@@ -325,13 +257,13 @@ export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpo
|
|
|
325
257
|
onDismiss();
|
|
326
258
|
}
|
|
327
259
|
/**
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
* released, so we align with that
|
|
260
|
+
* If the sheet is going to be fully expanded then we should enable
|
|
261
|
+
* scrolling immediately. The sheet modal animation takes ~500ms to finish
|
|
262
|
+
* so if we wait until then there is a visible delay for when scrolling is
|
|
263
|
+
* re-enabled. Native iOS allows for scrolling on the sheet modal as soon
|
|
264
|
+
* as the gesture is released, so we align with that.
|
|
333
265
|
*/
|
|
334
|
-
if (contentEl &&
|
|
266
|
+
if (contentEl && snapToBreakpoint === breakpoints[breakpoints.length - 1]) {
|
|
335
267
|
contentEl.scrollY = true;
|
|
336
268
|
}
|
|
337
269
|
return new Promise((resolve) => {
|
|
@@ -349,7 +281,6 @@ export const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpo
|
|
|
349
281
|
raf(() => {
|
|
350
282
|
wrapperAnimation.keyframes([...SheetDefaults.WRAPPER_KEYFRAMES]);
|
|
351
283
|
backdropAnimation.keyframes([...SheetDefaults.BACKDROP_KEYFRAMES]);
|
|
352
|
-
contentAnimation === null || contentAnimation === void 0 ? void 0 : contentAnimation.keyframes([...SheetDefaults.CONTENT_KEYFRAMES]);
|
|
353
284
|
animation.progressStart(true, 1 - snapToBreakpoint);
|
|
354
285
|
currentBreakpoint = snapToBreakpoint;
|
|
355
286
|
onBreakpointChange(currentBreakpoint);
|
|
@@ -201,12 +201,6 @@ ion-backdrop {
|
|
|
201
201
|
bottom: 0;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
:host(.modal-sheet.modal-no-expand-scroll) ion-footer {
|
|
205
|
-
position: absolute;
|
|
206
|
-
bottom: 0;
|
|
207
|
-
width: var(--width);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
204
|
/**
|
|
211
205
|
* Convert a font size to a dynamic font size.
|
|
212
206
|
* Fonts that participate in Dynamic Type should use
|
|
@@ -331,14 +325,4 @@ ion-backdrop {
|
|
|
331
325
|
border-start-end-radius: var(--border-radius);
|
|
332
326
|
border-end-end-radius: 0;
|
|
333
327
|
border-end-start-radius: 0;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Sheet modals require an additional padding as mentioned in the
|
|
338
|
-
* `core.scss` file. However, there's a workaround that requires
|
|
339
|
-
* a cloned footer to be added to the modal. This is only necessary
|
|
340
|
-
* because the core styles are not being applied to the cloned footer.
|
|
341
|
-
*/
|
|
342
|
-
:host(.modal-sheet.modal-no-expand-scroll) ion-footer ion-toolbar:first-of-type {
|
|
343
|
-
padding-top: 6px;
|
|
344
328
|
}
|
|
@@ -86,7 +86,6 @@ export class Modal {
|
|
|
86
86
|
this.enterAnimation = undefined;
|
|
87
87
|
this.leaveAnimation = undefined;
|
|
88
88
|
this.breakpoints = undefined;
|
|
89
|
-
this.expandToScroll = true;
|
|
90
89
|
this.initialBreakpoint = undefined;
|
|
91
90
|
this.backdropBreakpoint = 0;
|
|
92
91
|
this.handle = undefined;
|
|
@@ -302,7 +301,6 @@ export class Modal {
|
|
|
302
301
|
presentingEl: presentingElement,
|
|
303
302
|
currentBreakpoint: this.initialBreakpoint,
|
|
304
303
|
backdropBreakpoint: this.backdropBreakpoint,
|
|
305
|
-
expandToScroll: this.expandToScroll,
|
|
306
304
|
});
|
|
307
305
|
/* tslint:disable-next-line */
|
|
308
306
|
if (typeof window !== 'undefined') {
|
|
@@ -353,10 +351,7 @@ export class Modal {
|
|
|
353
351
|
// should be in the DOM and referenced by now, except
|
|
354
352
|
// for the presenting el
|
|
355
353
|
const animationBuilder = this.leaveAnimation || config.get('modalLeave', iosLeaveAnimation);
|
|
356
|
-
const ani = (this.animation = animationBuilder(el, {
|
|
357
|
-
presentingEl: this.presentingElement,
|
|
358
|
-
expandToScroll: this.expandToScroll,
|
|
359
|
-
}));
|
|
354
|
+
const ani = (this.animation = animationBuilder(el, { presentingEl: this.presentingElement }));
|
|
360
355
|
const contentEl = findIonContent(el);
|
|
361
356
|
if (!contentEl) {
|
|
362
357
|
printIonContentErrorMsg(el);
|
|
@@ -401,10 +396,9 @@ export class Modal {
|
|
|
401
396
|
presentingEl: this.presentingElement,
|
|
402
397
|
currentBreakpoint: initialBreakpoint,
|
|
403
398
|
backdropBreakpoint,
|
|
404
|
-
expandToScroll: this.expandToScroll,
|
|
405
399
|
}));
|
|
406
400
|
ani.progressStart(true, 1);
|
|
407
|
-
const { gesture, moveSheetToBreakpoint } = createSheetGesture(this.el, this.backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, ani, this.sortedBreakpoints,
|
|
401
|
+
const { gesture, moveSheetToBreakpoint } = createSheetGesture(this.el, this.backdropEl, wrapperEl, initialBreakpoint, backdropBreakpoint, ani, this.sortedBreakpoints, () => { var _a; return (_a = this.currentBreakpoint) !== null && _a !== void 0 ? _a : 0; }, () => this.sheetOnDismiss(), (breakpoint) => {
|
|
408
402
|
if (this.currentBreakpoint !== breakpoint) {
|
|
409
403
|
this.currentBreakpoint = breakpoint;
|
|
410
404
|
this.ionBreakpointDidChange.emit({ breakpoint });
|
|
@@ -482,7 +476,6 @@ export class Modal {
|
|
|
482
476
|
presentingEl: presentingElement,
|
|
483
477
|
currentBreakpoint: (_a = this.currentBreakpoint) !== null && _a !== void 0 ? _a : this.initialBreakpoint,
|
|
484
478
|
backdropBreakpoint: this.backdropBreakpoint,
|
|
485
|
-
expandToScroll: this.expandToScroll,
|
|
486
479
|
});
|
|
487
480
|
if (dismissed) {
|
|
488
481
|
const { delegate } = this.getDelegate();
|
|
@@ -568,23 +561,23 @@ export class Modal {
|
|
|
568
561
|
return true;
|
|
569
562
|
}
|
|
570
563
|
render() {
|
|
571
|
-
const { handle, isSheetModal, presentingElement, htmlAttributes, handleBehavior, inheritedAttributes, focusTrap
|
|
564
|
+
const { handle, isSheetModal, presentingElement, htmlAttributes, handleBehavior, inheritedAttributes, focusTrap } = this;
|
|
572
565
|
const showHandle = handle !== false && isSheetModal;
|
|
573
566
|
const mode = getIonMode(this);
|
|
574
567
|
const isCardModal = presentingElement !== undefined && mode === 'ios';
|
|
575
568
|
const isHandleCycle = handleBehavior === 'cycle';
|
|
576
|
-
return (h(Host, Object.assign({ key: '
|
|
569
|
+
return (h(Host, Object.assign({ key: 'b4da5111fe4719fa450c39b2d4bd884a302a7924', "no-router": true, tabindex: "-1" }, htmlAttributes, { style: {
|
|
577
570
|
zIndex: `${20000 + this.overlayIndex}`,
|
|
578
|
-
}, class: Object.assign({ [mode]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal,
|
|
571
|
+
}, class: Object.assign({ [mode]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, 'overlay-hidden': true, [FOCUS_TRAP_DISABLE_CLASS]: focusTrap === false }, getClassMap(this.cssClass)), onIonBackdropTap: this.onBackdropTap, onIonModalDidPresent: this.onLifecycle, onIonModalWillPresent: this.onLifecycle, onIonModalWillDismiss: this.onLifecycle, onIonModalDidDismiss: this.onLifecycle }), h("ion-backdrop", { key: 'c12dbf747e0eb914eaf1331798548ffc7e147763', ref: (el) => (this.backdropEl = el), visible: this.showBackdrop, tappable: this.backdropDismiss, part: "backdrop" }), mode === 'ios' && h("div", { key: 'da546ee80c6576b5acc66e959fd5009e0b9a8160', class: "modal-shadow" }), h("div", Object.assign({ key: '306ebe6427440ad5f7ed36d590e562d15a503b75',
|
|
579
572
|
/*
|
|
580
573
|
role and aria-modal must be used on the
|
|
581
574
|
same element. They must also be set inside the
|
|
582
575
|
shadow DOM otherwise ion-button will not be highlighted
|
|
583
576
|
when using VoiceOver: https://bugs.webkit.org/show_bug.cgi?id=247134
|
|
584
577
|
*/
|
|
585
|
-
role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (h("button", { key: '
|
|
578
|
+
role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (h("button", { key: 'c5d17e346fe255a7c0cacbbf15c0083f2d09c488', class: "modal-handle",
|
|
586
579
|
// Prevents the handle from receiving keyboard focus when it does not cycle
|
|
587
|
-
tabIndex: !isHandleCycle ? -1 : 0, "aria-label": "Activate to adjust the size of the dialog overlaying the screen", onClick: isHandleCycle ? this.onHandleClick : undefined, part: "handle" })), h("slot", { key: '
|
|
580
|
+
tabIndex: !isHandleCycle ? -1 : 0, "aria-label": "Activate to adjust the size of the dialog overlaying the screen", onClick: isHandleCycle ? this.onHandleClick : undefined, part: "handle" })), h("slot", { key: '5cc714170a00b67f3eda0cd1d6f37c1489a99c83' }))));
|
|
588
581
|
}
|
|
589
582
|
static get is() { return "ion-modal"; }
|
|
590
583
|
static get encapsulation() { return "shadow"; }
|
|
@@ -742,24 +735,6 @@ export class Modal {
|
|
|
742
735
|
"text": "The breakpoints to use when creating a sheet modal. Each value in the\narray must be a decimal between 0 and 1 where 0 indicates the modal is fully\nclosed and 1 indicates the modal is fully open. Values are relative\nto the height of the modal, not the height of the screen. One of the values in this\narray must be the value of the `initialBreakpoint` property.\nFor example: [0, .25, .5, 1]"
|
|
743
736
|
}
|
|
744
737
|
},
|
|
745
|
-
"expandToScroll": {
|
|
746
|
-
"type": "boolean",
|
|
747
|
-
"mutable": false,
|
|
748
|
-
"complexType": {
|
|
749
|
-
"original": "boolean",
|
|
750
|
-
"resolved": "boolean",
|
|
751
|
-
"references": {}
|
|
752
|
-
},
|
|
753
|
-
"required": false,
|
|
754
|
-
"optional": false,
|
|
755
|
-
"docs": {
|
|
756
|
-
"tags": [],
|
|
757
|
-
"text": "Controls whether scrolling or dragging within the sheet modal expands\nit to a larger breakpoint. This only takes effect when `breakpoints`\nand `initialBreakpoint` are set.\n\nIf `true`, scrolling or dragging anywhere in the modal will first expand\nit to the next breakpoint. Once fully expanded, scrolling will affect the content.\nIf `false`, scrolling will always affect the content, and the modal will only expand\nwhen dragging the header or handle."
|
|
758
|
-
},
|
|
759
|
-
"attribute": "expand-to-scroll",
|
|
760
|
-
"reflect": false,
|
|
761
|
-
"defaultValue": "true"
|
|
762
|
-
},
|
|
763
738
|
"initialBreakpoint": {
|
|
764
739
|
"type": "number",
|
|
765
740
|
"mutable": false,
|
|
@@ -201,12 +201,6 @@ ion-backdrop {
|
|
|
201
201
|
bottom: 0;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
:host(.modal-sheet.modal-no-expand-scroll) ion-footer {
|
|
205
|
-
position: absolute;
|
|
206
|
-
bottom: 0;
|
|
207
|
-
width: var(--width);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
204
|
/**
|
|
211
205
|
* Convert a font size to a dynamic font size.
|
|
212
206
|
* Fonts that participate in Dynamic Type should use
|
|
@@ -175,32 +175,39 @@ input {
|
|
|
175
175
|
align-items: center;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
.radio-bottom {
|
|
179
|
+
padding-top: 4px;
|
|
180
|
+
display: flex;
|
|
179
181
|
justify-content: space-between;
|
|
182
|
+
font-size: 0.75rem;
|
|
183
|
+
white-space: normal;
|
|
180
184
|
}
|
|
181
185
|
|
|
182
|
-
:host(.radio-
|
|
183
|
-
|
|
186
|
+
:host(.radio-label-placement-stacked) .radio-bottom {
|
|
187
|
+
font-size: 1rem;
|
|
184
188
|
}
|
|
185
189
|
|
|
186
|
-
|
|
187
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Error text should only be shown when .ion-invalid is
|
|
192
|
+
* present on the checkbox. Otherwise the helper text should
|
|
193
|
+
* be shown.
|
|
194
|
+
*/
|
|
195
|
+
.radio-bottom .error-text {
|
|
196
|
+
display: none;
|
|
197
|
+
color: var(--ion-color-danger, #c5000f);
|
|
188
198
|
}
|
|
189
199
|
|
|
190
|
-
|
|
191
|
-
|
|
200
|
+
.radio-bottom .helper-text {
|
|
201
|
+
display: block;
|
|
202
|
+
color: var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d));
|
|
192
203
|
}
|
|
193
204
|
|
|
194
|
-
:host(.
|
|
195
|
-
|
|
205
|
+
:host(.ion-touched.ion-invalid) .radio-bottom .error-text {
|
|
206
|
+
display: block;
|
|
196
207
|
}
|
|
197
208
|
|
|
198
|
-
:host(.radio-
|
|
199
|
-
:
|
|
200
|
-
:host(.radio-justify-end),
|
|
201
|
-
:host(.radio-alignment-start),
|
|
202
|
-
:host(.radio-alignment-center) {
|
|
203
|
-
display: block;
|
|
209
|
+
:host(.ion-touched.ion-invalid) .radio-bottom .helper-text {
|
|
210
|
+
display: none;
|
|
204
211
|
}
|
|
205
212
|
|
|
206
213
|
/**
|
|
@@ -229,6 +236,7 @@ input {
|
|
|
229
236
|
*/
|
|
230
237
|
:host(.radio-label-placement-end) .radio-wrapper {
|
|
231
238
|
flex-direction: row-reverse;
|
|
239
|
+
justify-content: start;
|
|
232
240
|
}
|
|
233
241
|
|
|
234
242
|
/**
|
|
@@ -270,6 +278,7 @@ input {
|
|
|
270
278
|
*/
|
|
271
279
|
:host(.radio-label-placement-stacked) .radio-wrapper {
|
|
272
280
|
flex-direction: column;
|
|
281
|
+
text-align: center;
|
|
273
282
|
}
|
|
274
283
|
|
|
275
284
|
:host(.radio-label-placement-stacked) .label-text-wrapper {
|
|
@@ -315,6 +324,34 @@ input {
|
|
|
315
324
|
}
|
|
316
325
|
}
|
|
317
326
|
|
|
327
|
+
:host(.radio-justify-space-between) .radio-wrapper {
|
|
328
|
+
justify-content: space-between;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
:host(.radio-justify-start) .radio-wrapper {
|
|
332
|
+
justify-content: start;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
:host(.radio-justify-end) .radio-wrapper {
|
|
336
|
+
justify-content: end;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
:host(.radio-alignment-start) .radio-wrapper {
|
|
340
|
+
align-items: start;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
:host(.radio-alignment-center) .radio-wrapper {
|
|
344
|
+
align-items: center;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
:host(.radio-justify-space-between),
|
|
348
|
+
:host(.radio-justify-start),
|
|
349
|
+
:host(.radio-justify-end),
|
|
350
|
+
:host(.radio-alignment-start),
|
|
351
|
+
:host(.radio-alignment-center) {
|
|
352
|
+
display: block;
|
|
353
|
+
}
|
|
354
|
+
|
|
318
355
|
/**
|
|
319
356
|
* Convert a font size to a dynamic font size.
|
|
320
357
|
* Fonts that participate in Dynamic Type should use
|
|
@@ -14,10 +14,15 @@ import { getIonMode } from "../../global/ionic-global";
|
|
|
14
14
|
* @part container - The container for the radio mark.
|
|
15
15
|
* @part label - The label text describing the radio.
|
|
16
16
|
* @part mark - The checkmark or dot used to indicate the checked state.
|
|
17
|
+
* @part supporting-text - Supporting text displayed beneath the radio label.
|
|
18
|
+
* @part helper-text - Supporting text displayed beneath the radio label when the radio is valid.
|
|
19
|
+
* @part error-text - Supporting text displayed beneath the radio label when the radio is invalid and touched.
|
|
17
20
|
*/
|
|
18
21
|
export class Radio {
|
|
19
22
|
constructor() {
|
|
20
23
|
this.inputId = `ion-rb-${radioButtonIds++}`;
|
|
24
|
+
this.helperTextId = `${this.inputId}-helper-text`;
|
|
25
|
+
this.errorTextId = `${this.inputId}-error-text`;
|
|
21
26
|
this.radioGroup = null;
|
|
22
27
|
this.updateState = () => {
|
|
23
28
|
if (this.radioGroup) {
|
|
@@ -57,6 +62,8 @@ export class Radio {
|
|
|
57
62
|
this.color = undefined;
|
|
58
63
|
this.name = this.inputId;
|
|
59
64
|
this.disabled = false;
|
|
65
|
+
this.errorText = undefined;
|
|
66
|
+
this.helperText = undefined;
|
|
60
67
|
this.value = undefined;
|
|
61
68
|
this.labelPlacement = 'start';
|
|
62
69
|
this.justify = undefined;
|
|
@@ -116,11 +123,37 @@ export class Radio {
|
|
|
116
123
|
renderRadioControl() {
|
|
117
124
|
return (h("div", { class: "radio-icon", part: "container" }, h("div", { class: "radio-inner", part: "mark" }), h("div", { class: "radio-ripple" })));
|
|
118
125
|
}
|
|
126
|
+
getHintTextID() {
|
|
127
|
+
const { el, helperText, errorText, helperTextId, errorTextId } = this;
|
|
128
|
+
if (el.classList.contains('ion-touched') && el.classList.contains('ion-invalid') && errorText) {
|
|
129
|
+
return errorTextId;
|
|
130
|
+
}
|
|
131
|
+
if (helperText) {
|
|
132
|
+
return helperTextId;
|
|
133
|
+
}
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Responsible for rendering helper text and error text.
|
|
138
|
+
* This element should only be rendered if hint text is set.
|
|
139
|
+
*/
|
|
140
|
+
renderHintText() {
|
|
141
|
+
const { helperText, errorText, helperTextId, errorTextId } = this;
|
|
142
|
+
/**
|
|
143
|
+
* undefined and empty string values should
|
|
144
|
+
* be treated as not having helper/error text.
|
|
145
|
+
*/
|
|
146
|
+
const hasHintText = !!helperText || !!errorText;
|
|
147
|
+
if (!hasHintText) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
return (h("div", { class: "radio-bottom" }, h("div", { id: helperTextId, class: "helper-text", part: "supporting-text helper-text" }, helperText), h("div", { id: errorTextId, class: "error-text", part: "supporting-text error-text" }, errorText)));
|
|
151
|
+
}
|
|
119
152
|
render() {
|
|
120
153
|
const { checked, disabled, color, el, justify, labelPlacement, hasLabel, buttonTabindex, alignment } = this;
|
|
121
154
|
const mode = getIonMode(this);
|
|
122
155
|
const inItem = hostContext('ion-item', el);
|
|
123
|
-
return (h(Host, { key: '
|
|
156
|
+
return (h(Host, { key: '4f01024a74c1846438372c40519df1044f5b12b9', onFocus: this.onFocus, onBlur: this.onBlur, onClick: this.onClick, class: createColorClasses(color, {
|
|
124
157
|
[mode]: true,
|
|
125
158
|
'in-item': inItem,
|
|
126
159
|
'radio-checked': checked,
|
|
@@ -131,10 +164,10 @@ export class Radio {
|
|
|
131
164
|
// Focus and active styling should not apply when the radio is in an item
|
|
132
165
|
'ion-activatable': !inItem,
|
|
133
166
|
'ion-focusable': !inItem,
|
|
134
|
-
}), role: "radio", "aria-checked": checked ? 'true' : 'false', "aria-disabled": disabled ? 'true' : null, tabindex: buttonTabindex }, h("label", { key: '
|
|
167
|
+
}), role: "radio", "aria-checked": checked ? 'true' : 'false', "aria-disabled": disabled ? 'true' : null, "aria-describedby": this.getHintTextID(), "aria-invalid": this.getHintTextID() === this.errorTextId, tabindex: buttonTabindex }, h("label", { key: '59dc0343534e626692f3b71b32204c1b2b25d40a', class: "radio-wrapper" }, h("div", { key: '26d7d3faf1b02bb138fb2c46f83e824962b6b92e', class: {
|
|
135
168
|
'label-text-wrapper': true,
|
|
136
169
|
'label-text-wrapper-hidden': !hasLabel,
|
|
137
|
-
}, part: "label" }, h("slot", { key: '
|
|
170
|
+
}, part: "label" }, h("slot", { key: '9c3d8bb0c5cd3ce94d1e661d89587cf67c522bc0' }), this.renderHintText()), h("div", { key: '3183f79e2977ee001e69c23f73073555744281d8', class: "native-wrapper" }, this.renderRadioControl()))));
|
|
138
171
|
}
|
|
139
172
|
static get is() { return "ion-radio"; }
|
|
140
173
|
static get encapsulation() { return "shadow"; }
|
|
@@ -211,6 +244,40 @@ export class Radio {
|
|
|
211
244
|
"reflect": false,
|
|
212
245
|
"defaultValue": "false"
|
|
213
246
|
},
|
|
247
|
+
"errorText": {
|
|
248
|
+
"type": "string",
|
|
249
|
+
"mutable": false,
|
|
250
|
+
"complexType": {
|
|
251
|
+
"original": "string",
|
|
252
|
+
"resolved": "string | undefined",
|
|
253
|
+
"references": {}
|
|
254
|
+
},
|
|
255
|
+
"required": false,
|
|
256
|
+
"optional": true,
|
|
257
|
+
"docs": {
|
|
258
|
+
"tags": [],
|
|
259
|
+
"text": "Text that is placed under the radio label and displayed when an error is detected."
|
|
260
|
+
},
|
|
261
|
+
"attribute": "error-text",
|
|
262
|
+
"reflect": false
|
|
263
|
+
},
|
|
264
|
+
"helperText": {
|
|
265
|
+
"type": "string",
|
|
266
|
+
"mutable": false,
|
|
267
|
+
"complexType": {
|
|
268
|
+
"original": "string",
|
|
269
|
+
"resolved": "string | undefined",
|
|
270
|
+
"references": {}
|
|
271
|
+
},
|
|
272
|
+
"required": false,
|
|
273
|
+
"optional": true,
|
|
274
|
+
"docs": {
|
|
275
|
+
"tags": [],
|
|
276
|
+
"text": "Text that is placed under the radio label and displayed when no error is detected."
|
|
277
|
+
},
|
|
278
|
+
"attribute": "helper-text",
|
|
279
|
+
"reflect": false
|
|
280
|
+
},
|
|
214
281
|
"value": {
|
|
215
282
|
"type": "any",
|
|
216
283
|
"mutable": false,
|
|
@@ -175,32 +175,39 @@ input {
|
|
|
175
175
|
align-items: center;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
.radio-bottom {
|
|
179
|
+
padding-top: 4px;
|
|
180
|
+
display: flex;
|
|
179
181
|
justify-content: space-between;
|
|
182
|
+
font-size: 0.75rem;
|
|
183
|
+
white-space: normal;
|
|
180
184
|
}
|
|
181
185
|
|
|
182
|
-
:host(.radio-
|
|
183
|
-
|
|
186
|
+
:host(.radio-label-placement-stacked) .radio-bottom {
|
|
187
|
+
font-size: 1rem;
|
|
184
188
|
}
|
|
185
189
|
|
|
186
|
-
|
|
187
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Error text should only be shown when .ion-invalid is
|
|
192
|
+
* present on the checkbox. Otherwise the helper text should
|
|
193
|
+
* be shown.
|
|
194
|
+
*/
|
|
195
|
+
.radio-bottom .error-text {
|
|
196
|
+
display: none;
|
|
197
|
+
color: var(--ion-color-danger, #c5000f);
|
|
188
198
|
}
|
|
189
199
|
|
|
190
|
-
|
|
191
|
-
|
|
200
|
+
.radio-bottom .helper-text {
|
|
201
|
+
display: block;
|
|
202
|
+
color: var(--ion-color-step-700, var(--ion-text-color-step-300, #4d4d4d));
|
|
192
203
|
}
|
|
193
204
|
|
|
194
|
-
:host(.
|
|
195
|
-
|
|
205
|
+
:host(.ion-touched.ion-invalid) .radio-bottom .error-text {
|
|
206
|
+
display: block;
|
|
196
207
|
}
|
|
197
208
|
|
|
198
|
-
:host(.radio-
|
|
199
|
-
:
|
|
200
|
-
:host(.radio-justify-end),
|
|
201
|
-
:host(.radio-alignment-start),
|
|
202
|
-
:host(.radio-alignment-center) {
|
|
203
|
-
display: block;
|
|
209
|
+
:host(.ion-touched.ion-invalid) .radio-bottom .helper-text {
|
|
210
|
+
display: none;
|
|
204
211
|
}
|
|
205
212
|
|
|
206
213
|
/**
|
|
@@ -229,6 +236,7 @@ input {
|
|
|
229
236
|
*/
|
|
230
237
|
:host(.radio-label-placement-end) .radio-wrapper {
|
|
231
238
|
flex-direction: row-reverse;
|
|
239
|
+
justify-content: start;
|
|
232
240
|
}
|
|
233
241
|
|
|
234
242
|
/**
|
|
@@ -270,6 +278,7 @@ input {
|
|
|
270
278
|
*/
|
|
271
279
|
:host(.radio-label-placement-stacked) .radio-wrapper {
|
|
272
280
|
flex-direction: column;
|
|
281
|
+
text-align: center;
|
|
273
282
|
}
|
|
274
283
|
|
|
275
284
|
:host(.radio-label-placement-stacked) .label-text-wrapper {
|
|
@@ -315,6 +324,34 @@ input {
|
|
|
315
324
|
}
|
|
316
325
|
}
|
|
317
326
|
|
|
327
|
+
:host(.radio-justify-space-between) .radio-wrapper {
|
|
328
|
+
justify-content: space-between;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
:host(.radio-justify-start) .radio-wrapper {
|
|
332
|
+
justify-content: start;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
:host(.radio-justify-end) .radio-wrapper {
|
|
336
|
+
justify-content: end;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
:host(.radio-alignment-start) .radio-wrapper {
|
|
340
|
+
align-items: start;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
:host(.radio-alignment-center) .radio-wrapper {
|
|
344
|
+
align-items: center;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
:host(.radio-justify-space-between),
|
|
348
|
+
:host(.radio-justify-start),
|
|
349
|
+
:host(.radio-justify-end),
|
|
350
|
+
:host(.radio-alignment-start),
|
|
351
|
+
:host(.radio-alignment-center) {
|
|
352
|
+
display: block;
|
|
353
|
+
}
|
|
354
|
+
|
|
318
355
|
/**
|
|
319
356
|
* Convert a font size to a dynamic font size.
|
|
320
357
|
* Fonts that participate in Dynamic Type should use
|