@wickermoney/ui-kit 0.1.0-rc.4 → 0.2.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 +82 -0
- package/dist/tokens.css +56 -6
- 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/dist/tokens.css
CHANGED
|
@@ -12,12 +12,44 @@
|
|
|
12
12
|
--wm-border: #dfe3e9;
|
|
13
13
|
--wm-text: #16191d;
|
|
14
14
|
--wm-text-muted: #5b6472;
|
|
15
|
-
--wm-accent: #
|
|
15
|
+
--wm-accent: #2e500d;
|
|
16
16
|
--wm-accent-text: #ffffff;
|
|
17
|
-
--wm-positive: #
|
|
17
|
+
--wm-positive: #0c7e65;
|
|
18
18
|
--wm-negative: #c0392b;
|
|
19
19
|
--wm-warning: #b7791f;
|
|
20
20
|
|
|
21
|
+
/*
|
|
22
|
+
* Chart palette. Categorical slots are assigned in this fixed order and
|
|
23
|
+
* never cycled; a series past the last slot folds into --wm-chart-other.
|
|
24
|
+
* Slot 1 is the brand green (the logo's olive, one step brighter so it
|
|
25
|
+
* clears the chroma floor); slots 1 and 2 are green and amber so a
|
|
26
|
+
* two-series chart gets the pair that separates under colour-blindness.
|
|
27
|
+
*
|
|
28
|
+
* Validated with the dataviz skill's palette validator against
|
|
29
|
+
* --wm-chart-surface in each mode (adjacent pairs, OKLab ΔE×100): worst
|
|
30
|
+
* CVD 12.0 light / 10.2 dark (target 8), worst normal-vision 20.8 / 19.8
|
|
31
|
+
* (floor 15). The first three slots also pass all-pairs.
|
|
32
|
+
*
|
|
33
|
+
* Relief rule: slot 2 (amber) sits below 3:1 against the light surface,
|
|
34
|
+
* and --wm-chart-other is deliberately recessive (below 3:1 in both
|
|
35
|
+
* modes). Every chart using them must carry a visible label and value in
|
|
36
|
+
* text ink (legend row, filter chip or direct label) — identity is never
|
|
37
|
+
* colour alone. See documents/brand/brand-guide.md.
|
|
38
|
+
*/
|
|
39
|
+
--wm-chart-1: #40731a; /* green */
|
|
40
|
+
--wm-chart-2: #d49824; /* amber */
|
|
41
|
+
--wm-chart-3: #8166c3; /* violet */
|
|
42
|
+
--wm-chart-4: #d97c50; /* clay */
|
|
43
|
+
--wm-chart-5: #2971c6; /* blue */
|
|
44
|
+
--wm-chart-6: #98397e; /* plum */
|
|
45
|
+
--wm-chart-other: #bcbab6; /* warm grey, from the cream mark */
|
|
46
|
+
--wm-chart-grid: #e3e6ea;
|
|
47
|
+
/* Chart chrome follows the app's own surface and text tokens, so it
|
|
48
|
+
switches with them and cannot drift. */
|
|
49
|
+
--wm-chart-surface: var(--wm-surface);
|
|
50
|
+
--wm-chart-ink: var(--wm-text);
|
|
51
|
+
--wm-chart-ink-muted: var(--wm-text-muted);
|
|
52
|
+
|
|
21
53
|
--wm-radius: 10px;
|
|
22
54
|
--wm-radius-sm: 6px;
|
|
23
55
|
--wm-gap: 16px;
|
|
@@ -41,10 +73,19 @@
|
|
|
41
73
|
--wm-border: #2b323c;
|
|
42
74
|
--wm-text: #e8eaed;
|
|
43
75
|
--wm-text-muted: #9aa4b2;
|
|
44
|
-
--wm-accent: #
|
|
45
|
-
--wm-
|
|
76
|
+
--wm-accent: #a9d173;
|
|
77
|
+
--wm-accent-text: #0c301c;
|
|
78
|
+
--wm-positive: #29a987;
|
|
46
79
|
--wm-negative: #e5736a;
|
|
47
80
|
--wm-warning: #e0a84a;
|
|
81
|
+
--wm-chart-1: #43761e;
|
|
82
|
+
--wm-chart-2: #bf881e;
|
|
83
|
+
--wm-chart-3: #927ad2;
|
|
84
|
+
--wm-chart-4: #d4774c;
|
|
85
|
+
--wm-chart-5: #4081d2;
|
|
86
|
+
--wm-chart-6: #b54d98;
|
|
87
|
+
--wm-chart-other: #4e4d49;
|
|
88
|
+
--wm-chart-grid: #2b323c;
|
|
48
89
|
--wm-shadow: 0 1px 2px rgb(0 0 0 / 40%);
|
|
49
90
|
}
|
|
50
91
|
}
|
|
@@ -57,10 +98,19 @@
|
|
|
57
98
|
--wm-border: #2b323c;
|
|
58
99
|
--wm-text: #e8eaed;
|
|
59
100
|
--wm-text-muted: #9aa4b2;
|
|
60
|
-
--wm-accent: #
|
|
61
|
-
--wm-
|
|
101
|
+
--wm-accent: #a9d173;
|
|
102
|
+
--wm-accent-text: #0c301c;
|
|
103
|
+
--wm-positive: #29a987;
|
|
62
104
|
--wm-negative: #e5736a;
|
|
63
105
|
--wm-warning: #e0a84a;
|
|
106
|
+
--wm-chart-1: #43761e;
|
|
107
|
+
--wm-chart-2: #bf881e;
|
|
108
|
+
--wm-chart-3: #927ad2;
|
|
109
|
+
--wm-chart-4: #d4774c;
|
|
110
|
+
--wm-chart-5: #4081d2;
|
|
111
|
+
--wm-chart-6: #b54d98;
|
|
112
|
+
--wm-chart-other: #4e4d49;
|
|
113
|
+
--wm-chart-grid: #2b323c;
|
|
64
114
|
--wm-shadow: 0 1px 2px rgb(0 0 0 / 40%);
|
|
65
115
|
}
|
|
66
116
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wickermoney/ui-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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
|
},
|