@flipdish/ui-library 0.7.0 → 0.7.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.
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var reactAria = require('react-aria');
5
+
6
+ /**
7
+ * Redirects React Aria overlay portals into a specific DOM container instead of
8
+ * `document.body`. Use for micro-frontends and embedded apps with scoped CSS.
9
+ *
10
+ * @summary redirects React Aria overlay portals into a scoped DOM container
11
+ */
12
+ const PortalContainer = ({ getContainer, children }) => {
13
+ if (!getContainer) {
14
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children });
15
+ }
16
+ return jsxRuntime.jsx(reactAria.UNSAFE_PortalProvider, { getContainer: getContainer, children: children });
17
+ };
18
+
19
+ exports.PortalContainer = PortalContainer;
20
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/providers/PortalContainer/index.tsx"],"sourcesContent":[null],"names":["_jsx","_Fragment","UNSAFE_PortalProvider"],"mappings":";;;;;AA+BA;;;;;AAKG;AACI,MAAM,eAAe,GAAG,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAwB,KAAI;IAClF,IAAI,CAAC,YAAY,EAAE;QACjB,OAAOA,cAAA,CAAAC,mBAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;IACxB;IAEA,OAAOD,cAAA,CAACE,+BAAqB,EAAA,EAAC,YAAY,EAAE,YAAY,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAyB;AAC9F;;;;"}
@@ -0,0 +1,36 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface PortalContainerProps {
3
+ /**
4
+ * Callback that returns the DOM element where React Aria overlays (Modal, Popover,
5
+ * Select, Tooltip, Toast) should portal into. Use this in micro-frontends or
6
+ * embedded apps whose CSS is scoped to a mount subtree (e.g. via
7
+ * `postcss-prefix-selector`) — overlays that portal to `document.body` would land
8
+ * outside the scoped subtree and render unstyled.
9
+ *
10
+ * A callback (rather than an element ref) is required because the container may not
11
+ * exist at module-evaluation time.
12
+ *
13
+ * **Note on the `UNSAFE_` prefix:** Under the hood this wraps React Aria's
14
+ * `UNSAFE_PortalProvider`. The prefix is React Aria's naming convention for escape
15
+ * hatches that override tested defaults — it signals "you are opting out of a
16
+ * default we test against", not a stability or production-readiness warning. It is
17
+ * safe to use in production for light-DOM scoped subtrees. Shadow DOM has a
18
+ * {@link https://github.com/adobe/react-spectrum/issues/8675 known interaction issue}
19
+ * and is out of scope.
20
+ *
21
+ * @example
22
+ * <PortalContainer getContainer={() => document.getElementById('flipdish-micro-frontend')}>
23
+ * <App />
24
+ * </PortalContainer>
25
+ */
26
+ getContainer: (() => HTMLElement | null) | null;
27
+ children: ReactNode;
28
+ }
29
+ /**
30
+ * Redirects React Aria overlay portals into a specific DOM container instead of
31
+ * `document.body`. Use for micro-frontends and embedded apps with scoped CSS.
32
+ *
33
+ * @summary redirects React Aria overlay portals into a scoped DOM container
34
+ */
35
+ export declare const PortalContainer: ({ getContainer, children }: PortalContainerProps) => import("react").JSX.Element;
36
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/PortalContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,YAAY,EAAE,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAChD,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,4BAA4B,oBAAoB,gCAM/E,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { jsx, Fragment } from 'react/jsx-runtime';
2
+ import { UNSAFE_PortalProvider } from 'react-aria';
3
+
4
+ /**
5
+ * Redirects React Aria overlay portals into a specific DOM container instead of
6
+ * `document.body`. Use for micro-frontends and embedded apps with scoped CSS.
7
+ *
8
+ * @summary redirects React Aria overlay portals into a scoped DOM container
9
+ */
10
+ const PortalContainer = ({ getContainer, children }) => {
11
+ if (!getContainer) {
12
+ return jsx(Fragment, { children: children });
13
+ }
14
+ return jsx(UNSAFE_PortalProvider, { getContainer: getContainer, children: children });
15
+ };
16
+
17
+ export { PortalContainer };
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/providers/PortalContainer/index.tsx"],"sourcesContent":[null],"names":["_jsx","_Fragment"],"mappings":";;;AA+BA;;;;;AAKG;AACI,MAAM,eAAe,GAAG,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAwB,KAAI;IAClF,IAAI,CAAC,YAAY,EAAE;QACjB,OAAOA,GAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAI;IACxB;IAEA,OAAOD,GAAA,CAAC,qBAAqB,EAAA,EAAC,YAAY,EAAE,YAAY,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAyB;AAC9F;;;;"}
@@ -2,6 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var ErrorBoundary = require('@flipdish/ui-library/providers/ErrorBoundary');
5
+ var PortalContainer = require('@flipdish/ui-library/providers/PortalContainer');
5
6
  var RouteProvider = require('@flipdish/ui-library/providers/RouteProvider');
