@flipdish/ui-library 0.4.3 → 0.5.0

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.
@@ -1,28 +1,20 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
+ var ErrorBoundary = require('@flipdish/ui-library/providers/ErrorBoundary');
4
5
  var RouteProvider = require('@flipdish/ui-library/providers/RouteProvider');
5
6
  var ThemeProvider = require('@flipdish/ui-library/providers/ThemeProvider');
6
7
  var reactRouter = require('react-router');
7
8
 
8
9
  /**
9
- * @summary single entry-point provider that composes the Flipdish UI providers (theme, routing, and soon translations)
10
+ * @summary single entry-point provider that composes theme, routing, and an error boundary for consuming apps
10
11
  */
11
- const UIProvider = ({ children, themeModeOverride, withBrowserRouter = true, withRouteProvider = true, }) => {
12
- let tree = children;
13
- // RouteProvider must sit inside a router; keep it innermost so it can bind to
14
- // either our BrowserRouter or a host-owned one.
15
- if (withRouteProvider) {
16
- tree = jsxRuntime.jsx(RouteProvider.RouteProvider, { children: tree });
17
- }
18
- if (withBrowserRouter) {
19
- tree = jsxRuntime.jsx(reactRouter.BrowserRouter, { children: tree });
20
- }
21
- // TODO(i18n): wrap `tree` in <TranslationProvider> once the translation layer lands.
22
- // It will likely expose an async `useLoadTranslations(languageOverride)` hook (see
23
- // FlipdishUI's FlipdishUIProvider) and a `languageOverride` prop forwarded from here.
24
- // Order: ThemeProvider > [BrowserRouter > RouteProvider] > TranslationProvider > children.
25
- return jsxRuntime.jsx(ThemeProvider.ThemeProvider, { themeModeOverride: themeModeOverride, children: tree });
12
+ const UIProvider = ({ children, themeModeOverride, baseUrl, errorBoundary }) => {
13
+ // TODO(i18n): add an internal library translation context so ui-library components can
14
+ // source their own copy (e.g. ErrorBoundary's "Something went wrong") without the
15
+ // consuming app needing to pass text props. This is purely internal — consuming apps
16
+ // own their own translation layer and wrap their content inside UIProvider as usual.
17
+ return (jsxRuntime.jsx(ThemeProvider.ThemeProvider, { themeModeOverride: themeModeOverride, children: jsxRuntime.jsx(reactRouter.BrowserRouter, { basename: baseUrl, children: jsxRuntime.jsx(RouteProvider.RouteProvider, { children: jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, { ...errorBoundary, children: children }) }) }) }));
26
18
  };
27
19
 
28
20
  exports.UIProvider = UIProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/providers/UIProvider/index.tsx"],"sourcesContent":[null],"names":["_jsx","RouteProvider","BrowserRouter","ThemeProvider"],"mappings":";;;;;;;AA4BA;;AAEG;AACI,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,GAAG,IAAI,EACxB,iBAAiB,GAAG,IAAI,GACW,KAAI;IACvC,IAAI,IAAI,GAAG,QAAQ;;;IAInB,IAAI,iBAAiB,EAAE;AACrB,QAAA,IAAI,GAAGA,cAAA,CAACC,2BAAa,EAAA,EAAA,QAAA,EAAE,IAAI,GAAiB;IAC9C;IAEA,IAAI,iBAAiB,EAAE;AACrB,QAAA,IAAI,GAAGD,cAAA,CAACE,yBAAa,EAAA,EAAA,QAAA,EAAE,IAAI,GAAiB;IAC9C;;;;;IAMA,OAAOF,cAAA,CAACG,2BAAa,EAAA,EAAC,iBAAiB,EAAE,iBAAiB,EAAA,QAAA,EAAG,IAAI,EAAA,CAAiB;AACpF;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/providers/UIProvider/index.tsx"],"sourcesContent":[null],"names":["_jsx","ThemeProvider","BrowserRouter","RouteProvider","ErrorBoundary"],"mappings":";;;;;;;;AA4BA;;AAEG;AACI,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,aAAa,EAAsC,KAAI;;;;;AAKxH,IAAA,QACEA,cAAA,CAACC,2BAAa,EAAA,EAAC,iBAAiB,EAAE,iBAAiB,EAAA,QAAA,EACjDD,cAAA,CAACE,yBAAa,EAAA,EAAC,QAAQ,EAAE,OAAO,EAAA,QAAA,EAC9BF,cAAA,CAACG,2BAAa,EAAA,EAAA,QAAA,EACZH,cAAA,CAACI,2BAAa,EAAA,EAAA,GAAK,aAAa,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAiB,EAAA,CAC9C,EAAA,CACF,EAAA,CACF;AAEpB;;;;"}
