clear-react-router 2.4.2 → 2.4.3

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/README.md CHANGED
@@ -234,9 +234,44 @@ import { Button } from '@mui/material';
234
234
  To about page
235
235
  </Link>
236
236
  ```
237
+ ### Styling link states with CSS
238
+
239
+ Before reaching for `as`, check whether CSS is enough: active and loading states are already
240
+ in the DOM — `Link` sets `aria-current="page"` on the active link (plus your `activeClassName`)
241
+ and `aria-busy="true"` while the target is loading. Attribute selectors cover most custom
242
+ designs with zero JS, keeping the native `<a>` semantics (keyboard focus, right-click,
243
+ screen readers) intact:
244
+
245
+ ```tsx
246
+ <Link to="/playground/settings" aria-label="Settings" className="gear-link">
247
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" aria-hidden="true">
248
+ <path d="..." />
249
+ </svg>
250
+ </Link>
251
+ ```
252
+
253
+ ```css
254
+ /* Active page — no state plumbing needed */
255
+ .gear-link[aria-current='page'] {
256
+ color: steelblue;
257
+ }
258
+ /* CSS beats SVG presentation attributes (fill="none"), so this fills the icon: */
259
+ .gear-link[aria-current='page'] svg {
260
+ fill: steelblue;
261
+ stroke: steelblue;
262
+ }
263
+ /* Target is loading: */
264
+ .gear-link[aria-busy='true'] {
265
+ opacity: 0.6;
266
+ }
267
+ ```
268
+
269
+ Reach for `as` only when the element itself must change (a `<button>`, a UI-kit component)
270
+ — for looks alone, attributes + CSS are simpler and accessible by default.
271
+
237
272
  ```tsx
238
273
  // Global prefetch: hover with 100ms delay
239
- <Router routes={routes} defaultPrefetchh="hover" defaultHoverPrefetchDelay={100} />
274
+ <Router routes={routes} defaultPrefetch="hover" defaultHoverPrefetchDelay={100} />
240
275
 
241
276
  // Override for a specific link
242
277
  <Link to="/heavy-page" prefetch="viewport">
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ var EMPTY_LOADER_STATE = {};
46
46
  var WINDOW_TOP = "__window_top__";
47
47
  var WINDOW_LEFT = "__window_left__";
48
48
  //#endregion
49
- //#region \0@oxc-project+runtime@0.132.0/helpers/typeof.js
49
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/typeof.js
50
50
  function _typeof(o) {
51
51
  "@babel/helpers - typeof";
52
52
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -56,7 +56,7 @@ function _typeof(o) {
56
56
  }, _typeof(o);
57
57
  }
58
58
  //#endregion
59
- //#region \0@oxc-project+runtime@0.132.0/helpers/toPrimitive.js
59
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/toPrimitive.js
60
60
  function toPrimitive(t, r) {
61
61
  if ("object" != _typeof(t) || !t) return t;
62
62
  var e = t[Symbol.toPrimitive];
@@ -68,13 +68,13 @@ function toPrimitive(t, r) {
68
68
  return ("string" === r ? String : Number)(t);
69
69
  }
70
70
  //#endregion
71
- //#region \0@oxc-project+runtime@0.132.0/helpers/toPropertyKey.js
71
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/toPropertyKey.js
72
72
  function toPropertyKey(t) {
73
73
  var i = toPrimitive(t, "string");
74
74
  return "symbol" == _typeof(i) ? i : i + "";
75
75
  }
76
76
  //#endregion
77
- //#region \0@oxc-project+runtime@0.132.0/helpers/defineProperty.js
77
+ //#region \0@oxc-project+runtime@0.152.0/helpers/esm/defineProperty.js
78
78
  function _defineProperty(e, r, t) {
79
79
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
80
80
  value: t,
@@ -1097,8 +1097,10 @@ var useSearchParams = () => {
1097
1097
  currentParams.delete(param);
1098
1098
  (Array.isArray(value) ? value : [value]).forEach((v) => currentParams.append(param, v));
1099
1099
  navigateWithSearchParams(currentParams);
1100
- } else if (typeof param === "function") navigateWithSearchParams(param(currentParams));
1101
- else throw new Error("useSearchParams first argument must be either function or string");
1100
+ } else if (typeof param === "function") {
1101
+ const newParams = param(currentParams);
1102
+ navigateWithSearchParams(newParams);
1103
+ } else throw new Error("useSearchParams first argument must be either function or string");
1102
1104
  }, [navigateWithSearchParams, searchRef])
1103
1105
  };
1104
1106
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clear-react-router",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "description": "A lightweight routing library for React applications",
5
5
  "author": "Andrew Bubnov",
6
6
  "scripts": {