6
7
  var ThemeProvider = require('@flipdish/ui-library/providers/ThemeProvider');
7
8
  var reactRouter = require('react-router');
@@ -9,12 +10,12 @@ var reactRouter = require('react-router');
9
10
  /**
10
11
  * @summary single entry-point provider that composes theme, routing, and an error boundary for consuming apps
11
12
  */
12
- const UIProvider = ({ children, themeModeOverride, baseUrl, errorBoundary }) => {
13
+ const UIProvider = ({ children, themeModeOverride, baseUrl, errorBoundary, portalContainer }) => {
13
14
  // TODO(i18n): add an internal library translation context so ui-library components can
14
15
  // source their own copy (e.g. ErrorBoundary's "Something went wrong") without the
15
16
  // consuming app needing to pass text props. This is purely internal — consuming apps
16
17
  // 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 }) }) }) }));
18
+ 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: jsxRuntime.jsx(PortalContainer.PortalContainer, { getContainer: portalContainer ?? null, children: children }) }) }) }) }));
18
19
  };
19
20
 
20
21
  exports.UIProvider = UIProvider;
@@ -1 +1 @@
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
+ {"version":3,"file":"index.cjs","sources":["../../../src/providers/UIProvider/index.tsx"],"sourcesContent":[null],"names":["_jsx","ThemeProvider","BrowserRouter","RouteProvider","ErrorBoundary","PortalContainer"],"mappings":";;;;;;;;;AAyCA;;AAEG;AACI,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAsC,KAAI;;;;;AAKzI,IAAA,QACEA,cAAA,CAACC,2BAAa,EAAA,EAAC,iBAAiB,EAAE,iBAAiB,EAAA,QAAA,EACjDD,cAAA,CAACE,yBAAa,IAAC,QAAQ,EAAE,OAAO,EAAA,QAAA,EAC9BF,cAAA,CAACG,2BAAa,EAAA,EAAA,QAAA,EACZH,cAAA,CAACI,2BAAa,EAAA,EAAA,GAAK,aAAa,EAAA,QAAA,EAC9BJ,cAAA,CAACK,+BAAe,EAAA,EAAC,YAAY,EAAE,eAAe,IAAI,IAAI,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAmB,EAAA,CACtE,GACF,EAAA,CACF,EAAA,CACF;AAEpB;;;;"}
@@ -20,9 +20,21 @@ export interface UIProviderProps {
20
20
  * errorBoundary={{ identifier: 'app', onError: datadogReporter }}
21
21
  */
22
22
  errorBoundary: Omit<ErrorBoundaryProps, 'children'>;
23
+ /**
24
+ * Callback that returns the DOM element where React Aria overlays (Modal, Popover,
25
+ * Select, Tooltip, Toast) should portal into. Passed to `PortalContainer`
26
+ * internally — see its docs for full details.
27
+ *
28
+ * Use this in micro-frontends or embedded apps whose CSS is scoped to a mount
29
+ * subtree. Omit to use React Aria's default (`document.body`).
30
+ *
31
+ * @example
32
+ * portalContainer={() => document.getElementById('flipdish-micro-frontend')}
33
+ */
34
+ portalContainer?: (() => HTMLElement | null) | null;
23
35
  }
24
36
  /**
25
37
  * @summary single entry-point provider that composes theme, routing, and an error boundary for consuming apps
26
38
  */
