@ionic/react 8.2.8-dev.11724280606.1a8c11d4 → 8.2.8-dev.11724359497.19f21e81

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/index.js CHANGED
@@ -40,7 +40,7 @@ import { defineCustomElement as defineCustomElement$y } from '@ionic/core/compon
40
40
  import { defineCustomElement as defineCustomElement$z } from '@ionic/core/components/ion-menu.js';
41
41
  import { defineCustomElement as defineCustomElement$A } from '@ionic/core/components/ion-menu-button.js';
42
42
  import { defineCustomElement as defineCustomElement$B } from '@ionic/core/components/ion-menu-toggle.js';
43
- import { defineCustomElement as defineCustomElement$1i } from '@ionic/core/components/ion-nav.js';
43
+ import { defineCustomElement as defineCustomElement$1h } from '@ionic/core/components/ion-nav.js';
44
44
  import { defineCustomElement as defineCustomElement$C } from '@ionic/core/components/ion-nav-link.js';
45
45
  import { defineCustomElement as defineCustomElement$D } from '@ionic/core/components/ion-note.js';
46
46
  import { defineCustomElement as defineCustomElement$E } from '@ionic/core/components/ion-picker.js';
@@ -85,12 +85,11 @@ import { defineCustomElement as defineCustomElement$17 } from '@ionic/core/compo
85
85
  import { defineCustomElement as defineCustomElement$18 } from '@ionic/core/components/ion-action-sheet.js';
86
86
  import { defineCustomElement as defineCustomElement$19 } from '@ionic/core/components/ion-modal.js';
87
87
  import { defineCustomElement as defineCustomElement$1a } from '@ionic/core/components/ion-popover.js';
88
- import { defineCustomElement as defineCustomElement$1h } from '@ionic/core/components/ion-app.js';
89
- import { defineCustomElement as defineCustomElement$1g } from '@ionic/core/components/ion-back-button.js';
88
+ import { defineCustomElement as defineCustomElement$1g } from '@ionic/core/components/ion-app.js';
89
+ import { defineCustomElement as defineCustomElement$1f } from '@ionic/core/components/ion-back-button.js';
90
90
  import { defineCustomElement as defineCustomElement$1c } from '@ionic/core/components/ion-router-outlet.js';
91
91
  import { defineCustomElement as defineCustomElement$1b } from '@ionic/core/components/ion-tab-bar.js';
92
92
  import { defineCustomElement as defineCustomElement$1e } from '@ionic/core/components/ion-tab-button.js';
93
- import { defineCustomElement as defineCustomElement$1f } from '@ionic/core/components/ion-tabs.js';
94
93
  import { defineCustomElement as defineCustomElement$1d } from 'ionicons/components/ion-icon.js';
95
94
 
