@calimero-network/mero-react 2.0.1 → 2.1.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 CHANGED
@@ -234,6 +234,68 @@ import {
234
234
  } from '@calimero-network/mero-react';
235
235
  ```
236
236
 
237
+ ## Theming
238
+
239
+ `ConnectButton` and `LoginModal` default to the green Calimero palette used in admin-dashboard, tauri-app, and app-registry. Pass nothing for the default — provide a partial `MeroTheme` to override any subset.
240
+
241
+ ```tsx
242
+ import { ConnectButton } from '@calimero-network/mero-react';
243
+
244
+ // Default green palette — no theme prop needed
245
+ <ConnectButton />
246
+
247
+ // Override only what you want; the rest stay default
248
+ <ConnectButton
249
+ theme={{
250
+ primary: '#ff4081',
251
+ primaryHover: '#e91e63',
252
+ primaryText: '#ffffff',
253
+ }}
254
+ />
255
+ ```
256
+
257
+ The same theme is forwarded to the embedded `LoginModal` and is also exposed as CSS variables on the component root, so a global stylesheet works too:
258
+
259
+ ```css
260
+ :root {
261
+ --mero-accent: #ff4081;
262
+ --mero-accent-hover: #e91e63;
263
+ }
264
+ ```
265
+
266
+ `MeroTheme` keys (all optional): `primary`, `primaryHover`, `primaryText`, `background`, `backgroundSecondary`, `backgroundTertiary`, `border`, `text`, `textSecondary`, `error`, `overlay`, `radius`. Defaults: `#a5ff11` / `#8ed40d` / `#0d1117` / `#161b22` / `#1c2128` / `#30363d` / `#e6edf3` / `#8b949e` / `#ff6b6b` / `rgba(0,0,0,0.75)` / `8px`.
267
+
268
+ Helpers: `defaultMeroTheme` (the full default palette), `resolveMeroTheme(partial?)` (merges a partial with defaults), and `themeToCssVars(resolved)` (returns a `CSSProperties` map of `--mero-*` variables for applying to your own container) are exported for advanced use.
269
+
270
+ **Browser support**: hover-state and modal tints use CSS [`color-mix()`](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color-mix), which requires Chrome 111+, Safari 16.2+, or Firefox 113+ (all 2023). On older browsers the bundled `styles.css` falls back to the default green `rgba()` for the button hover; the modal renders without subtle tints but is otherwise fully functional.
271
+
272
+ ### `<ConnectButton>` props
273
+
274
+ ```tsx
275
+ // Square 40×40 icon button — logo only, no text
276
+ <ConnectButton logoOnly />
277
+
278
+ // Custom label (shorthand: bare string overrides the disconnected label)
279
+ <ConnectButton label="Sign in with Calimero" />
280
+
281
+ // Per-state label overrides
282
+ <ConnectButton
283
+ label={{
284
+ connect: 'Sign in',
285
+ connected: 'Signed in',
286
+ reconnecting: 'Reconnecting…',
287
+ }}
288
+ />
289
+ ```
290
+
291
+ | Prop | Type | Default | Notes |
292
+ |------|------|---------|-------|
293
+ | `connectionType` | `ConnectionType \| CustomConnectionConfig` | `RemoteAndLocal` | Which options the embedded LoginModal shows. `Custom` skips the modal. |
294
+ | `theme` | `MeroTheme` | — | Partial token override. |
295
+ | `logoOnly` | `boolean` | `false` | Render only the Calimero logo (square button). The label is still announced via `aria-label`. |
296
+ | `label` | `string \| { connect?, connected?, reconnecting? }` | — | Override default labels. Bare string targets the disconnected state. |
297
+ | `className` / `style` | — | — | Forwarded to the inner `<button>`. |
298
+
237
299
  ## Enums
238
300
 
239
301
  ```tsx
@@ -260,6 +322,8 @@ import type {
260
322
  ApplicationContextRecord,// { contextId, applicationId }
261
323
  ContextDiscoveryOptions, // options for useContextDiscovery
262
324
  ContextDiscoveryState, // return type of useContextDiscovery
325
+ MeroTheme, // partial theme override for ConnectButton / LoginModal
326
+ ResolvedMeroTheme, // fully populated theme returned by resolveMeroTheme()
263
327
  } from '@calimero-network/mero-react';
264
328
  ```
265
329
 
@@ -272,6 +336,9 @@ MeroProvider, useMero, MeroContext
272
336
  // Components (mero-react)
273
337
  ConnectButton, LoginModal
274
338
 
339
+ // Theming (mero-react)
340
+ MeroTheme, ResolvedMeroTheme, defaultMeroTheme, resolveMeroTheme, themeToCssVars
341
+
275
342
  // Enums (mero-react)
276
343
  AppMode, ConnectionType
277
344