@refraction-ui/react 0.9.0 → 0.9.2

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,4 +1,4 @@
1
- import { cn, devWarn, cva, createKeyboardHandler, Keys, createMachine, generateId } from './chunk-O4453CBF.js';
1
+ import { cn, devWarn, cva, createKeyboardHandler, Keys, createMachine, generateId } from './chunk-VZLV27H2.js';
2
2
  export { createFaroSink } from './chunk-XWP763SH.js';
3
3
  import * as React11 from 'react';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -15476,6 +15476,10 @@ async function startSessionReplay(options) {
15476
15476
 
15477
15477
  // ../react-analytics/dist/index.js
15478
15478
  var AnalyticsContext = React11.createContext(null);
15479
+ var noopAnalytics = null;
15480
+ function getNoopAnalytics() {
15481
+ return noopAnalytics ??= createNoopAnalytics();
15482
+ }
15479
15483
  function AnalyticsProvider({ children, value }) {
15480
15484
  const analyticsRef = React11.useRef(null);
15481
15485
  if (!analyticsRef.current) {
@@ -15489,17 +15493,18 @@ function AnalyticsProvider({ children, value }) {
15489
15493
  }
15490
15494
  function useAnalytics(options) {
15491
15495
  const ctx = React11.useContext(AnalyticsContext);
15492
- if (!ctx) {
15496
+ let base = ctx;
15497
+ if (!base) {
15493
15498
  devWarn(
15494
15499
  "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."
15500
+ "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
15501
  );
15497
- throw new Error("useAnalytics must be used within an <AnalyticsProvider>");
15502
+ base = getNoopAnalytics();
15498
15503
  }
15499
15504
  const scope = options?.scope;
15500
15505
  return React11.useMemo(
15501
- () => scope ? ctx.with(scope) : ctx,
15502
- [ctx, scope]
15506
+ () => scope ? base.with(scope) : base,
15507
+ [base, scope]
15503
15508
  );
15504
15509
  }
15505
15510
  function useTrackEvent(options) {