@@ -1,3 +1,4 @@
1
+ import { type ErrorBoundaryProps } from '@flipdish/ui-library/providers/ErrorBoundary';
1
2
  import type { PropsWithChildren } from 'react';
2
3
  export interface UIProviderProps {
3
4
  /**
@@ -6,23 +7,22 @@ export interface UIProviderProps {
6
7
  */
7
8
  themeModeOverride?: 'light' | 'dark';
8
9
  /**
9
- * Render a `BrowserRouter`. Set `false` when a host/parent app already owns a
10
- * router (e.g. a micro-frontend mounted in a shell, or an app using react-router's
11
- * data APIs via `createBrowserRouter`) — a second router would fight over the URL.
12
- * @default true
10
+ * Base URL for the internal router. Use for micro-frontends mounted at a sub-path
11
+ * (e.g. `getMicroFrontendAttribute('data-portal-base-url') || '/'`).
13
12
  */
14
- withBrowserRouter?: boolean;
13
+ baseUrl?: string;
15
14
  /**
16
- * Wire react-aria-components navigation into react-router (so `<Link>`, etc. use
17
- * client-side navigation). Keep `true` even when `withBrowserRouter` is `false`, so
18
- * react-aria routing binds to the host's router. Set `false` only for non-routed
19
- * surfaces (single-screen apps, some test/Storybook setups).
20
- * @default true
15
+ * Props for the app-level `ErrorBoundary` that wraps children.
16
+ * At minimum pass `identifier` (e.g. `'app'`) to label the boundary in error
17
+ * logs. Wire `onError` to your error reporter (Datadog RUM, fdlogger, etc.).
18
+ *
19
+ * @example
20
+ * errorBoundary={{ identifier: 'app', onError: datadogReporter }}
21
21
  */
22
- withRouteProvider?: boolean;
22
+ errorBoundary: Omit<ErrorBoundaryProps, 'children'>;
23
23
  }
24
24
  /**
25
- * @summary single entry-point provider that composes the Flipdish UI providers (theme, routing, and soon translations)
25
+ * @summary single entry-point provider that composes theme, routing, and an error boundary for consuming apps
26
26
  */
27
- export declare const UIProvider: ({ children, themeModeOverride, withBrowserRouter, withRouteProvider, }: PropsWithChildren<UIProviderProps>) => import("react").JSX.Element;
27
+ export declare const UIProvider: ({ children, themeModeOverride, baseUrl, errorBoundary }: PropsWithChildren<UIProviderProps>) => import("react").JSX.Element;
28
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/UIProvider/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACrC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,wEAKxB,iBAAiB,CAAC,eAAe,CAAC,gCAkBpC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/UIProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAGtG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;OAOG;IACH,aAAa,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,yDAAyD,iBAAiB,CAAC,eAAe,CAAC,gCAcrH,CAAC"}
@@ -1,26 +1,18 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
+ import { ErrorBoundary } from '@flipdish/ui-library/providers/ErrorBoundary';
2
3
  import { RouteProvider } from '@flipdish/ui-library/providers/RouteProvider';
3
4
  import { ThemeProvider } from '@flipdish/ui-library/providers/ThemeProvider';
