react-better-html 1.1.271 → 1.1.272

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.d.mts CHANGED
@@ -520,6 +520,8 @@ type TabsProps = {
520
520
  style?: "default" | "borderRadiusTop" | "box";
521
521
  gap?: number;
522
522
  noBottomLine?: boolean;
523
+ /** @default true */
524
+ keepUrlHistory?: boolean;
523
525
  onChange?: (tab: Tab["id"]) => void;
524
526
  children?: React.ReactNode;
525
527
  } & ComponentMarginProps;
package/dist/index.d.ts CHANGED
@@ -520,6 +520,8 @@ type TabsProps = {
520
520
  style?: "default" | "borderRadiusTop" | "box";
521
521
  gap?: number;
522
522
  noBottomLine?: boolean;
523
+ /** @default true */
524
+ keepUrlHistory?: boolean;
523
525
  onChange?: (tab: Tab["id"]) => void;
524
526
  children?: React.ReactNode;
525
527
  } & ComponentMarginProps;
package/dist/index.js CHANGED
@@ -7514,12 +7514,22 @@ var import_jsx_runtime26 = require("react/jsx-runtime");
7514
7514
  var tabBottomLineWidth = 2;
7515
7515
  var tabDotSize = 6;
7516
7516
  var defaultTabName = "tab";
7517
- var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, accentColor, style = "default", gap, noBottomLine, onChange, children, ...props }, ref) {
7517
+ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({
7518
+ tabs,
7519
+ name,
7520
+ accentColor,
7521
+ style = "default",
7522
+ gap,
7523
+ noBottomLine,
7524
+ keepUrlHistory = true,
7525
+ onChange,
7526
+ children,
7527
+ ...props
7528
+ }, ref) {
7518
7529
  const reactRouterDomPlugin2 = usePlugin("react-router-dom");
7519
7530
  const theme2 = (0, import_react_better_core27.useTheme)();
7520
7531
  const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
7521
7532
  const { componentsState } = useBetterHtmlContextInternal();
7522
- const { colorTheme } = (0, import_react_better_core27.useBetterCoreContext)();
7523
7533
  const firstRenderPassedRef = (0, import_react29.useRef)(false);
7524
7534
  const tabsRef = (0, import_react29.useRef)({});
7525
7535
  const tabsGap = gap ?? (style === "box" ? theme2.styles.gap / 2 : 0);
@@ -7540,12 +7550,15 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
7540
7550
  setSelectedTabId(tabId);
7541
7551
  onChange?.(tabId);
7542
7552
  if (urlQuery) {
7543
- urlQuery.setQuery({
7544
- [name ?? defaultTabName]: tabId
7545
- });
7553
+ urlQuery.setQuery(
7554
+ {
7555
+ [name ?? defaultTabName]: tabId
7556
+ },
7557
+ keepUrlHistory
7558
+ );
7546
7559
  }
7547
7560
  },
7548
- [onChange, name, urlQuery]
7561
+ [onChange, name, urlQuery, keepUrlHistory]
7549
7562
  );
7550
7563
  const width = (0, import_react29.useMemo)(
7551
7564
  () => tabsRef.current[selectedTabId]?.getBoundingClientRect().width ?? 0,