@flipdish/ui-library 0.4.2 → 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.
- package/README.md +9 -47
- package/dist/providers/UIProvider/index.cjs +21 -0
- package/dist/providers/UIProvider/index.cjs.map +1 -0
- package/dist/providers/UIProvider/index.d.ts +28 -0
- package/dist/providers/UIProvider/index.d.ts.map +1 -0
- package/dist/providers/UIProvider/index.js +19 -0
- package/dist/providers/UIProvider/index.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,12 +15,12 @@ Atomic-design React component library for Flipdish products, built on **Tailwind
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
pnpm add @flipdish/ui-library
|
|
18
|
+
pnpm add @flipdish/ui-library @flipdish/ui-tokens @flipdish/ui-icons
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
For the full setup walkthrough (Vite config, CSS entry, providers, first component), see [Getting Started → Installation](https://flipdishbytes.github.io/flipdish-design-system/?path=/docs/getting-started-installation--docs).
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
### Peer dependencies
|
|
24
24
|
|
|
25
25
|
**Shared — required on every platform:**
|
|
26
26
|
|
|
@@ -50,7 +50,7 @@ Install the peers for the platform(s) you target. Platform-specific peers are de
|
|
|
50
50
|
|
|
51
51
|
### Component-specific peer dependencies
|
|
52
52
|
|
|
53
|
-
A handful of components are backed by larger third-party libraries
|
|
53
|
+
A handful of components are backed by larger third-party libraries declared as **optional** peers — importing `Button` never pulls in the charting or rich-text stack. Install only the peer(s) for the components you actually use; a missing peer causes a build/runtime error.
|
|
54
54
|
|
|
55
55
|
| Component | Required peer(s) |
|
|
56
56
|
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
@@ -63,61 +63,23 @@ A handful of components are backed by larger third-party libraries. Those librar
|
|
|
63
63
|
| `CommandMenu` | `react-hotkeys-hook` |
|
|
64
64
|
| `FileUpload`, `SidebarNavigation` | `motion` |
|
|
65
65
|
|
|
66
|
-
For example, to use the rich-text editor:
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
pnpm add @tiptap/core @tiptap/pm @tiptap/react @tiptap/starter-kit @tiptap/extension-image @tiptap/extension-placeholder @tiptap/extension-text-align @tiptap/extension-text-style
|
|
70
|
-
```
|
|
71
|
-
|
|
72
66
|
## Tailwind setup
|
|
73
67
|
|
|
74
|
-
|
|
68
|
+
Import the library's shared runtime from your CSS entry **in this exact layer order**:
|
|
75
69
|
|
|
76
70
|
```css
|
|
77
71
|
@layer theme, base, components, utilities;
|
|
78
72
|
|
|
79
73
|
@import "tailwindcss/theme.css" layer(theme);
|
|
80
|
-
@import "@flipdish/ui-tokens/css" layer(theme);
|
|
74
|
+
@import "@flipdish/ui-tokens/css" layer(theme);
|
|
81
75
|
@import "tailwindcss/preflight.css" layer(base);
|
|
82
|
-
@import "@flipdish/ui-library/styles";
|
|
76
|
+
@import "@flipdish/ui-library/styles";
|
|
83
77
|
@import "tailwindcss/utilities.css" layer(utilities);
|
|
84
78
|
```
|
|
85
79
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
## Usage
|
|
89
|
-
|
|
90
|
-
Components, providers, hooks, and utilities are imported from subpaths that mirror the atomic-design layers:
|
|
91
|
-
|
|
92
|
-
```ts
|
|
93
|
-
// Components — components/<atoms|molecules|organisms|templates>/<Name>
|
|
94
|
-
import { Button } from "@flipdish/ui-library/components/atoms/Button";
|
|
95
|
-
import { NotFoundPage } from "@flipdish/ui-library/components/templates/NotFoundPage";
|
|
96
|
-
|
|
97
|
-
// Providers — cross-cutting behavioural wrappers
|
|
98
|
-
import { ThemeProvider } from "@flipdish/ui-library/providers/ThemeProvider";
|
|
99
|
-
import { RouteProvider } from "@flipdish/ui-library/providers/RouteProvider";
|
|
100
|
-
import { ErrorBoundary } from "@flipdish/ui-library/providers/ErrorBoundary";
|
|
101
|
-
|
|
102
|
-
// Hooks
|
|
103
|
-
import { useBreakpoint } from "@flipdish/ui-library/hooks/useBreakpoints";
|
|
104
|
-
import { useClipboard } from "@flipdish/ui-library/hooks/useClipboard";
|
|
105
|
-
|
|
106
|
-
// Utilities
|
|
107
|
-
import { cx, sortCx } from "@flipdish/ui-library/utilities/cx";
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Styling rules
|
|
111
|
-
|
|
112
|
-
Use **semantic** token utilities only (`bg-primary`, `text-secondary`, `border-primary`, `bg-brand-solid`, …) — never primitive ramp utilities (`bg-blue-500`) or raw `var(--…)` in `style`. Semantic tokens swap automatically under `[data-theme="dark"]`; primitives don't.
|
|
113
|
-
|
|
114
|
-
## Platform support (web + React Native)
|
|
115
|
-
|
|
116
|
-
The component API, `tailwind-variants` configs, and `cx`/`sortCx` are shared across platforms; primitives and accessibility libraries diverge via a `.tsx` (web) + `.native.tsx` (RN) file split.
|
|
117
|
-
|
|
118
|
-
`react-aria-components` (which Untitled UI is built on) is **web-only**, so a component is React Native-ready only once it ships an `index.native.tsx` sibling. The presence of that file is the source of truth — Metro resolves `index.native.tsx` automatically, while web bundlers use the `index.tsx`.
|
|
80
|
+
## Documentation
|
|
119
81
|
|
|
120
|
-
|
|
82
|
+
Full component docs, interactive examples, and design guidance live in the [Storybook](https://flipdishbytes.github.io/flipdish-design-system/).
|
|
121
83
|
|
|
122
84
|
## Changelog
|
|
123
85
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var ErrorBoundary = require('@flipdish/ui-library/providers/ErrorBoundary');
|
|
5
|
+
var RouteProvider = require('@flipdish/ui-library/providers/RouteProvider');
|
|
6
|
+
var ThemeProvider = require('@flipdish/ui-library/providers/ThemeProvider');
|
|
7
|
+
var reactRouter = require('react-router');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @summary single entry-point provider that composes theme, routing, and an error boundary for consuming apps
|
|
11
|
+
*/
|
|
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 }) }) }) }));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.UIProvider = UIProvider;
|
|
21
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +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;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ErrorBoundaryProps } from '@flipdish/ui-library/providers/ErrorBoundary';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
export interface UIProviderProps {
|
|
4
|
+
/**
|
|
5
|
+
* Controlled theme override. When set, the tree renders in this mode and theme
|
|
6
|
+
* persistence is skipped. Omit to use ThemeProvider's own light/dark/system logic.
|
|
7
|
+
*/
|
|
8
|
+
themeModeOverride?: 'light' | 'dark';
|
|
9
|
+
/**
|
|
10
|
+
* Base URL for the internal router. Use for micro-frontends mounted at a sub-path
|
|
11
|
+
* (e.g. `getMicroFrontendAttribute('data-portal-base-url') || '/'`).
|
|
12
|
+
*/
|
|
13
|
+
baseUrl?: string;
|
|
14
|
+
/**
|
|
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
|
+
*/
|
|
22
|
+
errorBoundary: Omit<ErrorBoundaryProps, 'children'>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @summary single entry-point provider that composes theme, routing, and an error boundary for consuming apps
|
|
26
|
+
*/
|
|
27
|
+
export declare const UIProvider: ({ children, themeModeOverride, baseUrl, errorBoundary }: PropsWithChildren<UIProviderProps>) => import("react").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ErrorBoundary } from '@flipdish/ui-library/providers/ErrorBoundary';
|
|
3
|
+
import { RouteProvider } from '@flipdish/ui-library/providers/RouteProvider';
|
|
4
|
+
import { ThemeProvider } from '@flipdish/ui-library/providers/ThemeProvider';
|
|
5
|
+
import { BrowserRouter } from 'react-router';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @summary single entry-point provider that composes theme, routing, and an error boundary for consuming apps
|
|
9
|
+
*/
|
|
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 }) }) }) }));
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { UIProvider };
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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;;;;"}
|