@kanso-labs/kanso-ui 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/LICENSE +20 -0
- package/README.md +83 -0
- package/dist/assets/stylex.css +1623 -0
- package/dist/cjs/assets/stylex.css +1623 -0
- package/dist/cjs/components/avatar/index.cjs +89 -0
- package/dist/cjs/components/avatar/index.cjs.map +1 -0
- package/dist/cjs/components/avatar/index.d.cts +29 -0
- package/dist/cjs/components/badge/index.cjs +93 -0
- package/dist/cjs/components/badge/index.cjs.map +1 -0
- package/dist/cjs/components/badge/index.d.cts +27 -0
- package/dist/cjs/components/button/index.cjs +101 -0
- package/dist/cjs/components/button/index.cjs.map +1 -0
- package/dist/cjs/components/button/index.d.cts +22 -0
- package/dist/cjs/components/card/index.cjs +84 -0
- package/dist/cjs/components/card/index.cjs.map +1 -0
- package/dist/cjs/components/card/index.d.cts +29 -0
- package/dist/cjs/components/chip/index.cjs +53 -0
- package/dist/cjs/components/chip/index.cjs.map +1 -0
- package/dist/cjs/components/chip/index.d.cts +13 -0
- package/dist/cjs/components/currency/index.cjs +56 -0
- package/dist/cjs/components/currency/index.cjs.map +1 -0
- package/dist/cjs/components/currency/index.d.cts +36 -0
- package/dist/cjs/components/icon-button/index.cjs +80 -0
- package/dist/cjs/components/icon-button/index.cjs.map +1 -0
- package/dist/cjs/components/icon-button/index.d.cts +32 -0
- package/dist/cjs/components/index.d.cts +15 -0
- package/dist/cjs/components/link/index.cjs +61 -0
- package/dist/cjs/components/link/index.cjs.map +1 -0
- package/dist/cjs/components/link/index.d.cts +30 -0
- package/dist/cjs/components/list-item/index.cjs +42 -0
- package/dist/cjs/components/list-item/index.cjs.map +1 -0
- package/dist/cjs/components/list-item/index.d.cts +22 -0
- package/dist/cjs/components/separator/index.cjs +34 -0
- package/dist/cjs/components/separator/index.cjs.map +1 -0
- package/dist/cjs/components/separator/index.d.cts +14 -0
- package/dist/cjs/components/sheet/index.cjs +266 -0
- package/dist/cjs/components/sheet/index.cjs.map +1 -0
- package/dist/cjs/components/sheet/index.d.cts +73 -0
- package/dist/cjs/components/tabs/index.cjs +77 -0
- package/dist/cjs/components/tabs/index.cjs.map +1 -0
- package/dist/cjs/components/tabs/index.d.cts +24 -0
- package/dist/cjs/components/text/index.cjs +173 -0
- package/dist/cjs/components/text/index.cjs.map +1 -0
- package/dist/cjs/components/text/index.d.cts +19 -0
- package/dist/cjs/components/text-field/index.cjs +53 -0
- package/dist/cjs/components/text-field/index.cjs.map +1 -0
- package/dist/cjs/components/text-field/index.d.cts +30 -0
- package/dist/cjs/hooks/useRipple.cjs +391 -0
- package/dist/cjs/hooks/useRipple.cjs.map +1 -0
- package/dist/cjs/index.cjs +29 -0
- package/dist/cjs/index.d.cts +16 -0
- package/dist/cjs/node_modules/@stylexjs/stylex/lib/es/stylex.cjs +121 -0
- package/dist/cjs/node_modules/@stylexjs/stylex/lib/es/stylex.cjs.map +1 -0
- package/dist/cjs/styles/ripple.cjs +33 -0
- package/dist/cjs/styles/ripple.cjs.map +1 -0
- package/dist/cjs/tokens/values.cjs +36 -0
- package/dist/cjs/tokens/values.cjs.map +1 -0
- package/dist/components/avatar/index.d.ts +29 -0
- package/dist/components/avatar/index.js +89 -0
- package/dist/components/avatar/index.js.map +1 -0
- package/dist/components/badge/index.d.ts +27 -0
- package/dist/components/badge/index.js +93 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/button/index.d.ts +22 -0
- package/dist/components/button/index.js +101 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/card/index.d.ts +29 -0
- package/dist/components/card/index.js +84 -0
- package/dist/components/card/index.js.map +1 -0
- package/dist/components/chip/index.d.ts +13 -0
- package/dist/components/chip/index.js +53 -0
- package/dist/components/chip/index.js.map +1 -0
- package/dist/components/currency/index.d.ts +36 -0
- package/dist/components/currency/index.js +56 -0
- package/dist/components/currency/index.js.map +1 -0
- package/dist/components/icon-button/index.d.ts +32 -0
- package/dist/components/icon-button/index.js +80 -0
- package/dist/components/icon-button/index.js.map +1 -0
- package/dist/components/index.d.ts +15 -0
- package/dist/components/link/index.d.ts +30 -0
- package/dist/components/link/index.js +61 -0
- package/dist/components/link/index.js.map +1 -0
- package/dist/components/list-item/index.d.ts +22 -0
- package/dist/components/list-item/index.js +42 -0
- package/dist/components/list-item/index.js.map +1 -0
- package/dist/components/separator/index.d.ts +14 -0
- package/dist/components/separator/index.js +34 -0
- package/dist/components/separator/index.js.map +1 -0
- package/dist/components/sheet/index.d.ts +73 -0
- package/dist/components/sheet/index.js +266 -0
- package/dist/components/sheet/index.js.map +1 -0
- package/dist/components/tabs/index.d.ts +24 -0
- package/dist/components/tabs/index.js +77 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/text/index.d.ts +19 -0
- package/dist/components/text/index.js +173 -0
- package/dist/components/text/index.js.map +1 -0
- package/dist/components/text-field/index.d.ts +30 -0
- package/dist/components/text-field/index.js +53 -0
- package/dist/components/text-field/index.js.map +1 -0
- package/dist/hooks/useRipple.js +391 -0
- package/dist/hooks/useRipple.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +15 -0
- package/dist/node_modules/@stylexjs/stylex/lib/es/stylex.js +121 -0
- package/dist/node_modules/@stylexjs/stylex/lib/es/stylex.js.map +1 -0
- package/dist/styles/ripple.js +33 -0
- package/dist/styles/ripple.js.map +1 -0
- package/dist/tokens/values.js +34 -0
- package/dist/tokens/values.js.map +1 -0
- package/dist/tokens.css +282 -0
- package/package.json +109 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kanso
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Kanso UI
|
|
2
|
+
|
|
3
|
+
A React component library built on [StyleX](https://stylexjs.com) and
|
|
4
|
+
[Base UI](https://base-ui.com), with design tokens sourced from a single
|
|
5
|
+
[W3C Design Tokens (DTCG)](https://design-tokens.github.io/community-group/format/)
|
|
6
|
+
file and compiled via [Style Dictionary](https://styledictionary.com).
|
|
7
|
+
|
|
8
|
+
Every component is documented in Storybook, published from `main` at
|
|
9
|
+
**[kanso-ui.kansolabs.org](https://kanso-ui.kansolabs.org/)**.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @kanso-labs/kanso-ui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { Button } from '@kanso-labs/kanso-ui'
|
|
21
|
+
|
|
22
|
+
function Example() {
|
|
23
|
+
return <Button>Click me</Button>
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Components render correctly with no further setup — every design token has a
|
|
28
|
+
built-in default, in both light and dark (respecting the OS-level
|
|
29
|
+
`prefers-color-scheme`).
|
|
30
|
+
|
|
31
|
+
## Theming
|
|
32
|
+
|
|
33
|
+
Every design token — color, spacing, radii, shadows, typography, state-layer
|
|
34
|
+
opacity — is backed by a CSS custom property under the `--kui-*` namespace.
|
|
35
|
+
Override any of them in your own stylesheet to retheme every Kanso component,
|
|
36
|
+
independent of your app's build tooling:
|
|
37
|
+
|
|
38
|
+
```css
|
|
39
|
+
:root {
|
|
40
|
+
--kui-color-primary: #ff5722;
|
|
41
|
+
--kui-color-on-primary: #ffffff;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@media (prefers-color-scheme: dark) {
|
|
45
|
+
:root {
|
|
46
|
+
--kui-color-primary: #ffab91;
|
|
47
|
+
--kui-color-on-primary: #3e0800;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Overrides must target `:root` (or another selector matching the `<html>`
|
|
53
|
+
element) — components resolve their tokens once, at the root, so redeclaring a
|
|
54
|
+
`--kui-*` property on a smaller scope (e.g. a wrapping `<div>`) doesn't reach
|
|
55
|
+
them.
|
|
56
|
+
|
|
57
|
+
[`@kanso-labs/kanso-ui/tokens.css`](src/tokens/design.tokens.css) is the
|
|
58
|
+
canonical, generated reference for every available variable and its current
|
|
59
|
+
default value — useful for discovering names, not required at runtime
|
|
60
|
+
(components already carry their defaults inline):
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import '@kanso-labs/kanso-ui/tokens.css'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### For StyleX consumers
|
|
67
|
+
|
|
68
|
+
If your app also uses StyleX, theme with
|
|
69
|
+
[`stylex.createTheme()`](https://stylexjs.com/docs/learn/theming/) instead — it
|
|
70
|
+
produces a scoped override class rather than a global one. The token objects
|
|
71
|
+
themselves (`colors`, `spacing`, `typography`, `radii`, `shadows`,
|
|
72
|
+
`stateLayerOpacity`) aren't part of the public API yet; open an issue if you
|
|
73
|
+
need them exported.
|
|
74
|
+
|
|
75
|
+
## Development
|
|
76
|
+
|
|
77
|
+
- `npm run storybook` — component playground
|
|
78
|
+
- `npm run build-storybook` — build that playground as a static site, the same
|
|
79
|
+
way the `Deploy Storybook` workflow does
|
|
80
|
+
- `npm run tokens:build` — regenerate `src/tokens/design.tokens.*` from
|
|
81
|
+
`src/tokens/design.tokens.json`
|
|
82
|
+
- `npm test` — Storybook story tests (vitest, headless Chromium)
|
|
83
|
+
- `npm run build` — build the publishable package into `dist/`
|