@pollinations/ui 0.1.0-alpha.0 → 0.1.0-alpha.10
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 +162 -87
- package/dist/Button-BGqClaBr.d.cts +29 -0
- package/dist/Button-BGqClaBr.d.ts +29 -0
- package/dist/Chip-v-ADv6cz.d.cts +18 -0
- package/dist/Chip-v-ADv6cz.d.ts +18 -0
- package/dist/Dialog-D3Nqt8cE.d.cts +66 -0
- package/dist/Dialog-D3Nqt8cE.d.ts +66 -0
- package/dist/app-user-menu/sdk.cjs +938 -0
- package/dist/app-user-menu/sdk.cjs.map +1 -0
- package/dist/app-user-menu/sdk.d.cts +29 -0
- package/dist/app-user-menu/sdk.d.ts +29 -0
- package/dist/app-user-menu/sdk.js +917 -0
- package/dist/app-user-menu/sdk.js.map +1 -0
- package/dist/app.css +20 -32
- package/dist/auth/index.cjs +1372 -86
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +91 -6
- package/dist/auth/index.d.ts +91 -6
- package/dist/auth/index.js +1369 -85
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/sdk.cjs +93 -64
- package/dist/auth/sdk.cjs.map +1 -1
- package/dist/auth/sdk.d.cts +2 -15
- package/dist/auth/sdk.d.ts +2 -15
- package/dist/auth/sdk.js +92 -61
- package/dist/auth/sdk.js.map +1 -1
- package/dist/brand/badge-made-with.svg +1 -0
- package/dist/brand/lockup-horizontal-black.png +0 -0
- package/dist/brand/lockup-horizontal-black.svg +4 -0
- package/dist/brand/lockup-horizontal-white.png +0 -0
- package/dist/brand/lockup-horizontal-white.svg +4 -0
- package/dist/brand/lockup-horizontal.svg +4 -0
- package/dist/brand/lockup-stacked-black.png +0 -0
- package/dist/brand/lockup-stacked-black.svg +4 -0
- package/dist/brand/lockup-stacked-white.png +0 -0
- package/dist/brand/lockup-stacked-white.svg +4 -0
- package/dist/brand/lockup-stacked.svg +4 -0
- package/dist/brand/mark-black.png +0 -0
- package/dist/brand/mark-black.svg +1 -0
- package/dist/brand/mark-white.png +0 -0
- package/dist/brand/mark-white.svg +1 -0
- package/dist/brand/mark.svg +1 -0
- package/dist/brand/polli/polli-lockup-horizontal-black.png +0 -0
- package/dist/brand/polli/polli-lockup-horizontal-white.png +0 -0
- package/dist/brand/polli/polli-lockup-stacked-black.png +0 -0
- package/dist/brand/polli/polli-lockup-stacked-white.png +0 -0
- package/dist/brand/polli/polli.png +0 -0
- package/dist/brand/wordmark-black.png +0 -0
- package/dist/brand/wordmark-black.svg +1 -0
- package/dist/brand/wordmark-white.png +0 -0
- package/dist/brand/wordmark-white.svg +1 -0
- package/dist/brand/wordmark.svg +1 -0
- package/dist/fonts/geist-pixel-square.woff2 +0 -0
- package/dist/gen/index.cjs +718 -0
- package/dist/gen/index.cjs.map +1 -0
- package/dist/gen/index.d.cts +91 -0
- package/dist/gen/index.d.ts +91 -0
- package/dist/gen/index.js +688 -0
- package/dist/gen/index.js.map +1 -0
- package/dist/index.browser.min.js +2 -0
- package/dist/index.browser.min.js.map +1 -0
- package/dist/index.cjs +4250 -1517
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +794 -221
- package/dist/index.d.ts +794 -221
- package/dist/index.js +4154 -1493
- package/dist/index.js.map +1 -1
- package/dist/licenses/Geist-OFL.txt +93 -0
- package/dist/markdown.cjs +836 -0
- package/dist/markdown.cjs.map +1 -0
- package/dist/markdown.d.cts +16 -0
- package/dist/markdown.d.ts +16 -0
- package/dist/markdown.js +807 -0
- package/dist/markdown.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/theme.css +94 -0
- package/dist/types-CCy9JNu9.d.cts +6 -0
- package/dist/types-CCy9JNu9.d.ts +6 -0
- package/dist/wallet/index.cjs +298 -68
- package/dist/wallet/index.cjs.map +1 -1
- package/dist/wallet/index.d.cts +30 -7
- package/dist/wallet/index.d.ts +30 -7
- package/dist/wallet/index.js +297 -68
- package/dist/wallet/index.js.map +1 -1
- package/package.json +104 -102
- package/dist/Button-BvLF_Km2.d.cts +0 -26
- package/dist/Button-DQAZzvyQ.d.ts +0 -26
- package/dist/Chip-C5impfYd.d.ts +0 -20
- package/dist/Chip-SM52sUbZ.d.cts +0 -20
- package/dist/assets/logo-wordmark.svg +0 -1
- package/dist/assets/logo.svg +0 -4
- package/dist/compositions/app-user.cjs +0 -497
- package/dist/compositions/app-user.cjs.map +0 -1
- package/dist/compositions/app-user.d.cts +0 -18
- package/dist/compositions/app-user.d.ts +0 -18
- package/dist/compositions/app-user.js +0 -469
- package/dist/compositions/app-user.js.map +0 -1
- package/dist/modality/index.cjs +0 -86
- package/dist/modality/index.cjs.map +0 -1
- package/dist/modality/index.d.cts +0 -26
- package/dist/modality/index.d.ts +0 -26
- package/dist/modality/index.js +0 -59
- package/dist/modality/index.js.map +0 -1
- package/dist/models/index.cjs +0 -508
- package/dist/models/index.cjs.map +0 -1
- package/dist/models/index.d.cts +0 -22
- package/dist/models/index.d.ts +0 -22
- package/dist/models/index.js +0 -486
- package/dist/models/index.js.map +0 -1
- package/dist/theme-VMRlhqST.d.cts +0 -9
- package/dist/theme-VMRlhqST.d.ts +0 -9
- package/dist/wallet/sdk.cjs +0 -206
- package/dist/wallet/sdk.cjs.map +0 -1
- package/dist/wallet/sdk.d.cts +0 -33
- package/dist/wallet/sdk.d.ts +0 -33
- package/dist/wallet/sdk.js +0 -175
- package/dist/wallet/sdk.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# @pollinations/ui
|
|
2
2
|
|
|
3
|
-
Internal UI primitives for Pollinations apps.
|
|
4
|
-
state from
|
|
5
|
-
core
|
|
3
|
+
Internal UI primitives, compositions, and modules for Pollinations apps.
|
|
4
|
+
SDK-backed subpaths consume auth state from
|
|
5
|
+
[`@pollinations/sdk/react`](../sdk/README.md#react-auth-provider); core
|
|
6
|
+
primitives and display recipes stay SDK-free.
|
|
6
7
|
|
|
7
8
|
## Install
|
|
8
9
|
|
|
@@ -17,62 +18,76 @@ npm install @pollinations/ui
|
|
|
17
18
|
npm install @pollinations/ui@alpha
|
|
18
19
|
```
|
|
19
20
|
|
|
20
|
-
Install `@pollinations/sdk` too when using
|
|
21
|
-
|
|
21
|
+
Install `@pollinations/sdk` too when using the
|
|
22
|
+
`@pollinations/ui/app-user-menu/sdk` subpath.
|
|
22
23
|
|
|
23
24
|
## Usage
|
|
24
25
|
|
|
25
26
|
```tsx
|
|
26
27
|
import "@pollinations/ui/styles.css";
|
|
27
|
-
import { PolliProvider
|
|
28
|
+
import { PolliProvider } from "@pollinations/sdk/react";
|
|
28
29
|
import { Surface } from "@pollinations/ui";
|
|
29
|
-
import {
|
|
30
|
-
LoginButton,
|
|
31
|
-
LogoutButton,
|
|
32
|
-
UserAvatar,
|
|
33
|
-
UserName,
|
|
34
|
-
WhenLoggedIn,
|
|
35
|
-
WhenLoggedOut,
|
|
36
|
-
} from "@pollinations/ui/auth/sdk";
|
|
37
|
-
import {
|
|
38
|
-
Balance,
|
|
39
|
-
KeyBudget,
|
|
40
|
-
KeyExpiry,
|
|
41
|
-
KeyModels,
|
|
42
|
-
KeyPrefix,
|
|
43
|
-
} from "@pollinations/ui/wallet/sdk";
|
|
44
|
-
|
|
45
|
-
function RecentRequests() {
|
|
46
|
-
const { data: usage } = useAccountKeyUsage({ days: 7, limit: 5 });
|
|
47
|
-
return <span>{usage?.usage.length ?? 0} recent requests</span>;
|
|
48
|
-
}
|
|
30
|
+
import { AppUserMenu } from "@pollinations/ui/app-user-menu/sdk";
|
|
49
31
|
|
|
50
32
|
export function App() {
|
|
51
33
|
return (
|
|
52
34
|
<PolliProvider appKey="pk_your_publishable_key" permissions={["profile"]}>
|
|
53
|
-
<Surface
|
|
54
|
-
<
|
|
55
|
-
<LoginButton theme="amber">
|
|
56
|
-
Log in with Pollinations
|
|
57
|
-
</LoginButton>
|
|
58
|
-
</WhenLoggedOut>
|
|
59
|
-
<WhenLoggedIn>
|
|
60
|
-
<UserAvatar size="md" />
|
|
61
|
-
<UserName />
|
|
62
|
-
<Balance />
|
|
63
|
-
<KeyPrefix />
|
|
64
|
-
<KeyBudget />
|
|
65
|
-
<KeyExpiry />
|
|
66
|
-
<KeyModels />
|
|
67
|
-
<RecentRequests />
|
|
68
|
-
<LogoutButton theme="amber">Log out</LogoutButton>
|
|
69
|
-
</WhenLoggedIn>
|
|
35
|
+
<Surface>
|
|
36
|
+
<AppUserMenu />
|
|
70
37
|
</Surface>
|
|
71
38
|
</PolliProvider>
|
|
72
39
|
);
|
|
73
40
|
}
|
|
74
41
|
```
|
|
75
42
|
|
|
43
|
+
### CDN / `<script>` Tag
|
|
44
|
+
|
|
45
|
+
The root `@pollinations/ui` entry also ships a browser IIFE bundle for
|
|
46
|
+
no-build pages. It exposes SDK-free primitives and compositions on
|
|
47
|
+
`window.PollinationsUI`. Non-root subpaths such as `@pollinations/ui/auth`,
|
|
48
|
+
`@pollinations/ui/wallet`, `@pollinations/ui/gen`, and
|
|
49
|
+
`@pollinations/ui/app-user-menu/sdk` remain ESM/CJS-only.
|
|
50
|
+
|
|
51
|
+
React 19 no longer ships UMD builds, so load React from an ESM CDN first, set
|
|
52
|
+
the globals expected by the IIFE bundle, then load `@pollinations/ui`:
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<link
|
|
56
|
+
rel="stylesheet"
|
|
57
|
+
href="https://cdn.jsdelivr.net/npm/@pollinations/ui@alpha/styles.css"
|
|
58
|
+
/>
|
|
59
|
+
<div id="root"></div>
|
|
60
|
+
<script type="module">
|
|
61
|
+
import React from "https://esm.sh/react@19";
|
|
62
|
+
import * as ReactDOM from "https://esm.sh/react-dom@19";
|
|
63
|
+
import * as ReactDOMClient from "https://esm.sh/react-dom@19/client";
|
|
64
|
+
|
|
65
|
+
window.React = React;
|
|
66
|
+
window.ReactDOM = { ...ReactDOM, ...ReactDOMClient };
|
|
67
|
+
|
|
68
|
+
await new Promise((resolve, reject) => {
|
|
69
|
+
const script = document.createElement("script");
|
|
70
|
+
script.src = "https://cdn.jsdelivr.net/npm/@pollinations/ui@alpha";
|
|
71
|
+
script.onload = resolve;
|
|
72
|
+
script.onerror = reject;
|
|
73
|
+
document.head.appendChild(script);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const { Button } = window.PollinationsUI;
|
|
77
|
+
|
|
78
|
+
window.ReactDOM.createRoot(document.getElementById("root")).render(
|
|
79
|
+
React.createElement(Button, null, "Generate"),
|
|
80
|
+
);
|
|
81
|
+
</script>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The browser bundle keeps React and ReactDOM external via those globals, but it
|
|
85
|
+
does bundle the root entry's package dependencies, including Ark UI,
|
|
86
|
+
react-markdown, remark, and rehype.
|
|
87
|
+
|
|
88
|
+
React's guidance on loading React 19 without UMD builds:
|
|
89
|
+
https://react.dev/blog/2024/04/25/react-19-upgrade-guide#umd-builds-removed
|
|
90
|
+
|
|
76
91
|
For Pollinations apps that use unprefixed Tailwind utilities, import the
|
|
77
92
|
package-owned app stylesheet instead:
|
|
78
93
|
|
|
@@ -86,51 +101,107 @@ and generic `polli-ui-root`, `polli-ui-body`, and `polli-ui-shell` classes.
|
|
|
86
101
|
Canonical Pollinations source SVGs are exported from the package:
|
|
87
102
|
|
|
88
103
|
```ts
|
|
89
|
-
import
|
|
90
|
-
import
|
|
104
|
+
import markUrl from "@pollinations/ui/brand/mark.svg";
|
|
105
|
+
import lockupUrl from "@pollinations/ui/brand/lockup-horizontal.svg";
|
|
91
106
|
```
|
|
92
107
|
|
|
93
108
|
The SVG sources use `currentColor`. Apps control the rendered color by inlining
|
|
94
109
|
them or using them as masks. Root-level favicon, PWA icon, and SEO files stay
|
|
95
110
|
app-owned.
|
|
96
111
|
|
|
112
|
+
The whole kit derives from two atomic sources — `mark.svg` and `wordmark.svg`
|
|
113
|
+
(both `currentColor`) plus the raster bee `polli/polli.png`. One zero-config
|
|
114
|
+
command rebuilds everything:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
npm run brand
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
It refreshes the committed derivatives in `src/brand`, and writes every
|
|
121
|
+
favicon / PWA / apple-touch / maskable / OG / social asset to `brand-out/`
|
|
122
|
+
(gitignored) — copy those into a site's `public/`. Colours are fixed to the two
|
|
123
|
+
brand themes matching enter.pollinations.ai (icons gold on transparent,
|
|
124
|
+
OG/social dark on cream), resolved from `theme-palette.json`. Sizes and padding
|
|
125
|
+
are data in `scripts/brand/presets.js` — `pad` keeps avatars clear of a circular
|
|
126
|
+
mask; add a platform by adding a line.
|
|
127
|
+
|
|
97
128
|
Wallet colors and utilities are bundled into the main stylesheet
|
|
98
129
|
(`@pollinations/ui/styles.css`) — no separate import needed.
|
|
99
130
|
|
|
131
|
+
## Dialog layout
|
|
132
|
+
|
|
133
|
+
`Dialog` keeps rounded corners at every width. Below 480px it spans the phone
|
|
134
|
+
width with an 8px vertical gap; larger viewports have a 16px outer inset and use
|
|
135
|
+
the `size` width limit. Height follows the content, capped by the available
|
|
136
|
+
viewport. Confirmations and completed results follow the same phone-width rule.
|
|
137
|
+
|
|
138
|
+
Use `DialogHeader`, `DialogBody` (scrolling content), and `DialogFooter` for
|
|
139
|
+
consistent spacing and actions. The frame uses Enter's themed panel color;
|
|
140
|
+
inner cards use the neutral `Surface` default. `AuthModal` uses the same frame
|
|
141
|
+
for standalone pages. Content such as document previews can request a height,
|
|
142
|
+
which remains capped by the shared frame.
|
|
143
|
+
|
|
144
|
+
Enter's `ResourceDialog` keeps expandable forms top-aligned at every width;
|
|
145
|
+
completed results use the centered `Dialog`. Both inherit the same viewport sizing.
|
|
146
|
+
|
|
147
|
+
Actions that write server data use a bordered button (`intent="commit"`).
|
|
148
|
+
Navigation and export actions, including device Continue and Copy and close,
|
|
149
|
+
use the default filled style. Sign-in uses `intent="brand"`; destructive
|
|
150
|
+
confirmations use `intent="danger"`. Cancel/Decline/Close actions use the muted,
|
|
151
|
+
borderless `intent="neutral"` style.
|
|
152
|
+
Saved-card checkout preserves its dedicated footer: full-width Confirm with
|
|
153
|
+
Cancel and the alternative payment-method link on the line below.
|
|
154
|
+
|
|
100
155
|
## What's exported
|
|
101
156
|
|
|
102
157
|
- `@pollinations/ui` exports SDK-free design primitives, helpers, and
|
|
103
|
-
|
|
104
|
-
- `@pollinations/ui/auth` exports
|
|
158
|
+
compositions. These can be used without Pollinations auth.
|
|
159
|
+
- `@pollinations/ui/auth` exports `PollinationsSignInButton` (official brand
|
|
160
|
+
asset, outlined amber styling, accessible provider label) and `DashboardSignIn`
|
|
161
|
+
(the shared satellite-app sign-in page). Apps supply the sign-in action; these
|
|
162
|
+
components do not issue credentials or choose an authentication method.
|
|
163
|
+
- `@pollinations/ui/auth` also exports SDK-free auth modal pieces:
|
|
105
164
|
`AuthModal`, `AuthModalHeader`, `AuthModalLoading`, `AuthInfoCard`, and
|
|
106
165
|
`ErrorBanner`.
|
|
107
166
|
- `@pollinations/ui/auth/sdk` exports identity/session components that read
|
|
108
167
|
from the surrounding `<PolliProvider>`:
|
|
109
|
-
- **null when not logged in (or before data loads):** `
|
|
110
|
-
`
|
|
168
|
+
- **null when not logged in (or before data loads):** `UserAvatar`,
|
|
169
|
+
`UserName`, `WhenLoggedIn`.
|
|
111
170
|
- **shown only when logged out:** `LoginButton`, `WhenLoggedOut`.
|
|
112
171
|
|
|
113
172
|
These are intentionally bare wrappers around `useAuth*` hooks. They render
|
|
114
|
-
the data and nothing else — no default copy
|
|
115
|
-
|
|
173
|
+
the data and nothing else — no default copy and no default intent. The app
|
|
174
|
+
composes layout, copy, and color.
|
|
116
175
|
- `@pollinations/ui/wallet` exports SDK-free wallet-specific display helpers
|
|
117
|
-
and recipes: `formatPollen`, `PaidChip`, `TierChip`, `
|
|
176
|
+
and recipes: `formatPollen`, `PaidChip`, `TierChip`, `WalletKindIcon`,
|
|
118
177
|
`WalletBalanceCard`, `PAID_BALANCE_CHART_COLOR`, and
|
|
119
178
|
`TIER_BALANCE_CHART_COLOR`.
|
|
120
|
-
- `@pollinations/ui/
|
|
121
|
-
|
|
122
|
-
- `@pollinations/ui/
|
|
123
|
-
|
|
124
|
-
`
|
|
125
|
-
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
`
|
|
129
|
-
|
|
130
|
-
|
|
179
|
+
- `@pollinations/ui/app-user-menu/sdk` exports the SDK-backed app account
|
|
180
|
+
menu module.
|
|
181
|
+
- `@pollinations/ui/gen` exports generation UI modules and modality helpers:
|
|
182
|
+
`ModelSelector`, `ModalityChip`, `ModalityDot`, `ModalityTab`,
|
|
183
|
+
`categoryLabel`, and `getModalityKey`.
|
|
184
|
+
- `@pollinations/ui/markdown` exports `Markdown` and `Prose`, kept off the
|
|
185
|
+
root entry so react-markdown only loads where documents render.
|
|
186
|
+
- `@pollinations/ui/brand/*` exports the canonical brand kit — `mark`,
|
|
187
|
+
`wordmark`, `lockup-horizontal`, `lockup-stacked` (currentColor SVG masters
|
|
188
|
+
plus `-black`/`-white` SVG + PNG), and the `polli/` mascot PNGs.
|
|
189
|
+
- **Design primitives** — `Button`, `ButtonGroup`, `Chip`, `ChevronIcon`,
|
|
190
|
+
`Dialog`, `DialogTitle`, `Dropdown`, `DropdownItem`, `Field`, `Heading`,
|
|
191
|
+
`IconButton`, `InlineLink`, `Input`, `ScrollArea`, `Slider`, `Surface`,
|
|
192
|
+
`Switch`, `TabButton`, `Table`, `TableBody`, `TableCell`, `TableHead`,
|
|
193
|
+
`TableHeaderCell`, `TableRow`, `Text`, `Textarea`, `Tooltip`.
|
|
194
|
+
- **Design compositions** — `Alert`, `CodeBlock`, `Collapsible`,
|
|
195
|
+
`CopyButton`, `EditableCombobox`, `EditableComboboxToken`,
|
|
196
|
+
`ExternalLinkButton`, `FieldStack`, `FileUpload`, `InfoTip`, `LinkCard`,
|
|
197
|
+
`MediaPlaceholder`, `MultiSelect`, `NavItem`, `PeriodPicker`, `Section`,
|
|
198
|
+
`StatCard`.
|
|
199
|
+
`FieldStack` supports label, helper, action, error, and opt-in aligned label
|
|
200
|
+
rows for compact forms.
|
|
201
|
+
`EditableCombobox.startContent` renders content inside a wrapping input shell
|
|
202
|
+
and replaces the standalone chevron trigger.
|
|
131
203
|
- **Helpers** — `cn`, `useScrollLock`, `currentPeriod`,
|
|
132
204
|
`getPeriodBucketKeys`, `periodBucketKeyToDate`.
|
|
133
|
-
- **Theme** — `themes` (runtime array of theme names), `ThemeName` (type).
|
|
134
205
|
|
|
135
206
|
For per-request usage data and other dynamic queries, call the opt-in hooks
|
|
136
207
|
from `@pollinations/sdk/react` (`useAccountKeyUsage`, `useAccountKey`,
|
|
@@ -139,19 +210,24 @@ from `@pollinations/sdk/react` (`useAccountKeyUsage`, `useAccountKey`,
|
|
|
139
210
|
## Source Layout
|
|
140
211
|
|
|
141
212
|
- `src/primitives/*` contains generic, SDK-free building blocks.
|
|
213
|
+
- `src/compositions/*` contains SDK-free recipes that compose primitives.
|
|
142
214
|
- `src/modules/*` contains package-owned recipes with domain assumptions
|
|
143
|
-
such as auth, wallet, and
|
|
215
|
+
such as auth, wallet, app-user-menu, and gen.
|
|
144
216
|
- Public subpath exports (`@pollinations/ui/auth`,
|
|
145
|
-
`@pollinations/ui/
|
|
146
|
-
`@pollinations/ui/
|
|
147
|
-
directly from those
|
|
217
|
+
`@pollinations/ui/wallet`, `@pollinations/ui/gen`,
|
|
218
|
+
`@pollinations/ui/markdown`, `@pollinations/ui/app-user-menu/sdk`) are
|
|
219
|
+
built directly from those source layers.
|
|
148
220
|
|
|
149
221
|
## Theming
|
|
150
222
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
223
|
+
Import `@pollinations/ui/styles.css` once at the app entry. The package uses a
|
|
224
|
+
single app accent by default; primitives read the current cascade through
|
|
225
|
+
`--polli-color-*` variables.
|
|
226
|
+
|
|
227
|
+
Use `data-theme="neutral"` on chrome that should carry no accent, such as a
|
|
228
|
+
global rail. Use `data-theme="accent"` inside a neutral subtree to re-assert
|
|
229
|
+
the app accent for controls. Do not use per-component theme props; compose
|
|
230
|
+
layout and state with primitives instead.
|
|
155
231
|
|
|
156
232
|
## Public design tokens
|
|
157
233
|
|
|
@@ -162,7 +238,7 @@ count as breaking.
|
|
|
162
238
|
Public tokens sit under the `--polli-*` namespace so they do not collide
|
|
163
239
|
with host app tokens.
|
|
164
240
|
|
|
165
|
-
**
|
|
241
|
+
**Accent-aware (resolve against the current accent or neutral scope):**
|
|
166
242
|
|
|
167
243
|
| Token | Purpose |
|
|
168
244
|
| ----------------------------- | --------------------------------------------- |
|
|
@@ -196,23 +272,22 @@ Wallet tokens are public (bundled into `@pollinations/ui/styles.css`):
|
|
|
196
272
|
| `--polli-color-paid-pale` | Paid-balance wash. |
|
|
197
273
|
| `--polli-color-paid-soft` | Paid-balance marker. |
|
|
198
274
|
| `--polli-color-paid-deep` | Paid-balance text. |
|
|
199
|
-
| `--polli-color-tier-pale` |
|
|
200
|
-
| `--polli-color-tier-soft` |
|
|
201
|
-
| `--polli-color-tier-deep` |
|
|
275
|
+
| `--polli-color-tier-pale` | Quest Pollen wash. |
|
|
276
|
+
| `--polli-color-tier-soft` | Quest Pollen marker. |
|
|
277
|
+
| `--polli-color-tier-deep` | Quest Pollen text. |
|
|
202
278
|
|
|
203
279
|
**Intent (theme-independent):**
|
|
204
280
|
|
|
205
|
-
| Token
|
|
206
|
-
|
|
|
207
|
-
| `--polli-color-danger-bg-light`
|
|
208
|
-
| `--polli-color-danger-text`
|
|
209
|
-
| `--polli-color-danger-border`
|
|
210
|
-
| `--polli-color-success-
|
|
211
|
-
| `--polli-color-success-
|
|
212
|
-
| `--polli-color-success-
|
|
213
|
-
| `--polli-color-warning-bg-light`
|
|
214
|
-
| `--polli-color-warning-text`
|
|
215
|
-
| `--polli-color-warning-border` | Warning border. |
|
|
281
|
+
| Token | Purpose |
|
|
282
|
+
| ------------------------------------------ | -------------------------------- |
|
|
283
|
+
| `--polli-color-danger-bg-light` | Error surface background. |
|
|
284
|
+
| `--polli-color-danger-text` | Error text foreground. |
|
|
285
|
+
| `--polli-color-danger-border` | Error border. |
|
|
286
|
+
| `--polli-color-success-text` | Success text foreground. |
|
|
287
|
+
| `--polli-color-success-bright` | Filled success background. |
|
|
288
|
+
| `--polli-color-success-text-on-bright` | Text on filled success surfaces. |
|
|
289
|
+
| `--polli-color-warning-bg-light` | Warning surface background. |
|
|
290
|
+
| `--polli-color-warning-text` | Warning text foreground. |
|
|
216
291
|
|
|
217
292
|
**Example:**
|
|
218
293
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/** Semantic action roles. Label recipes live on Chip. */
|
|
5
|
+
type ButtonIntent = "danger" | "info" | "neutral" | "brand" | "commit" | "surface";
|
|
6
|
+
type ButtonAppearance = "pill" | "raised";
|
|
7
|
+
declare const pillSizes: {
|
|
8
|
+
readonly icon: "polli:h-12 polli:w-12 polli:p-0";
|
|
9
|
+
readonly xs: "polli:h-5 polli:px-1.5 polli:py-0 polli:text-[11px] polli:leading-none";
|
|
10
|
+
readonly sm: "polli:min-h-7 polli:px-2 polli:pt-0.5 polli:pb-1";
|
|
11
|
+
readonly md: "polli:min-h-9 polli:px-4 polli:pt-1.5 polli:pb-2";
|
|
12
|
+
readonly lg: "polli:min-h-12 polli:px-6 polli:py-3 polli:text-base";
|
|
13
|
+
};
|
|
14
|
+
type BaseButtonProps = {
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
/** Optional semantic recipe; omit for the ambient theme button. */
|
|
17
|
+
intent?: ButtonIntent;
|
|
18
|
+
/** `raised` is the stronger website CTA treatment. */
|
|
19
|
+
appearance?: ButtonAppearance;
|
|
20
|
+
size?: keyof typeof pillSizes;
|
|
21
|
+
className?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
};
|
|
24
|
+
type ButtonProps<T extends React.ElementType = "button"> = PropsWithChildren<BaseButtonProps> & {
|
|
25
|
+
as?: T;
|
|
26
|
+
} & Omit<React.ComponentPropsWithoutRef<T>, keyof BaseButtonProps | "as">;
|
|
27
|
+
declare function Button<T extends React.ElementType = "button">({ as, children, icon, intent, appearance, size, className, disabled, ...buttonProps }: ButtonProps<T>): react_jsx_runtime.JSX.Element;
|
|
28
|
+
|
|
29
|
+
export { type ButtonProps as B, type ButtonAppearance as a, Button as b };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/** Semantic action roles. Label recipes live on Chip. */
|
|
5
|
+
type ButtonIntent = "danger" | "info" | "neutral" | "brand" | "commit" | "surface";
|
|
6
|
+
type ButtonAppearance = "pill" | "raised";
|
|
7
|
+
declare const pillSizes: {
|
|
8
|
+
readonly icon: "polli:h-12 polli:w-12 polli:p-0";
|
|
9
|
+
readonly xs: "polli:h-5 polli:px-1.5 polli:py-0 polli:text-[11px] polli:leading-none";
|
|
10
|
+
readonly sm: "polli:min-h-7 polli:px-2 polli:pt-0.5 polli:pb-1";
|
|
11
|
+
readonly md: "polli:min-h-9 polli:px-4 polli:pt-1.5 polli:pb-2";
|
|
12
|
+
readonly lg: "polli:min-h-12 polli:px-6 polli:py-3 polli:text-base";
|
|
13
|
+
};
|
|
14
|
+
type BaseButtonProps = {
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
/** Optional semantic recipe; omit for the ambient theme button. */
|
|
17
|
+
intent?: ButtonIntent;
|
|
18
|
+
/** `raised` is the stronger website CTA treatment. */
|
|
19
|
+
appearance?: ButtonAppearance;
|
|
20
|
+
size?: keyof typeof pillSizes;
|
|
21
|
+
className?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
};
|
|
24
|
+
type ButtonProps<T extends React.ElementType = "button"> = PropsWithChildren<BaseButtonProps> & {
|
|
25
|
+
as?: T;
|
|
26
|
+
} & Omit<React.ComponentPropsWithoutRef<T>, keyof BaseButtonProps | "as">;
|
|
27
|
+
declare function Button<T extends React.ElementType = "button">({ as, children, icon, intent, appearance, size, className, disabled, ...buttonProps }: ButtonProps<T>): react_jsx_runtime.JSX.Element;
|
|
28
|
+
|
|
29
|
+
export { type ButtonProps as B, type ButtonAppearance as a, Button as b };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Semantic chip labels for status and metadata badges. */
|
|
4
|
+
type ChipIntent = "news" | "new" | "free" | "alpha" | "neutral" | "success" | "warning" | "info" | "danger";
|
|
5
|
+
declare const chipSizes: {
|
|
6
|
+
readonly icon: "polli:h-5 polli:w-5 polli:p-0 polli:text-xs";
|
|
7
|
+
readonly sm: "polli:h-5 polli:px-2 polli:text-xs";
|
|
8
|
+
readonly md: "polli:h-6 polli:px-2.5 polli:text-sm";
|
|
9
|
+
readonly lg: "polli:h-7 polli:px-3 polli:text-sm";
|
|
10
|
+
};
|
|
11
|
+
type ChipProps = ComponentPropsWithoutRef<"span"> & {
|
|
12
|
+
/** Semantic intent. */
|
|
13
|
+
intent?: ChipIntent;
|
|
14
|
+
size?: keyof typeof chipSizes;
|
|
15
|
+
};
|
|
16
|
+
declare const Chip: FC<ChipProps>;
|
|
17
|
+
|
|
18
|
+
export { Chip as C, type ChipProps as a };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
|
|
3
|
+
/** Semantic chip labels for status and metadata badges. */
|
|
4
|
+
type ChipIntent = "news" | "new" | "free" | "alpha" | "neutral" | "success" | "warning" | "info" | "danger";
|
|
5
|
+
declare const chipSizes: {
|
|
6
|
+
readonly icon: "polli:h-5 polli:w-5 polli:p-0 polli:text-xs";
|
|
7
|
+
readonly sm: "polli:h-5 polli:px-2 polli:text-xs";
|
|
8
|
+
readonly md: "polli:h-6 polli:px-2.5 polli:text-sm";
|
|
9
|
+
readonly lg: "polli:h-7 polli:px-3 polli:text-sm";
|
|
10
|
+
};
|
|
11
|
+
type ChipProps = ComponentPropsWithoutRef<"span"> & {
|
|
12
|
+
/** Semantic intent. */
|
|
13
|
+
intent?: ChipIntent;
|
|
14
|
+
size?: keyof typeof chipSizes;
|
|
15
|
+
};
|
|
16
|
+
declare const Chip: FC<ChipProps>;
|
|
17
|
+
|
|
18
|
+
export { Chip as C, type ChipProps as a };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { PropsWithChildren, ComponentPropsWithoutRef, ReactNode, FC } from 'react';
|
|
4
|
+
import { Dialog as Dialog$1 } from '@ark-ui/react/dialog';
|
|
5
|
+
|
|
6
|
+
type ScrollAxis = "y" | "x" | "both";
|
|
7
|
+
type ScrollAreaOwnProps = {
|
|
8
|
+
/** Scroll direction. Default `y`. */
|
|
9
|
+
axis?: ScrollAxis;
|
|
10
|
+
/** Use the system scrollbar instead of the custom auto-hiding track. */
|
|
11
|
+
scrollbar?: "subtle" | "native";
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
type ScrollAreaProps = PropsWithChildren<ScrollAreaOwnProps & Omit<ComponentPropsWithoutRef<"div">, keyof ScrollAreaOwnProps>>;
|
|
15
|
+
/** Scroll container with an optional themed, auto-hiding scrollbar. */
|
|
16
|
+
declare const ScrollArea: react.ForwardRefExoticComponent<ScrollAreaOwnProps & Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof ScrollAreaOwnProps> & {
|
|
17
|
+
children?: react.ReactNode | undefined;
|
|
18
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
|
|
20
|
+
declare const sizeClasses: {
|
|
21
|
+
readonly sm: "polli:max-w-md";
|
|
22
|
+
readonly md: "polli:max-w-xl";
|
|
23
|
+
readonly lg: "polli:max-w-[800px]";
|
|
24
|
+
readonly xl: "polli:max-w-6xl";
|
|
25
|
+
};
|
|
26
|
+
type DialogProps = {
|
|
27
|
+
open: boolean;
|
|
28
|
+
onOpenChange?: (open: boolean) => void;
|
|
29
|
+
trigger?: ReactNode;
|
|
30
|
+
triggerAsChild?: boolean;
|
|
31
|
+
triggerClassName?: string;
|
|
32
|
+
title?: ReactNode;
|
|
33
|
+
ariaLabel?: string;
|
|
34
|
+
labelledBy?: string;
|
|
35
|
+
size?: keyof typeof sizeClasses;
|
|
36
|
+
showBackdrop?: boolean;
|
|
37
|
+
backdropBlur?: boolean;
|
|
38
|
+
positionerClassName?: string;
|
|
39
|
+
contentClassName?: string;
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
};
|
|
42
|
+
declare const Dialog: FC<DialogProps>;
|
|
43
|
+
declare const DialogTitle: react.ForwardRefExoticComponent<Dialog$1.TitleProps & react.RefAttributes<HTMLHeadingElement>>;
|
|
44
|
+
declare const DialogDescription: react.ForwardRefExoticComponent<Dialog$1.DescriptionProps & react.RefAttributes<HTMLDivElement>>;
|
|
45
|
+
type DialogHeaderProps = Omit<ComponentPropsWithoutRef<"div">, "title"> & {
|
|
46
|
+
title?: ReactNode;
|
|
47
|
+
description?: ReactNode;
|
|
48
|
+
inBody?: boolean;
|
|
49
|
+
titleClassName?: string;
|
|
50
|
+
descriptionClassName?: string;
|
|
51
|
+
};
|
|
52
|
+
declare const DialogHeader: FC<DialogHeaderProps>;
|
|
53
|
+
type DialogFooterProps = ComponentPropsWithoutRef<"div">;
|
|
54
|
+
type DialogBodyProps = ScrollAreaProps & {
|
|
55
|
+
actions?: ReactNode;
|
|
56
|
+
footnote?: ReactNode;
|
|
57
|
+
bodyClassName?: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Scroll area whose actions follow the content and stay pinned to the bottom
|
|
61
|
+
* once the content scrolls, so a short screen never opens a gap above them.
|
|
62
|
+
*/
|
|
63
|
+
declare function DialogBody({ children, actions, footnote, bodyClassName, className, ...props }: DialogBodyProps): react_jsx_runtime.JSX.Element;
|
|
64
|
+
declare const DialogFooter: FC<DialogFooterProps>;
|
|
65
|
+
|
|
66
|
+
export { type DialogProps as D, type ScrollAreaProps as S, Dialog as a, DialogBody as b, type DialogBodyProps as c, DialogDescription as d, DialogFooter as e, type DialogFooterProps as f, DialogHeader as g, type DialogHeaderProps as h, DialogTitle as i, ScrollArea as j };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { PropsWithChildren, ComponentPropsWithoutRef, ReactNode, FC } from 'react';
|
|
4
|
+
import { Dialog as Dialog$1 } from '@ark-ui/react/dialog';
|
|
5
|
+
|
|
6
|
+
type ScrollAxis = "y" | "x" | "both";
|
|
7
|
+
type ScrollAreaOwnProps = {
|
|
8
|
+
/** Scroll direction. Default `y`. */
|
|
9
|
+
axis?: ScrollAxis;
|
|
10
|
+
/** Use the system scrollbar instead of the custom auto-hiding track. */
|
|
11
|
+
scrollbar?: "subtle" | "native";
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
|
+
type ScrollAreaProps = PropsWithChildren<ScrollAreaOwnProps & Omit<ComponentPropsWithoutRef<"div">, keyof ScrollAreaOwnProps>>;
|
|
15
|
+
/** Scroll container with an optional themed, auto-hiding scrollbar. */
|
|
16
|
+
declare const ScrollArea: react.ForwardRefExoticComponent<ScrollAreaOwnProps & Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof ScrollAreaOwnProps> & {
|
|
17
|
+
children?: react.ReactNode | undefined;
|
|
18
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
|
|
20
|
+
declare const sizeClasses: {
|
|
21
|
+
readonly sm: "polli:max-w-md";
|
|
22
|
+
readonly md: "polli:max-w-xl";
|
|
23
|
+
readonly lg: "polli:max-w-[800px]";
|
|
24
|
+
readonly xl: "polli:max-w-6xl";
|
|
25
|
+
};
|
|
26
|
+
type DialogProps = {
|
|
27
|
+
open: boolean;
|
|
28
|
+
onOpenChange?: (open: boolean) => void;
|
|
29
|
+
trigger?: ReactNode;
|
|
30
|
+
triggerAsChild?: boolean;
|
|
31
|
+
triggerClassName?: string;
|
|
32
|
+
title?: ReactNode;
|
|
33
|
+
ariaLabel?: string;
|
|
34
|
+
labelledBy?: string;
|
|
35
|
+
size?: keyof typeof sizeClasses;
|
|
36
|
+
showBackdrop?: boolean;
|
|
37
|
+
backdropBlur?: boolean;
|
|
38
|
+
positionerClassName?: string;
|
|
39
|
+
contentClassName?: string;
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
};
|
|
42
|
+
declare const Dialog: FC<DialogProps>;
|
|
43
|
+
declare const DialogTitle: react.ForwardRefExoticComponent<Dialog$1.TitleProps & react.RefAttributes<HTMLHeadingElement>>;
|
|
44
|
+
declare const DialogDescription: react.ForwardRefExoticComponent<Dialog$1.DescriptionProps & react.RefAttributes<HTMLDivElement>>;
|
|
45
|
+
type DialogHeaderProps = Omit<ComponentPropsWithoutRef<"div">, "title"> & {
|
|
46
|
+
title?: ReactNode;
|
|
47
|
+
description?: ReactNode;
|
|
48
|
+
inBody?: boolean;
|
|
49
|
+
titleClassName?: string;
|
|
50
|
+
descriptionClassName?: string;
|
|
51
|
+
};
|
|
52
|
+
declare const DialogHeader: FC<DialogHeaderProps>;
|
|
53
|
+
type DialogFooterProps = ComponentPropsWithoutRef<"div">;
|
|
54
|
+
type DialogBodyProps = ScrollAreaProps & {
|
|
55
|
+
actions?: ReactNode;
|
|
56
|
+
footnote?: ReactNode;
|
|
57
|
+
bodyClassName?: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Scroll area whose actions follow the content and stay pinned to the bottom
|
|
61
|
+
* once the content scrolls, so a short screen never opens a gap above them.
|
|
62
|
+
*/
|
|
63
|
+
declare function DialogBody({ children, actions, footnote, bodyClassName, className, ...props }: DialogBodyProps): react_jsx_runtime.JSX.Element;
|
|
64
|
+
declare const DialogFooter: FC<DialogFooterProps>;
|
|
65
|
+
|
|
66
|
+
export { type DialogProps as D, type ScrollAreaProps as S, Dialog as a, DialogBody as b, type DialogBodyProps as c, DialogDescription as d, DialogFooter as e, type DialogFooterProps as f, DialogHeader as g, type DialogHeaderProps as h, DialogTitle as i, ScrollArea as j };
|