@ionic/react 8.2.7-nightly.20240813 → 8.2.8-dev.11723747334.19c4ecce

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$1h } from '@ionic/core/components/ion-nav.js';
43
+ import { defineCustomElement as defineCustomElement$1i } 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,11 +85,12 @@ 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$1g } from '@ionic/core/components/ion-app.js';
89
- import { defineCustomElement as defineCustomElement$1f } from '@ionic/core/components/ion-back-button.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';
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';
93
94
  import { defineCustomElement as defineCustomElement$1d } from 'ionicons/components/ion-icon.js';
94
95
 
95
96
  const IonLifeCycleContext = /*@__PURE__*/ React.createContext({
@@ -1074,9 +1075,10 @@ const IonOverlayManager = ({ onAddOverlay, onRemoveOverlay }) => {
1074
1075
 
1075
1076
  const IonTabButtonInner = /*@__PURE__*/ createReactComponent('ion-tab-button', undefined, undefined, defineCustomElement$1e);
1076
1077
  const IonTabBarInner = /*@__PURE__*/ createReactComponent('ion-tab-bar', undefined, undefined, defineCustomElement$1b);
1077
- const IonBackButtonInner = /*@__PURE__*/ createReactComponent('ion-back-button', undefined, undefined, defineCustomElement$1f);
1078
+ const IonTabsInner = /*@__PURE__*/ createReactComponent('ion-tabs', undefined, undefined, defineCustomElement$1f);
1079
+ const IonBackButtonInner = /*@__PURE__*/ createReactComponent('ion-back-button', undefined, undefined, defineCustomElement$1g);
1078
1080
  const IonRouterOutletInner = /*@__PURE__*/ createReactComponent('ion-router-outlet', undefined, undefined, defineCustomElement$1c);
1079
- const IonAppInner = /*@__PURE__*/ createReactComponent('ion-app', undefined, undefined, defineCustomElement$1g);
1081
+ const IonAppInner = /*@__PURE__*/ createReactComponent('ion-app', undefined, undefined, defineCustomElement$1h);
1080
1082
  // ionicons
1081
1083
  const IonIconInner = /*@__PURE__*/ createReactComponent('ion-icon', undefined, undefined, defineCustomElement$1d);
1082
1084
 
@@ -1239,7 +1241,7 @@ const ReactDelegate = (addView, removeView) => {
1239
1241
  };
1240
1242
  };
1241
1243
 
1242
- const IonNavInner = createReactComponent('ion-nav', undefined, undefined, defineCustomElement$1h);
1244
+ const IonNavInner = createReactComponent('ion-nav', undefined, undefined, defineCustomElement$1i);
1243
1245
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1244
1246
  const IonNavInternal = (_a) => {
1245
1247
  var { children, forwardedRef } = _a, restOfProps = __rest(_a, ["children", "forwardedRef"]);
@@ -1610,6 +1612,7 @@ const IonTabs = /*@__PURE__*/ (() => class extends React.Component {
1610
1612
  render() {
1611
1613
  let outlet;
1612
1614
  let tabBar;
1615
+ let hasIonTab = false;
1613
1616
  const _a = this.props, { className, onIonTabsDidChange, onIonTabsWillChange } = _a, props = __rest(_a, ["className", "onIonTabsDidChange", "onIonTabsWillChange"]);
1614
1617
  const children = typeof this.props.children === 'function'
1615
1618
  ? this.props.children(this.ionTabContextState)
@@ -1625,6 +1628,13 @@ const IonTabs = /*@__PURE__*/ (() => class extends React.Component {
1625
1628
  else if (child.type === Fragment && child.props.children[0].type === IonRouterOutlet) {
1626
1629
  outlet = child.props.children[0];
1627
1630
  }
1631
+ else if (child.type === IonTab) {
1632
+ /**
1633
+ * This indicates that IonTabs will be using a basic tab-based navigation
1634
+ * without the history stack or URL updates associated with the router.
1635
+ */
1636
+ hasIonTab = true;
1637
+ }
1628
1638
  let childProps = {
1629
1639
  ref: this.tabBarRef,
1630
1640
  };
@@ -1649,17 +1659,29 @@ const IonTabs = /*@__PURE__*/ (() => class extends React.Component {
1649
1659
  tabBar = React.cloneElement(child.props.children[1], childProps);
1650
1660
  }
1651
1661
  });
1652
- if (!outlet) {
1662
+ if (!outlet && !hasIonTab) {
1653
1663
  throw new Error('IonTabs must contain an IonRouterOutlet');
1654
1664
  }
1665
+ if (outlet && hasIonTab) {
1666
+ throw new Error('IonTabs cannot contain an IonRouterOutlet and an IonTab at the same time');
1667
+ }
1655
1668
  if (!tabBar) {
1656
1669
  throw new Error('IonTabs needs a IonTabBar');
1657
1670
  }
1671
+ if (hasIonTab) {
1672
+ return React.createElement(IonTabsInner, Object.assign({}, this.props));
1673
+ }
1658
1674
  return (React.createElement(IonTabsContext.Provider, { value: this.ionTabContextState }, this.context.hasIonicRouter() ? (React.createElement(PageManager, Object.assign({ className: className ? `${className}` : '', routeInfo: this.context.routeInfo }, props),
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 }),
1675
+ React.createElement(IonTabsInner, Object.assign({}, this.props), React.Children.map(children, (child) => {
1676
+ if (child.type === IonTabBar || child.type.isTabBar) {
1677
+ /**
1678
+ * The modified tabBar needs to be returned to include
1679
+ * the context and the overridden methods.
1680
+ */
1681
+ return tabBar;
1682
+ }
1683
+ return child;
1684
+ })))) : (React.createElement("div", Object.assign({ className: className ? `${className}` : 'ion-tabs' }, props, { style: hostStyles }),
1663
1685
  tabBar.props.slot === 'top' ? tabBar : null,
1664
1686
  React.createElement("div", { style: tabsInner, className: "tabs-inner" }, outlet),
1665
1687
  tabBar.props.slot === 'bottom' ? tabBar : null))));