@ambasada/ui 0.0.0-stage → 0.7.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 +21 -0
- package/README.md +107 -2
- package/dist/ambasada-ui.css +615 -0
- package/dist/components.css +452 -0
- package/dist/fonts/OFL-inter.txt +93 -0
- package/dist/fonts/OFL-jetbrains-mono.txt +93 -0
- package/dist/fonts/inter-variable-latin-ext.woff2 +0 -0
- package/dist/fonts/inter-variable-latin.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-variable-latin-ext.woff2 +0 -0
- package/dist/fonts/jetbrains-mono-variable-latin.woff2 +0 -0
- package/dist/fonts.css +39 -0
- package/dist/react.d.ts +70 -0
- package/dist/react.js +114 -0
- package/dist/tokens.css +121 -0
- package/package.json +66 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CENTYSO (https://centyso.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, 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,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,108 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ambasada/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Ambasada look for mini apps: design tokens (the Ambasada colours, Inter + JetBrains Mono, radii, spacing,
|
|
4
|
+
the mono label, the shell's safe areas and host bar) and a small component set in plain CSS, with optional
|
|
5
|
+
React wrappers. Light only, no framework, no runtime: one stylesheet a plain HTML page can `<link>`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @ambasada/ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import "@ambasada/ui"; // fonts + tokens + components, once at the root of the app
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or the parts: `@ambasada/ui/tokens.css`, `@ambasada/ui/components.css`, `@ambasada/ui/fonts.css` (skip
|
|
18
|
+
`fonts.css` if you serve Inter and JetBrains Mono yourself).
|
|
19
|
+
|
|
20
|
+
With no build step, the same three in one file from any npm CDN (the fonts load from next to it):
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<link rel="stylesheet" href="https://unpkg.com/@ambasada/ui@0.5/dist/ambasada-ui.css" />
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The `ambasada init` templates load it before their own stylesheet.
|
|
27
|
+
|
|
28
|
+
## Tokens
|
|
29
|
+
|
|
30
|
+
All on `:root`, from the Ambasada hub (each has a source comment in `tokens.css`): `--color-accent` (the logo
|
|
31
|
+
red), `--color-accent-text` (red for small text), `--color-bg`, `--color-surface`, `--color-surface-2`,
|
|
32
|
+
`--color-ink` / `-2` / `-3`, `--color-line`, `--color-success` / `warn` / `danger` / `info` and their `-soft`
|
|
33
|
+
tints, `--card-*` (the member card palettes), `--font-sans`, `--font-mono`, `--text-*`, `--weight-*`,
|
|
34
|
+
`--tracking-label`, `--radius-*`, `--shadow-*`, `--space-1` to `--space-10`, `--page-max`, `--tap`, `--ease`,
|
|
35
|
+
`--duration`.
|
|
36
|
+
|
|
37
|
+
The shell's insets, for anything you position yourself:
|
|
38
|
+
|
|
39
|
+
| Variable | Default | Inside the Ambasada app |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| `--ambasada-safe-area-top` / `bottom` / `left` / `right` | `env(safe-area-inset-*, 0px)` | set on `<html>` by `@ambasada/miniapp`'s `ready()` |
|
|
42
|
+
| `--ambasada-host-bar` | `0px` | the height of the shell's top bar |
|
|
43
|
+
|
|
44
|
+
```css
|
|
45
|
+
.my-bar { position: fixed; bottom: 0; padding-bottom: calc(12px + var(--ambasada-safe-area-bottom, 0px)); }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Components
|
|
49
|
+
|
|
50
|
+
| Class | What |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `ui-page` | The 480 px column, padded clear of the host bar and every safe area. |
|
|
53
|
+
| `ui-card`, `ui-card-title` | White card, hairline border, 16 px radius. |
|
|
54
|
+
| `ui-button`, `ui-button secondary`, `block` | Primary (brand red: one per screen) and secondary buttons, ≥ 44 px. On `<button>` or `<a>`. |
|
|
55
|
+
| `ui-label` | The mono label: 11 px, uppercase, 0.1em. Captions, never sentences. |
|
|
56
|
+
| `ui-group` (`ui-group-head`, `ui-group-body`) | A list: rows in one bordered block, with a title. |
|
|
57
|
+
| `ui-row` (`row-icon`, `row-text`, `row-title`, `row-sub`, `row-right`, `row-chev`) | List row; `tappable`, `danger`, `muted`; `row-icon accent` / `good` / `bad`. |
|
|
58
|
+
| `ui-pill` | Status pill with a dot: `good`, `bad`, `warn`, `accent`, `pulse`. |
|
|
59
|
+
| `ui-sheet-backdrop` > `ui-sheet` (`ui-sheet-grip`, `-head`, `-body`, `-foot`), `ui-icon-btn` | Bottom sheet; a centred dialog from 640 px. Add `ui-sheet-open` to `<body>` while open. |
|
|
60
|
+
| `ui-stepper-wrap` > `ui-stepper` (`ui-stepper-value`), `ui-presets` | − value + for amounts, with preset chips (`on`). |
|
|
61
|
+
| `ui-empty` (`ui-empty-icon`) | Empty state: icon, `<strong>` title, hint, action. |
|
|
62
|
+
| `ui-skeleton` | Grey bars (`<span>`s) while loading: skeletons, not spinners. |
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<main class="ui-page">
|
|
66
|
+
<p class="ui-label">// My Company</p>
|
|
67
|
+
<section class="ui-card">
|
|
68
|
+
<h2 class="ui-card-title">Your name as a folk poem</h2>
|
|
69
|
+
<button class="ui-button block">Pay 2 TON</button>
|
|
70
|
+
</section>
|
|
71
|
+
<section class="ui-group">
|
|
72
|
+
<div class="ui-group-head"><h2>Orders</h2></div>
|
|
73
|
+
<div class="ui-group-body">
|
|
74
|
+
<a class="ui-row tappable" href="/orders/1">
|
|
75
|
+
<span class="row-text"><span class="row-title">Poem for Ana</span><span class="row-sub">2 min ago</span></span>
|
|
76
|
+
<span class="row-right"><span class="ui-pill good"><i></i>Ready</span></span>
|
|
77
|
+
</a>
|
|
78
|
+
</div>
|
|
79
|
+
</section>
|
|
80
|
+
</main>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## React
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { Button, Card, Empty, Group, Page, Pill, Row, Sheet, Skeleton, Stepper } from "@ambasada/ui/react";
|
|
87
|
+
|
|
88
|
+
<Page>
|
|
89
|
+
<Card title="Your name as a folk poem">
|
|
90
|
+
<Button block onClick={() => setOpen(true)}>Pay 2 TON</Button>
|
|
91
|
+
</Card>
|
|
92
|
+
<Group title="Orders">
|
|
93
|
+
<Row title="Poem for Ana" sub="2 min ago" right={<Pill tone="good">Ready</Pill>} href="/orders/1" />
|
|
94
|
+
</Group>
|
|
95
|
+
<Sheet open={open} onClose={() => setOpen(false)} title="Pay" footer={<Button>Pay 2 TON</Button>}>
|
|
96
|
+
<Stepper value={amount} onChange={setAmount} min={1} unit="TON" presets={[1, 2, 5]} />
|
|
97
|
+
</Sheet>
|
|
98
|
+
</Page>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The wrappers render markup only and import no CSS (load the stylesheet yourself). The module is marked
|
|
102
|
+
`"use client"` (`Sheet` uses effects), so Next.js server components can render them too; they server-render
|
|
103
|
+
with `react-dom/server`. React ≥ 18 is an optional peer dependency.
|
|
104
|
+
|
|
105
|
+
Rules for the look (one red thing per screen, light only, sheets for forms): docs/DESIGN-SYSTEM.md and
|
|
106
|
+
docs/MINI-APPS.md §9 in the Ambasada repo.
|
|
107
|
+
|
|
108
|
+
MIT, © CENTYSO. Inter and JetBrains Mono: SIL Open Font License 1.1 (`fonts/OFL-*.txt`).
|