96
95
  const IonLifeCycleContext = /*@__PURE__*/ React.createContext({
@@ -1075,10 +1074,9 @@ const IonOverlayManager = ({ onAddOverlay, onRemoveOverlay }) => {
1075
1074
 
1076
1075
  const IonTabButtonInner = /*@__PURE__*/ createReactComponent('ion-tab-button', undefined, undefined, defineCustomElement$1e);
1077
1076
  const IonTabBarInner = /*@__PURE__*/ createReactComponent('ion-tab-bar', undefined, undefined, defineCustomElement$1b);
1078
- const IonTabsInner = /*@__PURE__*/ createReactComponent('ion-tabs', undefined, undefined, defineCustomElement$1f);
1079
- const IonBackButtonInner = /*@__PURE__*/ createReactComponent('ion-back-button', undefined, undefined, defineCustomElement$1g);
1077
+ const IonBackButtonInner = /*@__PURE__*/ createReactComponent('ion-back-button', undefined, undefined, defineCustomElement$1f);
1080
1078
  const IonRouterOutletInner = /*@__PURE__*/ createReactComponent('ion-router-outlet', undefined, undefined, defineCustomElement$1c);
1081
- const IonAppInner = /*@__PURE__*/ createReactComponent('ion-app', undefined, undefined, defineCustomElement$1h);
1079
+ const IonAppInner = /*@__PURE__*/ createReactComponent('ion-app', undefined, undefined, defineCustomElement$1g);
1082
1080
  // ionicons
1083
1081
  const IonIconInner = /*@__PURE__*/ createReactComponent('ion-icon', undefined, undefined, defineCustomElement$1d);
1084
1082
 
@@ -1241,7 +1239,7 @@ const ReactDelegate = (addView, removeView) => {
1241
1239
  };
1242
1240
  };
1243
1241
 
1244
- const IonNavInner = createReactComponent('ion-nav', undefined, undefined, defineCustomElement$1i);
1242
+ const IonNavInner = createReactComponent('ion-nav', undefined, undefined, defineCustomElement$1h);
1245
1243
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1246
1244
  const IonNavInternal = (_a) => {
1247
1245
  var { children, forwardedRef } = _a, restOfProps = __rest(_a, ["children", "forwardedRef"]);
@@ -1496,10 +1494,9 @@ class IonTabBarUnwrapped extends React.PureComponent {
1496
1494
  };
1497
1495
  }
1498
1496
  onTabButtonClick(e, onClickFn) {
1499
- var _a;
1500
1497
  const tappedTab = this.state.tabs[e.detail.tab];
1501
1498
  const originalHref = tappedTab.originalHref;
1502
- const currentHref = ((_a = this.props.routerOutletRef) === null || _a === void 0 ? void 0 : _a.current) ? e.detail.href : '';
1499
+ const currentHref = e.detail.href;
1503
1500
  const { activeTab: prevActiveTab } = this.state;
1504
1501
  if (onClickFn) {
1505
1502
  /**
@@ -1613,36 +1610,23 @@ const IonTabs = /*@__PURE__*/ (() => class extends React.Component {
1613
1610
  render() {
1614
1611
  let outlet;
1615
1612
  let tabBar;
1616
- // Check if IonTabs has any IonTab children
1617
- let hasTab = false;
1618
1613
  const _a = this.props, { className, onIonTabsDidChange, onIonTabsWillChange } = _a, props = __rest(_a, ["className", "onIonTabsDidChange", "onIonTabsWillChange"]);
1619
1614
  const children = typeof this.props.children === 'function'
1620
1615
  ? this.props.children(this.ionTabContextState)
1621
1616
  : this.props.children;
1622
- const outletProps = {
1623
- ref: this.routerOutletRef,
1624
- };
1625
1617
  React.Children.forEach(children, (child) => {
1626
1618
  // eslint-disable-next-line no-prototype-builtins
1627
1619
  if (child == null || typeof child !== 'object' || !child.hasOwnProperty('type')) {
1628
1620
  return;
1629
1621
  }
1630
1622
  if (child.type === IonRouterOutlet || child.type.isRouterOutlet) {
1631
- outlet = React.cloneElement(child, outletProps);
1623
+ outlet = React.cloneElement(child);
1632
1624
  }
1633
1625
  else if (child.type === Fragment && child.props.children[0].type === IonRouterOutlet) {
1634
- outlet = React.cloneElement(child.props.children[0], outletProps);
1635
- }
1636
- else if (child.type === IonTab) {
1637
- /**
1638
- * This indicates that IonTabs will be using a basic tab-based navigation
1639
- * without the history stack or URL updates associated with the router.
1640
- */
1641
- hasTab = true;
1626
+ outlet = child.props.children[0];
1642
1627
  }
1643
1628
  let childProps = {
1644
1629
  ref: this.tabBarRef,
1645
- routerOutletRef: this.routerOutletRef,
1646
1630
  };
1647
1631
  /**
1648
1632
  * Only pass these props
@@ -1665,56 +1649,17 @@ const IonTabs = /*@__PURE__*/ (() => class extends React.Component {
1665
1649
  tabBar = React.cloneElement(child.props.children[1], childProps);
1666
1650
  }
1667
1651
  });
1668
- if (!outlet && !hasTab) {
1669
- throw new Error('IonTabs must contain an IonRouterOutlet or an IonTab');
1670
- }
1671
- if (outlet && hasTab) {
1672
- throw new Error('IonTabs cannot contain an IonRouterOutlet and an IonTab at the same time');
1652
+ if (!outlet) {
1653
+ throw new Error('IonTabs must contain an IonRouterOutlet');
1673
1654
  }
1674
1655
  if (!tabBar) {
1675
1656
  throw new Error('IonTabs needs a IonTabBar');
1676
1657
  }
1677
- if (hasTab) {
1678
- return React.createElement(IonTabsInner, Object.assign({}, this.props));
1679
- }
1680
- /**
1681
- * TODO(ROU-11051)
1682
- *
1683
- * There is no error handling for the case where there
1684
- * is no associated Route for the given IonTabButton.
1685
- *
1686
- * More investigation is needed to determine how to
1687
- * handle this to prevent any overwriting of the
1688
- * IonTabButton's onClick handler and how the routing
1689
- * is handled.
1690
- */
1691
1658
  return (React.createElement(IonTabsContext.Provider, { value: this.ionTabContextState }, this.context.hasIonicRouter() ? (React.createElement(PageManager, Object.assign({ className: className ? `${className}` : '', routeInfo: this.context.routeInfo }, props),
1692
- React.createElement(IonTabsInner, Object.assign({}, this.props), React.Children.map(children, (child) => {
1693
- if (React.isValidElement(child)) {
1694
- const isTabBar = child.type === IonTabBar ||
1695
- child.type.isTabBar ||
1696
- (child.type === Fragment &&
1697
- (child.props.children[1].type === IonTabBar || child.props.children[1].type.isTabBar));
1698
- const isRouterOutlet = child.type === IonRouterOutlet ||
1699
- child.type.isRouterOutlet ||
1700
- (child.type === Fragment && child.props.children[0].type === IonRouterOutlet);
1701
- if (isTabBar) {
1702
- /**
1703
- * The modified tabBar needs to be returned to include
1704
- * the context and the overridden methods.
1705
- */
1706
- return tabBar;
1707
- }
1708
- if (isRouterOutlet) {
1709
- /**
1710
- * The modified outlet needs to be returned to include
1711
- * the ref.
1712
- */
1713
- return outlet;
1714
- }
1715
- }
1716
- return child;
1717
- })))) : (React.createElement("div", Object.assign({ className: className ? `${className}` : 'ion-tabs' }, props, { style: hostStyles }),
1659
+ React.createElement("ion-tabs", { className: "ion-tabs", style: hostStyles },
1660
+ tabBar.props.slot === 'top' ? tabBar : null,
1661
+ React.createElement("div", { style: tabsInner, className: "tabs-inner" }, outlet),
1662
+ tabBar.props.slot === 'bottom' ? tabBar : null))) : (React.createElement("div", Object.assign({ className: className ? `${className}` : 'ion-tabs' }, props, { style: hostStyles }),
1718
1663
  tabBar.props.slot === 'top' ? tabBar : null,
1719
1664
  React.createElement("div", { style: tabsInner, className: "tabs-inner" }, outlet),
1720
1665
  tabBar.props.slot === 'bottom' ? tabBar : null))));