@ionic/core 8.7.18-dev.11771365900.125bf49c → 8.7.18-dev.11772217280.122eed89
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/ion-app.js +17 -12
- package/components/ion-checkbox.js +1 -1
- package/components/ion-content.js +1 -1
- package/components/ion-datetime.js +7 -4
- package/components/ion-fab-list.js +10 -3
- package/components/ion-img.js +11 -2
- package/components/ion-label.js +1 -1
- package/components/ion-modal.js +1 -1
- package/components/ion-popover.js +1 -1
- package/components/ion-radio-group.js +1 -1
- package/components/ion-searchbar.js +17 -6
- package/components/ion-select-modal.js +1 -1
- package/components/ion-select-popover.js +1 -1
- package/components/ion-select.js +8 -8
- package/components/{p-CJrGvZ1Z.js → p-51c2oSfC.js} +3 -3
- package/components/{p-BnpDIASH.js → p-BANeLH_G.js} +2 -2
- package/components/{p-D3KEyQ8e.js → p-BRLve2EP.js} +3 -3
- package/components/{p-DRHwNkVo.js → p-C6dkQWq2.js} +152 -30
- package/components/{p-CUfY9DTD.js → p-Cdm3dKWf.js} +8 -3
- package/components/{p-DyFBFrV7.js → p-D--b4514.js} +4 -4
- package/components/{p-DPm73mCi.js → p-DGOrLIyS.js} +7 -3
- package/components/{p-IHgAGzvW.js → p-iyo0Toaz.js} +326 -17
- package/dist/cjs/ion-app_8.cjs.entry.js +22 -13
- package/dist/cjs/ion-checkbox.cjs.entry.js +3 -3
- package/dist/cjs/ion-datetime_3.cjs.entry.js +6 -3
- package/dist/cjs/ion-fab_3.cjs.entry.js +10 -3
- package/dist/cjs/ion-img.cjs.entry.js +11 -2
- package/dist/cjs/ion-item_8.cjs.entry.js +8 -3
- package/dist/cjs/ion-modal.cjs.entry.js +326 -17
- package/dist/cjs/ion-popover.cjs.entry.js +152 -30
- package/dist/cjs/ion-radio_2.cjs.entry.js +2 -2
- package/dist/cjs/ion-searchbar.cjs.entry.js +17 -6
- package/dist/collection/components/app/app.js +15 -10
- package/dist/collection/components/checkbox/checkbox.js +4 -4
- package/dist/collection/components/content/content.js +7 -3
- package/dist/collection/components/datetime/datetime.js +6 -3
- package/dist/collection/components/fab-list/fab-list.js +10 -3
- package/dist/collection/components/img/img.js +11 -2
- package/dist/collection/components/label/label.js +8 -3
- package/dist/collection/components/modal/modal.ios.css +6 -5
- package/dist/collection/components/modal/modal.js +164 -15
- package/dist/collection/components/modal/modal.md.css +6 -5
- package/dist/collection/components/modal/safe-area-utils.js +165 -0
- package/dist/collection/components/popover/animations/ios.enter.js +33 -8
- package/dist/collection/components/popover/animations/md.enter.js +26 -6
- package/dist/collection/components/popover/utils.js +96 -19
- package/dist/collection/components/radio-group/radio-group.ios.css +0 -4
- package/dist/collection/components/radio-group/radio-group.md.css +0 -4
- package/dist/collection/components/searchbar/searchbar.js +17 -6
- package/dist/docs.json +1 -1
- package/dist/esm/ion-app_8.entry.js +24 -15
- package/dist/esm/ion-checkbox.entry.js +4 -4
- package/dist/esm/ion-datetime_3.entry.js +6 -3
- package/dist/esm/ion-fab_3.entry.js +10 -3
- package/dist/esm/ion-img.entry.js +11 -2
- package/dist/esm/ion-item_8.entry.js +8 -3
- package/dist/esm/ion-modal.entry.js +326 -17
- package/dist/esm/ion-popover.entry.js +152 -30
- package/dist/esm/ion-radio_2.entry.js +2 -2
- package/dist/esm/ion-searchbar.entry.js +17 -6
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/{p-72af946b.entry.js → p-2ac254dc.entry.js} +1 -1
- package/dist/ionic/p-7cad388a.entry.js +4 -0
- package/dist/ionic/p-7d218555.entry.js +4 -0
- package/dist/ionic/p-8303e3fc.entry.js +4 -0
- package/dist/ionic/p-915b3e3d.entry.js +4 -0
- package/dist/ionic/{p-eaf3f5ff.entry.js → p-b0ebf9f8.entry.js} +1 -1
- package/dist/ionic/p-e4c57008.entry.js +4 -0
- package/dist/ionic/p-e5d6d0f0.entry.js +4 -0
- package/dist/ionic/p-f1dfee25.entry.js +4 -0
- package/dist/ionic/{p-6444c606.entry.js → p-f9f7b9db.entry.js} +1 -1
- package/dist/types/components/app/app.d.ts +3 -0
- package/dist/types/components/datetime/datetime.d.ts +1 -0
- package/dist/types/components/fab-list/fab-list.d.ts +2 -0
- package/dist/types/components/img/img.d.ts +2 -0
- package/dist/types/components/label/label.d.ts +2 -0
- package/dist/types/components/modal/modal.d.ts +35 -0
- package/dist/types/components/modal/safe-area-utils.d.ts +66 -0
- package/dist/types/components/popover/utils.d.ts +23 -1
- package/dist/types/components/searchbar/searchbar.d.ts +3 -0
- package/hydrate/index.js +556 -73
- package/hydrate/index.mjs +556 -73
- package/package.json +1 -1
- package/dist/ionic/p-01e27965.entry.js +0 -4
- package/dist/ionic/p-3ec563c1.entry.js +0 -4
- package/dist/ionic/p-42db6404.entry.js +0 -4
- package/dist/ionic/p-46d74291.entry.js +0 -4
- package/dist/ionic/p-bc293244.entry.js +0 -4
- package/dist/ionic/p-d1f54e28.entry.js +0 -4
- package/dist/ionic/p-e338f669.entry.js +0 -4
|
@@ -1472,9 +1472,170 @@ const createSheetGesture = (baseEl, backdropEl, wrapperEl, initialBreakpoint, ba
|
|
|
1472
1472
|
};
|
|
1473
1473
|
};
|
|
1474
1474
|
|
|
1475
|
-
|
|
1475
|
+
/**
|
|
1476
|
+
* These thresholds match the SCSS media query breakpoints in modal.vars.scss
|
|
1477
|
+
* that trigger the centered dialog layout (non-fullscreen modal).
|
|
1478
|
+
*
|
|
1479
|
+
* SCSS defines two height breakpoints: $modal-inset-min-height-small (600px)
|
|
1480
|
+
* and $modal-inset-min-height-large (768px). We use the smaller one because
|
|
1481
|
+
* that's the threshold where the modal transitions from fullscreen to centered
|
|
1482
|
+
* dialog — the larger breakpoint only increases the dialog's height.
|
|
1483
|
+
*/
|
|
1484
|
+
const MODAL_INSET_MIN_WIDTH = 768;
|
|
1485
|
+
const MODAL_INSET_MIN_HEIGHT = 600;
|
|
1486
|
+
const EDGE_THRESHOLD = 5;
|
|
1487
|
+
/**
|
|
1488
|
+
* Cache for resolved root safe-area-top value, invalidated once per frame.
|
|
1489
|
+
*/
|
|
1490
|
+
let cachedRootSafeAreaTop = null;
|
|
1491
|
+
let cacheInvalidationScheduled = false;
|
|
1492
|
+
/**
|
|
1493
|
+
* Determines if the current viewport meets the CSS media query conditions
|
|
1494
|
+
* that cause regular modals to render as centered dialogs instead of fullscreen.
|
|
1495
|
+
* Matches: @media (min-width: 768px) and (min-height: 600px)
|
|
1496
|
+
*/
|
|
1497
|
+
const isCenteredDialogViewport = () => {
|
|
1498
|
+
if (!win)
|
|
1499
|
+
return false;
|
|
1500
|
+
return win.matchMedia(`(min-width: ${MODAL_INSET_MIN_WIDTH}px) and (min-height: ${MODAL_INSET_MIN_HEIGHT}px)`)
|
|
1501
|
+
.matches;
|
|
1502
|
+
};
|
|
1503
|
+
/**
|
|
1504
|
+
* Resolves the current root --ion-safe-area-top value to pixels.
|
|
1505
|
+
* Uses a temporary element because getComputedStyle on :root returns
|
|
1506
|
+
* the declared value of custom properties (e.g. "env(safe-area-inset-top)")
|
|
1507
|
+
* rather than a resolved number.
|
|
1508
|
+
*
|
|
1509
|
+
* Results are cached for the current frame to avoid repeated reflows.
|
|
1510
|
+
*/
|
|
1511
|
+
const getRootSafeAreaTop = () => {
|
|
1512
|
+
if (cachedRootSafeAreaTop !== null) {
|
|
1513
|
+
return cachedRootSafeAreaTop;
|
|
1514
|
+
}
|
|
1515
|
+
const doc = win === null || win === void 0 ? void 0 : win.document;
|
|
1516
|
+
if (!(doc === null || doc === void 0 ? void 0 : doc.body)) {
|
|
1517
|
+
return 0;
|
|
1518
|
+
}
|
|
1519
|
+
const el = doc.createElement('div');
|
|
1520
|
+
el.style.cssText =
|
|
1521
|
+
'position:fixed;visibility:hidden;pointer-events:none;top:0;left:0;' + 'padding-top:var(--ion-safe-area-top,0px);';
|
|
1522
|
+
doc.body.appendChild(el);
|
|
1523
|
+
const value = parseFloat(getComputedStyle(el).paddingTop) || 0;
|
|
1524
|
+
el.remove();
|
|
1525
|
+
cachedRootSafeAreaTop = value;
|
|
1526
|
+
if (!cacheInvalidationScheduled) {
|
|
1527
|
+
cacheInvalidationScheduled = true;
|
|
1528
|
+
raf(() => {
|
|
1529
|
+
cachedRootSafeAreaTop = null;
|
|
1530
|
+
cacheInvalidationScheduled = false;
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
return value;
|
|
1534
|
+
};
|
|
1535
|
+
/**
|
|
1536
|
+
* Returns the initial safe-area configuration based on modal type.
|
|
1537
|
+
* This is called before animation starts and uses configuration-based prediction.
|
|
1538
|
+
*
|
|
1539
|
+
* @param context - Modal context information
|
|
1540
|
+
* @returns SafeAreaConfig with initial safe-area values
|
|
1541
|
+
*/
|
|
1542
|
+
const getInitialSafeAreaConfig = (context) => {
|
|
1543
|
+
const { isSheetModal, isCardModal } = context;
|
|
1544
|
+
// Sheet modals always zero top safe-area. The sheet height offset from the
|
|
1545
|
+
// top edge is handled by --ion-modal-offset-top (set in modal.tsx) using
|
|
1546
|
+
// the resolved root value, so --ion-safe-area-top is never needed for
|
|
1547
|
+
// height calculation. Keeping it at 0px prevents header content from
|
|
1548
|
+
// getting double-offset padding.
|
|
1549
|
+
if (isSheetModal) {
|
|
1550
|
+
return {
|
|
1551
|
+
top: '0px',
|
|
1552
|
+
bottom: 'inherit',
|
|
1553
|
+
left: '0px',
|
|
1554
|
+
right: '0px',
|
|
1555
|
+
};
|
|
1556
|
+
}
|
|
1557
|
+
// Card modals need safe-area for height calculation.
|
|
1558
|
+
// Note: isCardModal is already gated on mode === 'ios' by the caller.
|
|
1559
|
+
if (isCardModal) {
|
|
1560
|
+
return {
|
|
1561
|
+
top: 'inherit',
|
|
1562
|
+
bottom: 'inherit',
|
|
1563
|
+
left: '0px',
|
|
1564
|
+
right: '0px',
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
// On viewports that meet the centered dialog media query breakpoints,
|
|
1568
|
+
// regular modals render as centered dialogs (not fullscreen), so they
|
|
1569
|
+
// don't touch any screen edges and don't need safe-area insets.
|
|
1570
|
+
if (isCenteredDialogViewport()) {
|
|
1571
|
+
return {
|
|
1572
|
+
top: '0px',
|
|
1573
|
+
bottom: '0px',
|
|
1574
|
+
left: '0px',
|
|
1575
|
+
right: '0px',
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
// Fullscreen modals on phone - inherit all safe areas
|
|
1579
|
+
return {
|
|
1580
|
+
top: 'inherit',
|
|
1581
|
+
bottom: 'inherit',
|
|
1582
|
+
left: 'inherit',
|
|
1583
|
+
right: 'inherit',
|
|
1584
|
+
};
|
|
1585
|
+
};
|
|
1586
|
+
/**
|
|
1587
|
+
* Returns safe-area configuration based on actual modal position.
|
|
1588
|
+
* Detects which edges the modal overlaps with and only applies safe-area to those edges.
|
|
1589
|
+
*
|
|
1590
|
+
* Note: On Android edge-to-edge (API 36+), getBoundingClientRect() may report
|
|
1591
|
+
* inconsistent values. Sheet and card modals avoid this by using configuration-based
|
|
1592
|
+
* prediction instead. Regular modals use coordinate detection which works reliably
|
|
1593
|
+
* on web and iOS; Android edge-to-edge may need a configuration-based fallback
|
|
1594
|
+
* once a reliable detection mechanism is available.
|
|
1595
|
+
*
|
|
1596
|
+
* @param wrapperEl - The modal wrapper element to measure
|
|
1597
|
+
* @returns SafeAreaConfig based on position
|
|
1598
|
+
*/
|
|
1599
|
+
const getPositionBasedSafeAreaConfig = (wrapperEl) => {
|
|
1600
|
+
var _a, _b;
|
|
1601
|
+
const rect = wrapperEl.getBoundingClientRect();
|
|
1602
|
+
const vh = (_a = win === null || win === void 0 ? void 0 : win.innerHeight) !== null && _a !== void 0 ? _a : 0;
|
|
1603
|
+
const vw = (_b = win === null || win === void 0 ? void 0 : win.innerWidth) !== null && _b !== void 0 ? _b : 0;
|
|
1604
|
+
// Only apply safe-area to sides where modal overlaps with screen edge
|
|
1605
|
+
return {
|
|
1606
|
+
top: rect.top <= EDGE_THRESHOLD ? 'inherit' : '0px',
|
|
1607
|
+
bottom: rect.bottom >= vh - EDGE_THRESHOLD ? 'inherit' : '0px',
|
|
1608
|
+
left: rect.left <= EDGE_THRESHOLD ? 'inherit' : '0px',
|
|
1609
|
+
right: rect.right >= vw - EDGE_THRESHOLD ? 'inherit' : '0px',
|
|
1610
|
+
};
|
|
1611
|
+
};
|
|
1612
|
+
/**
|
|
1613
|
+
* Applies safe-area CSS custom property overrides to the modal host element.
|
|
1614
|
+
*
|
|
1615
|
+
* @param hostEl - The modal host element (ion-modal)
|
|
1616
|
+
* @param config - Safe-area configuration to apply
|
|
1617
|
+
*/
|
|
1618
|
+
const applySafeAreaOverrides = (hostEl, config) => {
|
|
1619
|
+
hostEl.style.setProperty('--ion-safe-area-top', config.top);
|
|
1620
|
+
hostEl.style.setProperty('--ion-safe-area-bottom', config.bottom);
|
|
1621
|
+
hostEl.style.setProperty('--ion-safe-area-left', config.left);
|
|
1622
|
+
hostEl.style.setProperty('--ion-safe-area-right', config.right);
|
|
1623
|
+
};
|
|
1624
|
+
/**
|
|
1625
|
+
* Clears safe-area CSS custom property overrides from the modal host element.
|
|
1626
|
+
*
|
|
1627
|
+
* @param hostEl - The modal host element (ion-modal)
|
|
1628
|
+
*/
|
|
1629
|
+
const clearSafeAreaOverrides = (hostEl) => {
|
|
1630
|
+
hostEl.style.removeProperty('--ion-safe-area-top');
|
|
1631
|
+
hostEl.style.removeProperty('--ion-safe-area-bottom');
|
|
1632
|
+
hostEl.style.removeProperty('--ion-safe-area-left');
|
|
1633
|
+
hostEl.style.removeProperty('--ion-safe-area-right');
|
|
1634
|
+
};
|
|
1635
|
+
|
|
1636
|
+
const modalIosCss = ":host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px}}@media only screen and (min-width: 768px) and (min-height: 768px){:host{--width:600px;--height:600px}}.modal-handle{left:0px;right:0px;top:5px;border-radius:8px;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;width:36px;height:5px;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));cursor:pointer;z-index:11}.modal-handle::before{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:\"\"}:host(.modal-sheet){--height:calc(100% - (var(--ion-modal-offset-top, 0px) + 10px))}:host(.modal-sheet) .modal-wrapper,:host(.modal-sheet) .modal-shadow{position:absolute;bottom:0}:host(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}:host{--backdrop-opacity:var(--ion-backdrop-opacity, 0.4)}:host(.modal-card),:host(.modal-sheet){--border-radius:10px}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--border-radius:10px}}.modal-wrapper{-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0)}@media screen and (max-width: 767px){@supports (width: max(0px, 1px)){:host(.modal-card){--height:calc(100% - max(30px, var(--ion-safe-area-top)) - 10px)}}@supports not (width: max(0px, 1px)){:host(.modal-card){--height:calc(100% - 40px)}}:host(.modal-card) .modal-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0;border-end-start-radius:0}:host(.modal-card){--backdrop-opacity:0;--width:100%;-ms-flex-align:end;align-items:flex-end}:host(.modal-card) .modal-shadow{display:none}:host(.modal-card) ion-backdrop{pointer-events:none}}@media screen and (min-width: 768px){:host(.modal-card){--width:calc(100% - 120px);--height:calc(100% - (120px + var(--ion-safe-area-top) + var(--ion-safe-area-bottom)));--max-width:720px;--max-height:1000px;--backdrop-opacity:0;--box-shadow:0px 0px 30px 10px rgba(0, 0, 0, 0.1);-webkit-transition:all 0.5s ease-in-out;transition:all 0.5s ease-in-out}:host(.modal-card) .modal-wrapper{-webkit-box-shadow:none;box-shadow:none}:host(.modal-card) .modal-shadow{-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow)}}:host(.modal-sheet) .modal-wrapper{border-start-start-radius:var(--border-radius);border-start-end-radius:var(--border-radius);border-end-end-radius:0;border-end-start-radius:0}";
|
|
1476
1637
|
|
|
1477
|
-
const modalMdCss = ":host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px
|
|
1638
|
+
const modalMdCss = ":host{--width:100%;--min-width:auto;--max-width:auto;--height:100%;--min-height:auto;--max-height:auto;--overflow:hidden;--border-radius:0;--border-width:0;--border-style:none;--border-color:transparent;--background:var(--ion-background-color, #fff);--box-shadow:none;--backdrop-opacity:0;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:absolute;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;color:var(--ion-text-color, #000);contain:strict}.modal-wrapper,ion-backdrop{pointer-events:auto}:host(.overlay-hidden){display:none}.modal-wrapper,.modal-shadow{border-radius:var(--border-radius);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:var(--overflow);z-index:10}.modal-shadow{position:absolute;background:transparent}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--width:600px;--height:500px}}@media only screen and (min-width: 768px) and (min-height: 768px){:host{--width:600px;--height:600px}}.modal-handle{left:0px;right:0px;top:5px;border-radius:8px;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;position:absolute;width:36px;height:5px;-webkit-transform:translateZ(0);transform:translateZ(0);border:0;background:var(--ion-color-step-350, var(--ion-background-color-step-350, #c0c0be));cursor:pointer;z-index:11}.modal-handle::before{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;position:absolute;width:36px;height:5px;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);content:\"\"}:host(.modal-sheet){--height:calc(100% - (var(--ion-modal-offset-top, 0px) + 10px))}:host(.modal-sheet) .modal-wrapper,:host(.modal-sheet) .modal-shadow{position:absolute;bottom:0}:host(.modal-sheet.modal-no-expand-scroll) ion-footer{position:absolute;bottom:0;width:var(--width)}:host{--backdrop-opacity:var(--ion-backdrop-opacity, 0.32)}@media only screen and (min-width: 768px) and (min-height: 600px){:host{--border-radius:2px;--box-shadow:0 28px 48px rgba(0, 0, 0, 0.4)}}.modal-wrapper{-webkit-transform:translate3d(0, 40px, 0);transform:translate3d(0, 40px, 0);opacity:0.01}";
|
|
1478
1639
|
|
|
1479
1640
|
const Modal = class {
|
|
1480
1641
|
constructor(hostRef) {
|
|
@@ -1687,13 +1848,31 @@ const Modal = class {
|
|
|
1687
1848
|
}
|
|
1688
1849
|
}
|
|
1689
1850
|
onWindowResize() {
|
|
1690
|
-
|
|
1691
|
-
if (getIonMode(this) !== 'ios' || !this.presentingElement || this.enterAnimation || this.leaveAnimation) {
|
|
1851
|
+
if (!this.presented)
|
|
1692
1852
|
return;
|
|
1693
|
-
}
|
|
1694
1853
|
clearTimeout(this.resizeTimeout);
|
|
1695
1854
|
this.resizeTimeout = setTimeout(() => {
|
|
1696
|
-
this.
|
|
1855
|
+
const context = this.getSafeAreaContext();
|
|
1856
|
+
// iOS card modals: handle portrait/landscape view transitions
|
|
1857
|
+
if (context.isCardModal && !this.enterAnimation && !this.leaveAnimation) {
|
|
1858
|
+
this.handleViewTransition();
|
|
1859
|
+
}
|
|
1860
|
+
// Sheet modals: re-compute the internal offset property since safe-area
|
|
1861
|
+
// values may change on device rotation (e.g., portrait notch vs landscape).
|
|
1862
|
+
if (context.isSheetModal) {
|
|
1863
|
+
this.updateSheetOffsetTop();
|
|
1864
|
+
}
|
|
1865
|
+
// Regular (non-sheet, non-card) modals: update safe-area overrides
|
|
1866
|
+
// since the viewport may have crossed the centered-dialog breakpoint.
|
|
1867
|
+
if (!context.isSheetModal && !context.isCardModal) {
|
|
1868
|
+
this.updateSafeAreaOverrides();
|
|
1869
|
+
// Re-evaluate fullscreen safe-area padding: clear first, then re-apply
|
|
1870
|
+
if (this.wrapperEl) {
|
|
1871
|
+
this.wrapperEl.style.removeProperty('height');
|
|
1872
|
+
this.wrapperEl.style.removeProperty('padding-bottom');
|
|
1873
|
+
}
|
|
1874
|
+
this.applyFullscreenSafeArea();
|
|
1875
|
+
}
|
|
1697
1876
|
}, 50); // Debounce to avoid excessive calls during active resizing
|
|
1698
1877
|
}
|
|
1699
1878
|
breakpointsChanged(breakpoints) {
|
|
@@ -1710,6 +1889,9 @@ const Modal = class {
|
|
|
1710
1889
|
this.triggerController.removeClickListener();
|
|
1711
1890
|
this.cleanupViewTransitionListener();
|
|
1712
1891
|
this.cleanupParentRemovalObserver();
|
|
1892
|
+
// Also called in dismiss() — intentional dual cleanup covers both
|
|
1893
|
+
// dismiss-then-remove and direct DOM removal without dismiss.
|
|
1894
|
+
this.cleanupSafeAreaOverrides();
|
|
1713
1895
|
}
|
|
1714
1896
|
componentWillLoad() {
|
|
1715
1897
|
var _a;
|
|
@@ -1870,6 +2052,11 @@ const Modal = class {
|
|
|
1870
2052
|
await waitForMount();
|
|
1871
2053
|
}
|
|
1872
2054
|
writeTask(() => this.el.classList.add('show-modal'));
|
|
2055
|
+
// Recalculate isSheetModal before safe-area setup because framework
|
|
2056
|
+
// bindings (e.g., Angular) may not have been applied when componentWillLoad ran.
|
|
2057
|
+
this.isSheetModal = this.breakpoints !== undefined && this.initialBreakpoint !== undefined;
|
|
2058
|
+
// Set initial safe-area overrides before animation
|
|
2059
|
+
this.setInitialSafeAreaOverrides();
|
|
1873
2060
|
const hasCardModal = presentingElement !== undefined;
|
|
1874
2061
|
/**
|
|
1875
2062
|
* We need to change the status bar at the
|
|
@@ -1887,6 +2074,10 @@ const Modal = class {
|
|
|
1887
2074
|
backdropBreakpoint: this.backdropBreakpoint,
|
|
1888
2075
|
expandToScroll: this.expandToScroll,
|
|
1889
2076
|
});
|
|
2077
|
+
// Update safe-area based on actual position after animation
|
|
2078
|
+
this.updateSafeAreaOverrides();
|
|
2079
|
+
// Apply fullscreen safe-area padding if needed
|
|
2080
|
+
this.applyFullscreenSafeArea();
|
|
1890
2081
|
/* tslint:disable-next-line */
|
|
1891
2082
|
if (typeof window !== 'undefined') {
|
|
1892
2083
|
/**
|
|
@@ -1918,13 +2109,7 @@ const Modal = class {
|
|
|
1918
2109
|
};
|
|
1919
2110
|
window.addEventListener(KEYBOARD_DID_OPEN, this.keyboardOpenCallback);
|
|
1920
2111
|
}
|
|
1921
|
-
|
|
1922
|
-
* Recalculate isSheetModal because framework bindings (e.g., Angular)
|
|
1923
|
-
* may not have been applied when componentWillLoad ran.
|
|
1924
|
-
*/
|
|
1925
|
-
const isSheetModal = this.breakpoints !== undefined && this.initialBreakpoint !== undefined;
|
|
1926
|
-
this.isSheetModal = isSheetModal;
|
|
1927
|
-
if (isSheetModal) {
|
|
2112
|
+
if (this.isSheetModal) {
|
|
1928
2113
|
this.initSheetGesture();
|
|
1929
2114
|
}
|
|
1930
2115
|
else if (hasCardModal) {
|
|
@@ -2114,6 +2299,9 @@ const Modal = class {
|
|
|
2114
2299
|
if (this.gestureAnimationDismissing && role !== GESTURE) {
|
|
2115
2300
|
return false;
|
|
2116
2301
|
}
|
|
2302
|
+
// Cancel any pending resize timeout to prevent stale updates during dismiss
|
|
2303
|
+
clearTimeout(this.resizeTimeout);
|
|
2304
|
+
this.resizeTimeout = undefined;
|
|
2117
2305
|
/**
|
|
2118
2306
|
* Because the canDismiss check below is async,
|
|
2119
2307
|
* we need to claim a lock before the check happens,
|
|
@@ -2168,6 +2356,7 @@ const Modal = class {
|
|
|
2168
2356
|
}
|
|
2169
2357
|
this.cleanupViewTransitionListener();
|
|
2170
2358
|
this.cleanupParentRemovalObserver();
|
|
2359
|
+
this.cleanupSafeAreaOverrides();
|
|
2171
2360
|
this.cleanupChildRoutePassthrough();
|
|
2172
2361
|
}
|
|
2173
2362
|
this.currentBreakpoint = undefined;
|
|
@@ -2288,6 +2477,9 @@ const Modal = class {
|
|
|
2288
2477
|
this.viewTransitionAnimation = transitionAnimation;
|
|
2289
2478
|
transitionAnimation.play().then(() => {
|
|
2290
2479
|
this.viewTransitionAnimation = undefined;
|
|
2480
|
+
// Wait for a layout pass after the transition so getBoundingClientRect()
|
|
2481
|
+
// in getPositionBasedSafeAreaConfig() reflects the new dimensions.
|
|
2482
|
+
raf(() => this.updateSafeAreaOverrides());
|
|
2291
2483
|
// After orientation transition, recreate the swipe-to-close gesture
|
|
2292
2484
|
// with updated animation that reflects the new presenting element state
|
|
2293
2485
|
this.reinitSwipeToClose();
|
|
@@ -2414,6 +2606,123 @@ const Modal = class {
|
|
|
2414
2606
|
(_a = this.parentRemovalObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
2415
2607
|
this.parentRemovalObserver = undefined;
|
|
2416
2608
|
}
|
|
2609
|
+
/**
|
|
2610
|
+
* Creates the context object for safe-area utilities.
|
|
2611
|
+
*/
|
|
2612
|
+
getSafeAreaContext() {
|
|
2613
|
+
return {
|
|
2614
|
+
isSheetModal: this.isSheetModal,
|
|
2615
|
+
isCardModal: this.presentingElement !== undefined && getIonMode(this) === 'ios',
|
|
2616
|
+
presentingElement: this.presentingElement,
|
|
2617
|
+
breakpoints: this.breakpoints,
|
|
2618
|
+
currentBreakpoint: this.currentBreakpoint,
|
|
2619
|
+
};
|
|
2620
|
+
}
|
|
2621
|
+
/**
|
|
2622
|
+
* Sets initial safe-area overrides before modal animation.
|
|
2623
|
+
* Called in present() before animation starts.
|
|
2624
|
+
*
|
|
2625
|
+
* For sheet modals, the SCSS --height formula uses --ion-modal-offset-top
|
|
2626
|
+
* (an internal property) instead of --ion-safe-area-top. We resolve the
|
|
2627
|
+
* root safe-area-top to pixels and set --ion-modal-offset-top, decoupling
|
|
2628
|
+
* the height calculation from --ion-safe-area-top (which is zeroed for
|
|
2629
|
+
* sheets to prevent header content from getting double-offset padding).
|
|
2630
|
+
*/
|
|
2631
|
+
setInitialSafeAreaOverrides() {
|
|
2632
|
+
const context = this.getSafeAreaContext();
|
|
2633
|
+
const safeAreaConfig = getInitialSafeAreaConfig(context);
|
|
2634
|
+
applySafeAreaOverrides(this.el, safeAreaConfig);
|
|
2635
|
+
// Set the internal offset property with the resolved root safe-area-top value
|
|
2636
|
+
if (context.isSheetModal) {
|
|
2637
|
+
this.updateSheetOffsetTop();
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
/**
|
|
2641
|
+
* Resolves the current root --ion-safe-area-top value and sets the
|
|
2642
|
+
* internal --ion-modal-offset-top property on the host element.
|
|
2643
|
+
* Called on present and on resize (e.g., device rotation changes safe-area).
|
|
2644
|
+
*/
|
|
2645
|
+
updateSheetOffsetTop() {
|
|
2646
|
+
const safeAreaTop = getRootSafeAreaTop();
|
|
2647
|
+
this.el.style.setProperty('--ion-modal-offset-top', `${safeAreaTop}px`);
|
|
2648
|
+
}
|
|
2649
|
+
/**
|
|
2650
|
+
* Updates safe-area overrides during dynamic state changes.
|
|
2651
|
+
* Called after animations, during gestures, and on orientation changes.
|
|
2652
|
+
*/
|
|
2653
|
+
updateSafeAreaOverrides() {
|
|
2654
|
+
const { wrapperEl, el } = this;
|
|
2655
|
+
const context = this.getSafeAreaContext();
|
|
2656
|
+
// Sheet modals: safe-area is fully determined at presentation time
|
|
2657
|
+
// (top is always 0px, height is frozen). Nothing to update.
|
|
2658
|
+
if (context.isSheetModal)
|
|
2659
|
+
return;
|
|
2660
|
+
// Card modals have fixed safe-area requirements set by initial prediction.
|
|
2661
|
+
if (context.isCardModal)
|
|
2662
|
+
return;
|
|
2663
|
+
// wrapperEl is required for position-based detection below
|
|
2664
|
+
if (!wrapperEl)
|
|
2665
|
+
return;
|
|
2666
|
+
// Regular modals: use position-based detection to correctly handle both
|
|
2667
|
+
// fullscreen modals and centered dialogs with custom dimensions.
|
|
2668
|
+
const safeAreaConfig = getPositionBasedSafeAreaConfig(wrapperEl);
|
|
2669
|
+
applySafeAreaOverrides(el, safeAreaConfig);
|
|
2670
|
+
}
|
|
2671
|
+
/**
|
|
2672
|
+
* Applies padding-bottom to fullscreen modal wrapper to prevent
|
|
2673
|
+
* content from overlapping system navigation bar.
|
|
2674
|
+
*/
|
|
2675
|
+
applyFullscreenSafeArea() {
|
|
2676
|
+
const { wrapperEl, el } = this;
|
|
2677
|
+
if (!wrapperEl)
|
|
2678
|
+
return;
|
|
2679
|
+
const context = this.getSafeAreaContext();
|
|
2680
|
+
if (context.isSheetModal || context.isCardModal)
|
|
2681
|
+
return;
|
|
2682
|
+
// Check for standard Ionic layout children (ion-content, ion-footer),
|
|
2683
|
+
// searching one level deep for wrapped components (e.g.,
|
|
2684
|
+
// <app-footer><ion-footer>...</ion-footer></app-footer>).
|
|
2685
|
+
// Note: uses a manual loop instead of querySelector(':scope > ...') because
|
|
2686
|
+
// Stencil's mock-doc (used in spec tests) does not support :scope.
|
|
2687
|
+
let hasContent = false;
|
|
2688
|
+
let hasFooter = false;
|
|
2689
|
+
for (const child of Array.from(el.children)) {
|
|
2690
|
+
if (child.tagName === 'ION-CONTENT')
|
|
2691
|
+
hasContent = true;
|
|
2692
|
+
if (child.tagName === 'ION-FOOTER')
|
|
2693
|
+
hasFooter = true;
|
|
2694
|
+
for (const grandchild of Array.from(child.children)) {
|
|
2695
|
+
if (grandchild.tagName === 'ION-CONTENT')
|
|
2696
|
+
hasContent = true;
|
|
2697
|
+
if (grandchild.tagName === 'ION-FOOTER')
|
|
2698
|
+
hasFooter = true;
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
// Only apply wrapper padding for standard Ionic layouts (has ion-content
|
|
2702
|
+
// but no ion-footer). Custom modals with raw HTML are fully
|
|
2703
|
+
// developer-controlled and should not be modified.
|
|
2704
|
+
if (!hasContent || hasFooter)
|
|
2705
|
+
return;
|
|
2706
|
+
// Reduce wrapper height by safe-area and add equivalent padding so the
|
|
2707
|
+
// total visual size stays the same but the flex content area shrinks.
|
|
2708
|
+
// Using height + padding instead of box-sizing: border-box avoids
|
|
2709
|
+
// breaking custom modals that set --border-width (border-box would
|
|
2710
|
+
// include the border inside the height, changing the layout).
|
|
2711
|
+
wrapperEl.style.setProperty('height', 'calc(var(--height) - var(--ion-safe-area-bottom, 0px))');
|
|
2712
|
+
wrapperEl.style.setProperty('padding-bottom', 'var(--ion-safe-area-bottom, 0px)');
|
|
2713
|
+
}
|
|
2714
|
+
/**
|
|
2715
|
+
* Clears all safe-area overrides and padding from wrapper.
|
|
2716
|
+
*/
|
|
2717
|
+
cleanupSafeAreaOverrides() {
|
|
2718
|
+
clearSafeAreaOverrides(this.el);
|
|
2719
|
+
// Remove internal sheet offset property
|
|
2720
|
+
this.el.style.removeProperty('--ion-modal-offset-top');
|
|
2721
|
+
if (this.wrapperEl) {
|
|
2722
|
+
this.wrapperEl.style.removeProperty('height');
|
|
2723
|
+
this.wrapperEl.style.removeProperty('padding-bottom');
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2417
2726
|
render() {
|
|
2418
2727
|
const { handle, isSheetModal, presentingElement, htmlAttributes, handleBehavior, inheritedAttributes, focusTrap, expandToScroll, } = this;
|
|
2419
2728
|
const showHandle = handle !== false && isSheetModal;
|
|
@@ -2421,20 +2730,20 @@ const Modal = class {
|
|
|
2421
2730
|
const isCardModal = presentingElement !== undefined && mode === 'ios';
|
|
2422
2731
|
const isHandleCycle = handleBehavior === 'cycle';
|
|
2423
2732
|
const isSheetModalWithHandle = isSheetModal && showHandle;
|
|
2424
|
-
return (h(Host, Object.assign({ key: '
|
|
2733
|
+
return (h(Host, Object.assign({ key: '952cbd52d1fc737332a23d523b02d5fa60abf30a', "no-router": true,
|
|
2425
2734
|
// Allow the modal to be navigable when the handle is focusable
|
|
2426
2735
|
tabIndex: isHandleCycle && isSheetModalWithHandle ? 0 : -1 }, htmlAttributes, { style: {
|
|
2427
2736
|
zIndex: `${20000 + this.overlayIndex}`,
|
|
2428
|
-
}, class: Object.assign({ [mode]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, [`modal-no-expand-scroll`]: isSheetModal && !expandToScroll, '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, onFocus: this.onModalFocus }), h("ion-backdrop", { key: '
|
|
2737
|
+
}, class: Object.assign({ [mode]: true, ['modal-default']: !isCardModal && !isSheetModal, [`modal-card`]: isCardModal, [`modal-sheet`]: isSheetModal, [`modal-no-expand-scroll`]: isSheetModal && !expandToScroll, '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, onFocus: this.onModalFocus }), h("ion-backdrop", { key: '66e3658cfcc2961d99ecc1174f26b1794ceb65e9', ref: (el) => (this.backdropEl = el), visible: this.showBackdrop, tappable: this.backdropDismiss, part: "backdrop" }), mode === 'ios' && h("div", { key: '3d1b9b26daf87374e2029d0e0a7fc09b9257fd77', class: "modal-shadow" }), h("div", Object.assign({ key: 'e652c2b3eb66afa8367d94c3b14ba0e825877a82',
|
|
2429
2738
|
/*
|
|
2430
2739
|
role and aria-modal must be used on the
|
|
2431
2740
|
same element. They must also be set inside the
|
|
2432
2741
|
shadow DOM otherwise ion-button will not be highlighted
|
|
2433
2742
|
when using VoiceOver: https://bugs.webkit.org/show_bug.cgi?id=247134
|
|
2434
2743
|
*/
|
|
2435
|
-
role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (h("button", { key: '
|
|
2744
|
+
role: "dialog" }, inheritedAttributes, { "aria-modal": "true", class: "modal-wrapper ion-overlay-wrapper", part: "content", ref: (el) => (this.wrapperEl = el) }), showHandle && (h("button", { key: '41662183450e8ef2f7d96dac2bea5952bad8b7a5', class: "modal-handle",
|
|
2436
2745
|
// Prevents the handle from receiving keyboard focus when it does not cycle
|
|
2437
|
-
tabIndex: !isHandleCycle ? -1 : 0, "aria-label": "Activate to adjust the size of the dialog overlaying the screen", onClick: isHandleCycle ? this.onHandleClick : undefined, part: "handle", ref: (el) => (this.dragHandleEl = el) })), h("slot", { key: '
|
|
2746
|
+
tabIndex: !isHandleCycle ? -1 : 0, "aria-label": "Activate to adjust the size of the dialog overlaying the screen", onClick: isHandleCycle ? this.onHandleClick : undefined, part: "handle", ref: (el) => (this.dragHandleEl = el) })), h("slot", { key: '4aac4e2928929b9e5e59b33c83395182105da529', onSlotchange: this.onSlotChange }))));
|
|
2438
2747
|
}
|
|
2439
2748
|
get el() { return getElement(this); }
|
|
2440
2749
|
static get watchers() { return {
|