@refraction-ui/react 0.9.1 → 0.9.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/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { cn, devWarn, cva, createKeyboardHandler, Keys, createMachine, generateId } from './chunk-VZLV27H2.js';
2
3
  export { createFaroSink } from './chunk-XWP763SH.js';
3
4
  import * as React11 from 'react';
@@ -15476,6 +15477,10 @@ async function startSessionReplay(options) {
15476
15477
 
15477
15478
  // ../react-analytics/dist/index.js
15478
15479
  var AnalyticsContext = React11.createContext(null);
15480
+ var noopAnalytics = null;
15481
+ function getNoopAnalytics() {
15482
+ return noopAnalytics ??= createNoopAnalytics();
15483
+ }
15479
15484
  function AnalyticsProvider({ children, value }) {
15480
15485
  const analyticsRef = React11.useRef(null);
15481
15486
  if (!analyticsRef.current) {
@@ -15489,17 +15494,18 @@ function AnalyticsProvider({ children, value }) {
15489
15494
  }
15490
15495
  function useAnalytics(options) {
15491
15496
  const ctx = React11.useContext(AnalyticsContext);
15492
- if (!ctx) {
15497
+ let base = ctx;
15498
+ if (!base) {
15493
15499
  devWarn(
15494
15500
  "react-analytics/use-analytics-outside-provider",
15495
- "useAnalytics() was called outside an <AnalyticsProvider>. Wrap your app (or the consuming subtree) in <AnalyticsProvider> so the analytics context is available."
15501
+ "useAnalytics() (or useTrackEvent()) was called outside an <AnalyticsProvider>. Analytics is a no-op here; wrap your app (or the consuming subtree) in <AnalyticsProvider> to enable it."
15496
15502
  );
15497
- throw new Error("useAnalytics must be used within an <AnalyticsProvider>");
15503
+ base = getNoopAnalytics();
15498
15504
  }
15499
15505
  const scope = options?.scope;
15500
15506
  return React11.useMemo(
15501
- () => scope ? ctx.with(scope) : ctx,
15502
- [ctx, scope]
15507
+ () => scope ? base.with(scope) : base,
15508
+ [base, scope]
15503
15509
  );
15504
15510
  }
15505
15511
  function useTrackEvent(options) {