4
5
  import { BrowserRouter } from 'react-router';
5
6
 
6
7
  /**
7
- * @summary single entry-point provider that composes the Flipdish UI providers (theme, routing, and soon translations)
8
+ * @summary single entry-point provider that composes theme, routing, and an error boundary for consuming apps
8
9
  */
9
- const UIProvider = ({ children, themeModeOverride, withBrowserRouter = true, withRouteProvider = true, }) => {
10
- let tree = children;
11
- // RouteProvider must sit inside a router; keep it innermost so it can bind to
12
- // either our BrowserRouter or a host-owned one.
13
- if (withRouteProvider) {
14
- tree = jsx(RouteProvider, { children: tree });
15
- }
16
- if (withBrowserRouter) {
17
- tree = jsx(BrowserRouter, { children: tree });
18
- }
19
- // TODO(i18n): wrap `tree` in <TranslationProvider> once the translation layer lands.
20
- // It will likely expose an async `useLoadTranslations(languageOverride)` hook (see
21
- // FlipdishUI's FlipdishUIProvider) and a `languageOverride` prop forwarded from here.
22
- // Order: ThemeProvider > [BrowserRouter > RouteProvider] > TranslationProvider > children.
23
- return jsx(ThemeProvider, { themeModeOverride: themeModeOverride, children: tree });
10
+ const UIProvider = ({ children, themeModeOverride, baseUrl, errorBoundary }) => {
11
+ // TODO(i18n): add an internal library translation context so ui-library components can
12
+ // source their own copy (e.g. ErrorBoundary's "Something went wrong") without the
13
+ // consuming app needing to pass text props. This is purely internal — consuming apps
14
+ // own their own translation layer and wrap their content inside UIProvider as usual.
15
+ return (jsx(ThemeProvider, { themeModeOverride: themeModeOverride, children: jsx(BrowserRouter, { basename: baseUrl, children: jsx(RouteProvider, { children: jsx(ErrorBoundary, { ...errorBoundary, children: children }) }) }) }));
24
16
  };
25
17
 
26
18
  export { UIProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/providers/UIProvider/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;AA4BA;;AAEG;AACI,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,GAAG,IAAI,EACxB,iBAAiB,GAAG,IAAI,GACW,KAAI;IACvC,IAAI,IAAI,GAAG,QAAQ;;;IAInB,IAAI,iBAAiB,EAAE;AACrB,QAAA,IAAI,GAAGA,GAAA,CAAC,aAAa,EAAA,EAAA,QAAA,EAAE,IAAI,GAAiB;IAC9C;IAEA,IAAI,iBAAiB,EAAE;AACrB,QAAA,IAAI,GAAGA,GAAA,CAAC,aAAa,EAAA,EAAA,QAAA,EAAE,IAAI,GAAiB;IAC9C;;;;;IAMA,OAAOA,GAAA,CAAC,aAAa,EAAA,EAAC,iBAAiB,EAAE,iBAAiB,EAAA,QAAA,EAAG,IAAI,EAAA,CAAiB;AACpF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/providers/UIProvider/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;AA4BA;;AAEG;AACI,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,aAAa,EAAsC,KAAI;;;;;AAKxH,IAAA,QACEA,GAAA,CAAC,aAAa,EAAA,EAAC,iBAAiB,EAAE,iBAAiB,EAAA,QAAA,EACjDA,GAAA,CAAC,aAAa,EAAA,EAAC,QAAQ,EAAE,OAAO,EAAA,QAAA,EAC9BA,GAAA,CAAC,aAAa,EAAA,EAAA,QAAA,EACZA,GAAA,CAAC,aAAa,EAAA,EAAA,GAAK,aAAa,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAiB,EAAA,CAC9C,EAAA,CACF,EAAA,CACF;AAEpB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/ui-library",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "description": "Flipdish Design System — atomic-design component library (Tailwind v4 + UntitledUI + React Aria).",
5
5
  "type": "module",
6
6
  "sideEffects": [