react-better-html 1.1.247 → 1.1.248

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.mjs CHANGED
@@ -7365,23 +7365,23 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
7365
7365
  const firstRenderPassedRef = useRef8(false);
7366
7366
  const tabsRef = useRef8({});
7367
7367
  const [selectedTab, setSelectedTab] = useState13(() => {
7368
- const selectedTabValue = tabs[0] ?? "";
7368
+ const selectedTabId = tabs[0]?.id ?? "";
7369
7369
  if (urlQuery) {
7370
7370
  const tabQueryValue = urlQuery.getQuery(name ?? defaultTabName);
7371
- if (!tabQueryValue) return selectedTabValue;
7372
- if (tabs.includes(tabQueryValue)) return tabQueryValue;
7371
+ if (!tabQueryValue) return selectedTabId;
7372
+ if (tabs.some((tab) => tab.id === tabQueryValue)) return tabQueryValue;
7373
7373
  }
7374
- return selectedTabValue;
7374
+ return selectedTabId;
7375
7375
  });
7376
7376
  const [rerenderState, setRerenderState] = useState13(0);
7377
7377
  const tabsGap = style === "box" ? theme2.styles.gap / 2 : 0;
7378
7378
  const onClickTab = useCallback16(
7379
7379
  (tab) => {
7380
- setSelectedTab(tab);
7380
+ setSelectedTab(tab.id);
7381
7381
  onChange?.(tab);
7382
7382
  if (urlQuery) {
7383
7383
  urlQuery.setQuery({
7384
- [name ?? defaultTabName]: tab
7384
+ [name ?? defaultTabName]: tab.id
7385
7385
  });
7386
7386
  }
7387
7387
  },
@@ -7392,7 +7392,7 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
7392
7392
  [rerenderState, selectedTab]
7393
7393
  );
7394
7394
  const leftSpacing = useMemo11(() => {
7395
- const selectedTabIndex = tabs.findIndex((tab) => tab === selectedTab);
7395
+ const selectedTabIndex = tabs.findIndex((tab) => tab.id === selectedTab);
7396
7396
  let spacing = 0;
7397
7397
  Object.values(tabsRef.current).forEach((tab, index) => {
7398
7398
  if (index < selectedTabIndex) spacing += (tab?.getBoundingClientRect().width ?? 0) + tabsGap;
@@ -7451,7 +7451,7 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
7451
7451
  return /* @__PURE__ */ jsxs22(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
7452
7452
  /* @__PURE__ */ jsxs22(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
7453
7453
  /* @__PURE__ */ jsx25(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
7454
- const selected = tab === selectedTab;
7454
+ const selected = tab.id === selectedTab;
7455
7455
  return /* @__PURE__ */ jsxs22(
7456
7456
  Div_default,
7457
7457
  {
@@ -7470,10 +7470,10 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
7470
7470
  isTabAccessed: true,
7471
7471
  onClickWithValue: onClickTab,
7472
7472
  ref: (ref2) => {
7473
- tabsRef.current[tab] = ref2;
7473
+ tabsRef.current[tab.id] = ref2;
7474
7474
  },
7475
7475
  children: [
7476
- componentsState.tabs.tabsWithDots.includes(tab) && /* @__PURE__ */ jsx25(
7476
+ componentsState.tabs.tabsWithDots.includes(tab.id) && /* @__PURE__ */ jsx25(
7477
7477
  Div_default,
7478
7478
  {
7479
7479
  position: "absolute",
@@ -7493,12 +7493,12 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
7493
7493
  color: !selected ? theme2.colors.textSecondary : style === "box" ? theme2.colors.base : void 0,
7494
7494
  transition: theme2.styles.transition,
7495
7495
  whiteSpace: "nowrap",
7496
- children: tab
7496
+ children: tab.label ?? tab.id
7497
7497
  }
7498
7498
  )
7499
7499
  ]
7500
7500
  },
7501
- tab
7501
+ tab.id
7502
7502
  );
7503
7503
  }) }),
7504
7504
  style !== "box" && /* @__PURE__ */ jsx25(