react-better-html 1.1.162 → 1.1.163

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
@@ -9,6 +9,7 @@ var isMobileDevice = /Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Op
9
9
 
10
10
  // src/utils/hooks.ts
11
11
  import { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef2, useState as useState3 } from "react";
12
+ import { createSearchParams, useInRouterContext, useNavigate, useSearchParams } from "react-router-dom";
12
13
 
13
14
  // src/constants/css.ts
14
15
  var cssProps = {
@@ -1546,10 +1547,7 @@ var alertsPlugin = (options) => ({
1546
1547
  });
1547
1548
 
1548
1549
  // src/plugins/reactRouterDom.ts
1549
- import * as reactRouterDomLib from "react-router-dom";
1550
- var defaultReactRouterDomPluginOptions = {
1551
- reactRouterDomLib
1552
- };
1550
+ var defaultReactRouterDomPluginOptions = {};
1553
1551
  var reactRouterDomPlugin = (options) => ({
1554
1552
  name: "react-router-dom",
1555
1553
  initialize: () => {
@@ -3060,15 +3058,14 @@ function useUrlQuery() {
3060
3058
  "`useUrlQuery` hook requires the `react-router-dom` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
3061
3059
  );
3062
3060
  }
3063
- const reactRouterDomPluginConfig = reactRouterDomPlugin2.getConfig();
3064
- const isInRouterContext = reactRouterDomPluginConfig.reactRouterDomLib.useInRouterContext();
3061
+ const isInRouterContext = useInRouterContext();
3065
3062
  if (!isInRouterContext) {
3066
3063
  throw new Error(
3067
3064
  "`useUrlQuery` hook must be used inside a React Router context. Make sure your component is wrapped in a `<BrowserRouter>`, or another Router component."
3068
3065
  );
3069
3066
  }
3070
- const navigate = reactRouterDomPluginConfig.reactRouterDomLib.useNavigate();
3071
- const [searchParams] = reactRouterDomPluginConfig.reactRouterDomLib.useSearchParams();
3067
+ const navigate = useNavigate();
3068
+ const [searchParams] = useSearchParams();
3072
3069
  const setQuery = useCallback4(
3073
3070
  (query, keepHistory = true) => {
3074
3071
  const currentSearchParams = {};
@@ -3077,7 +3074,7 @@ function useUrlQuery() {
3077
3074
  });
3078
3075
  navigate(
3079
3076
  {
3080
- search: reactRouterDomPluginConfig.reactRouterDomLib.createSearchParams({
3077
+ search: createSearchParams({
3081
3078
  ...currentSearchParams,
3082
3079
  ...Object.fromEntries(Object.entries(query).map(([key, value]) => [key, value.toString()]))
3083
3080
  }).toString()