@skyhook-io/radar-app 1.8.3 → 1.8.5

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.
@@ -0,0 +1,30 @@
1
+ import { useCallback, useMemo, useRef, type ReactNode } from 'react';
2
+ import { useSearchParams } from 'react-router-dom';
3
+ import { FilterLocationProvider, type FilterLocation } from '@skyhook-io/k8s-ui';
4
+
5
+ // Adapts OSS Radar's react-router search params to the app-agnostic
6
+ // FilterLocation seam that @skyhook-io/k8s-ui's useFilterState reads. Mounted
7
+ // once inside the router; every list view's shared filter state flows through
8
+ // it, keeping the URL the single source of truth. (Radar Hub provides its own
9
+ // bridge over its router — k8s-ui itself never depends on react-router.)
10
+ export function FilterLocationBridge({ children }: { children: ReactNode }) {
11
+ const [searchParams, setSearchParams] = useSearchParams();
12
+
13
+ // React Router's functional updater is NOT state-queued: two updates in one
14
+ // tick can both read the same params and clobber. Advance a ref synchronously
15
+ // so successive filter changes (e.g. toggling two facets fast) compose.
16
+ const latest = useRef(searchParams);
17
+ latest.current = searchParams;
18
+
19
+ const update = useCallback<FilterLocation['update']>(
20
+ (updater, opts) => {
21
+ const next = updater(new URLSearchParams(latest.current));
22
+ latest.current = next;
23
+ setSearchParams(next, opts);
24
+ },
25
+ [setSearchParams],
26
+ );
27
+
28
+ const value = useMemo<FilterLocation>(() => ({ searchParams, update }), [searchParams, update]);
29
+ return <FilterLocationProvider value={value}>{children}</FilterLocationProvider>;
30
+ }
@@ -3,5 +3,6 @@ export {
3
3
  useRegisterShortcut,
4
4
  useRegisterShortcuts,
5
5
  useActiveShortcuts,
6
+ useSuppressBaseShortcuts,
6
7
  } from '@skyhook-io/k8s-ui'
7
8
  export type { KeyboardShortcut, ShortcutCategory } from '@skyhook-io/k8s-ui'
package/src/index.ts CHANGED
@@ -23,6 +23,21 @@ export { ShortcutHelpOverlay } from './components/ui/ShortcutHelpOverlay';
23
23
  export { ClusterSwitcher } from '@skyhook-io/k8s-ui';
24
24
  export type { ClusterSwitcherProps, ClusterSwitcherItem } from '@skyhook-io/k8s-ui';
25
25
 
26
+ // Shared namespace-scope picker primitive — re-exported so embedders (Radar
27
+ // Hub) can render a namespace filter visually identical to OSS Radar's, driving
28
+ // their own per-cluster scope (Hub via ?namespaces= on the embedded RadarApp).
29
+ export { NamespacePicker } from '@skyhook-io/k8s-ui';
30
+ export type {
31
+ NamespacePickerProps,
32
+ NamespacePickerHandle,
33
+ NamespaceScopeView,
34
+ } from '@skyhook-io/k8s-ui';
35
+
36
+ // Shared bordered shell that groups the cluster + namespace segments into one
37
+ // pill — so Radar Hub's cluster top bar matches OSS Radar's header exactly.
38
+ export { ScopePill } from '@skyhook-io/k8s-ui';
39
+ export type { ScopePillProps } from '@skyhook-io/k8s-ui';
40
+
26
41
  // Deep-link builders — so consumers (Radar Hub) construct deep links into a
27
42
  // cluster view without hand-rolling Radar's internal URL format, which drifts
28
43
  // silently when Radar re-routes. `resourcePath` opens the detail drawer for any