27
- export declare const UIProvider: ({ children, themeModeOverride, baseUrl, errorBoundary }: PropsWithChildren<UIProviderProps>) => import("react").JSX.Element;
39
+ export declare const UIProvider: ({ children, themeModeOverride, baseUrl, errorBoundary, portalContainer }: PropsWithChildren<UIProviderProps>) => import("react").JSX.Element;
28
40
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/UIProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAItG,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;IACpD;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;CACrD;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,0EAA0E,iBAAiB,CAAC,eAAe,CAAC,gCAgBtI,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { ErrorBoundary } from '@flipdish/ui-library/providers/ErrorBoundary';
3
+ import { PortalContainer } from '@flipdish/ui-library/providers/PortalContainer';
3
4
  import { RouteProvider } from '@flipdish/ui-library/providers/RouteProvider';
4
5
  import { ThemeProvider } from '@flipdish/ui-library/providers/ThemeProvider';
5
6
  import { BrowserRouter } from 'react-router';
@@ -7,12 +8,12 @@ import { BrowserRouter } from 'react-router';
7
8
  /**
8
9
  * @summary single entry-point provider that composes theme, routing, and an error boundary for consuming apps
9
10
  */
10
- const UIProvider = ({ children, themeModeOverride, baseUrl, errorBoundary }) => {
11
+ const UIProvider = ({ children, themeModeOverride, baseUrl, errorBoundary, portalContainer }) => {
11
12
  // TODO(i18n): add an internal library translation context so ui-library components can
12
13
  // source their own copy (e.g. ErrorBoundary's "Something went wrong") without the
13
14
  // consuming app needing to pass text props. This is purely internal — consuming apps
14
15
  // 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 }) }) }) }));
16
+ return (jsx(ThemeProvider, { themeModeOverride: themeModeOverride, children: jsx(BrowserRouter, { basename: baseUrl, children: jsx(RouteProvider, { children: jsx(ErrorBoundary, { ...errorBoundary, children: jsx(PortalContainer, { getContainer: portalContainer ?? null, children: children }) }) }) }) }));
16
17
  };
17
18
 
18
19
  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,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;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/providers/UIProvider/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;;;;AAyCA;;AAEG;AACI,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAsC,KAAI;;;;;AAKzI,IAAA,QACEA,GAAA,CAAC,aAAa,EAAA,EAAC,iBAAiB,EAAE,iBAAiB,EAAA,QAAA,EACjDA,GAAA,CAAC,aAAa,IAAC,QAAQ,EAAE,OAAO,EAAA,QAAA,EAC9BA,GAAA,CAAC,aAAa,EAAA,EAAA,QAAA,EACZA,GAAA,CAAC,aAAa,EAAA,EAAA,GAAK,aAAa,EAAA,QAAA,EAC9BA,GAAA,CAAC,eAAe,EAAA,EAAC,YAAY,EAAE,eAAe,IAAI,IAAI,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAmB,EAAA,CACtE,GACF,EAAA,CACF,EAAA,CACF;AAEpB;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/ui-library",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "Flipdish Design System — atomic-design component library (Tailwind v4 + UntitledUI + React Aria).",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -88,6 +88,7 @@
88
88
  "postcss-prefix-selector": "^2.1.1",
89
89
  "qr-code-styling": "^1.9.2",
90
90
  "react": "^19.0.0",
91
+ "react-aria": "^3.49.0",
91
92
  "react-aria-components": "^1.18.0",
92
93
  "react-dom": "^19.0.0",
93
94
  "react-hotkeys-hook": "^5.3.2",
@@ -150,6 +151,9 @@
150
151
  "qr-code-styling": {
151
152
  "optional": true
152
153
  },
154
+ "react-aria": {
155
+ "optional": true
156
+ },
153
157
  "react-aria-components": {
154
158
  "optional": true
155
159
  },
@@ -198,6 +202,7 @@
198
202
  "motion": "^12.40.0",
199
203
  "qr-code-styling": "^1.9.2",
200
204
  "react": "^19.0.0",
205
+ "react-aria": "^3.49.0",
201
206
  "react-aria-components": "^1.18.0",
202
207
  "react-dom": "^19.0.0",
203
208
  "react-hotkeys-hook": "^5.3.2",