@flatwork-ui/react 0.0.0-stage → 0.1.1

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 CHANGED
@@ -1,3 +1,80 @@
1
- # Temporary Holding Version
1
+ # @flatwork-ui/react
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ React components for the Flatwork design system. They render the markup of a
4
+ theme's CSS component library (`themes/<name>/components`), so the look comes
5
+ entirely from the theme stylesheet you load.
6
+
7
+ Themes with a web component library: **flatwork-saas** (dark, light, system).
8
+
9
+ ## Install
10
+
11
+ From a GitHub release (no registry needed, pinned to a version):
12
+
13
+ ```bash
14
+ npm i https://github.com/jurrebuunk/flatwork-ui/releases/download/v0.2.0/flatwork-ui-react-0.2.0.tgz
15
+ ```
16
+
17
+ From npm, once releases are published there:
18
+
19
+ ```bash
20
+ npm i @flatwork-ui/react
21
+ ```
22
+
23
+ Needs React 18 or newer.
24
+
25
+ ## Use
26
+
27
+ ```tsx
28
+ import "@flatwork-ui/react/styles/flatwork-saas.css"; // fonts + tokens + components, once
29
+ import { FlatworkRoot, ToastProvider, Button, Field, Input } from "@flatwork-ui/react";
30
+
31
+ export function App() {
32
+ return (
33
+ <FlatworkRoot mode="system">
34
+ <ToastProvider>
35
+ <Field label="Email" help="We'll never share your email.">
36
+ <Input type="email" placeholder="you@buunk.org" />
37
+ </Field>
38
+ <Button variant="primary">Save changes</Button>
39
+ </ToastProvider>
40
+ </FlatworkRoot>
41
+ );
42
+ }
43
+ ```
44
+
45
+ * Everything must render inside `<FlatworkRoot>` (a `div.fw`): it carries the tokens, font and colours. `mode` is `dark` (default), `light` or `system`.
46
+ * `<ToastProvider>` is only needed for `useToast()`.
47
+ * Tokens as data: `import tokens from "@flatwork-ui/react/tokens/flatwork-saas.json"`.
48
+ * The bundle is marked `"use client"`, so it works in Next.js App Router.
49
+ * Router links: `NavItem` takes `as={Link}`; `Breadcrumb` takes `renderLink`.
50
+
51
+ ## Components
52
+
53
+ | Area | Components |
54
+ | --- | --- |
55
+ | Base | `FlatworkRoot`, `Text`, `Kbd`, `Spinner`, `VisuallyHidden`, `cx` |
56
+ | Buttons | `Button`, `ButtonLink`, `ButtonGroup` |
57
+ | Forms | `Field`, `Input`, `Textarea`, `Select`, `InputGroup`, `Affix`, `Checkbox`, `Radio`, `Switch`, `Range`, `Dropzone`, `Fieldset` |
58
+ | Feedback | `Alert`, `Toast`, `ToastProvider`, `useToast`, `Badge`, `Tag`, `Progress`, `Skeleton`, `EmptyState` |
59
+ | Navigation | `TopNav`, `Brand`, `SideNav`, `NavItem`, `NavGroupLabel`, `Tabs`, `TabList`, `Tab`, `TabPanel`, `SegmentedControl`, `Breadcrumb`, `Pagination`, `Stepper` |
60
+ | Menus & overlays | `Menu`, `MenuItem`, `MenuLabel`, `MenuSeparator`, `DropdownMenu`, `Tooltip`, `Popover`, `Dialog`, `Drawer`, `CommandPalette` |
61
+ | Data | `Card`, `CardHeader`, `CardBody`, `CardFooter`, `StatCard`, `Table`, `SortableHeader`, `List`, `ListItem`, `DescriptionList`, `Accordion`, `AccordionItem`, `CodeBlock`, `Divider`, `Avatar`, `AvatarGroup` |
62
+ | Icons | `IconPlus`, `IconSearch`, `IconChevronDown`, … (16px stroke icons from the spec) |
63
+
64
+ Dialogs and drawers use the native `<dialog>` element, so focus trapping, Esc
65
+ and focus return come from the browser. The design rules each component
66
+ follows are in [`themes/flatwork-saas/DESIGN.md`](../../themes/flatwork-saas/DESIGN.md).
67
+
68
+ ## Develop
69
+
70
+ From the repo root:
71
+
72
+ ```bash
73
+ npm install
74
+ npm run dev # showcase of every component at http://localhost:5173
75
+ npm run typecheck
76
+ npm run build
77
+ ```
78
+
79
+ The showcase (`showcase/main.tsx`) mirrors the seven pages of the original
80
+ flatwork-saas spec and has a dark/light/system switch.