@wickermoney/ui-kit 0.1.0 → 0.2.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 +82 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# @wickermoney/ui-kit
|
|
2
|
+
|
|
3
|
+
The React components and design tokens used by
|
|
4
|
+
[Wicker Money](https://github.com/WickerMoney/wicker-money)'s app shell. Plugins
|
|
5
|
+
use the same package so their pages and widgets look like part of the app.
|
|
6
|
+
|
|
7
|
+
Full documentation lives at [wickermoney.dev](https://wickermoney.dev).
|
|
8
|
+
|
|
9
|
+
> **Pre-1.0.** Component props and token names can still change between minor
|
|
10
|
+
> releases.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install @wickermoney/ui-kit
|
|
16
|
+
# or: pnpm add @wickermoney/ui-kit
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Peer dependencies: `react` and `react-dom` 19.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { Surface, Stat, Button, EmptyState } from '@wickermoney/ui-kit'
|
|
25
|
+
|
|
26
|
+
export function Summary({ net }: { net: string }) {
|
|
27
|
+
return (
|
|
28
|
+
<Surface title="This month" action={<Button variant="primary">Details</Button>}>
|
|
29
|
+
<Stat label="Net" value={net} tone="auto" />
|
|
30
|
+
</Surface>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The package entry imports its stylesheets (`tokens.css` and `components.css`)
|
|
36
|
+
as a side effect, so your bundler must handle CSS imports. Vite and most modern
|
|
37
|
+
bundlers do by default.
|
|
38
|
+
|
|
39
|
+
**Inside a Wicker Money plugin:** the host already loads these styles, so
|
|
40
|
+
components in your widgets are styled with no extra setup. For your plugin's
|
|
41
|
+
*own* CSS, use `adoptPluginStyles` from
|
|
42
|
+
[`@wickermoney/plugin-sdk/runtime`](https://www.npmjs.com/package/@wickermoney/plugin-sdk).
|
|
43
|
+
A federated remote's emitted stylesheet is never requested.
|
|
44
|
+
|
|
45
|
+
## Components
|
|
46
|
+
|
|
47
|
+
| Component | Purpose |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `Surface` | Card/panel with an optional title and header action |
|
|
50
|
+
| `Button` | `variant`: `default`, `primary` or `danger` |
|
|
51
|
+
| `Field`, `SelectField` | Labelled form inputs |
|
|
52
|
+
| `Table` | Typed table: `columns`, `rows`, `rowKey`; `numeric` columns right-align |
|
|
53
|
+
| `Stat` | Label + value; `tone="auto"` colours by sign |
|
|
54
|
+
| `CategoryOptions`, `orderByParent` | Category `<option>` list grouped under parents |
|
|
55
|
+
| `Alert` | Inline error or notice (`role="alert"`) |
|
|
56
|
+
| `EmptyState` | Title, hint and an optional action for empty views |
|
|
57
|
+
| `Spinner` | Loading indicator |
|
|
58
|
+
|
|
59
|
+
Every component's props type is exported alongside it (`SurfaceProps`,
|
|
60
|
+
`TableProps<T>`, ...).
|
|
61
|
+
|
|
62
|
+
## Design tokens
|
|
63
|
+
|
|
64
|
+
All styling goes through CSS custom properties prefixed `--wm-`: surfaces, text,
|
|
65
|
+
accent, positive/negative, and a colour-blind-checked chart palette
|
|
66
|
+
(`--wm-chart-1` ... `--wm-chart-6`, `--wm-chart-other`). Use the tokens in your
|
|
67
|
+
own CSS rather than hard-coding colours, and your UI follows the app's theme.
|
|
68
|
+
|
|
69
|
+
Tokens have light values on `:root` and dark overrides. Dark mode follows the
|
|
70
|
+
system preference unless `data-theme="light"` or `data-theme="dark"` is set on
|
|
71
|
+
the root element.
|
|
72
|
+
|
|
73
|
+
To use the tokens without the components:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import '@wickermoney/ui-kit/styles.css'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
[Apache-2.0](./LICENSE). The Wicker Money application is licensed separately
|
|
82
|
+
(AGPL-3.0); see the [main repository](https://github.com/WickerMoney/wicker-money).
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wickermoney/ui-kit",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/WickerMoney/wicker-money.git",
|
|
8
8
|
"directory": "packages/ui-kit"
|
|
9
9
|
},
|
|
10
|
-
"homepage": "https://github.com/WickerMoney/wicker-money#readme",
|
|
10
|
+
"homepage": "https://github.com/WickerMoney/wicker-money/tree/main/packages/ui-kit#readme",
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/WickerMoney/wicker-money/issues"
|
|
13
13
|
},
|