@bloxwap/hig 0.5.2 → 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.
Files changed (199) hide show
  1. package/README.md +1 -1
  2. package/chart/README.md +1 -1
  3. package/contracts/README.md +1 -1
  4. package/contracts/dist/index.d.ts +16 -0
  5. package/contracts/dist/index.js +22 -0
  6. package/contracts/dist/messages.d.ts +37 -4
  7. package/contracts/dist/messages.js +13 -2
  8. package/feedback/README.md +1 -1
  9. package/native/README.md +1 -1
  10. package/native/dist/account-block.d.ts +92 -0
  11. package/native/dist/account-block.js +61 -0
  12. package/native/dist/animated-number-model.d.ts +7 -1
  13. package/native/dist/animated-number-model.js +50 -1
  14. package/native/dist/animated-number.d.ts +3 -1
  15. package/native/dist/animated-number.js +8 -5
  16. package/native/dist/asset-balance-row.d.ts +36 -0
  17. package/native/dist/asset-balance-row.js +26 -0
  18. package/native/dist/bar-mark.d.ts +57 -0
  19. package/native/dist/bar-mark.js +48 -0
  20. package/native/dist/bar-pnl.d.ts +50 -0
  21. package/native/dist/bar-pnl.js +60 -0
  22. package/native/dist/blocks.d.ts +38 -0
  23. package/native/dist/blocks.js +42 -0
  24. package/native/dist/button.js +3 -1
  25. package/native/dist/data.d.ts +1 -1
  26. package/native/dist/data.js +6 -4
  27. package/native/dist/field.d.ts +14 -5
  28. package/native/dist/field.js +33 -8
  29. package/native/dist/figure.d.ts +23 -0
  30. package/native/dist/figure.js +10 -0
  31. package/native/dist/icons.d.ts +8 -0
  32. package/native/dist/icons.js +4 -0
  33. package/native/dist/language-block.d.ts +35 -0
  34. package/native/dist/language-block.js +30 -0
  35. package/native/dist/list-group.d.ts +60 -0
  36. package/native/dist/list-group.js +85 -0
  37. package/native/dist/manage-position-block.d.ts +95 -0
  38. package/native/dist/manage-position-block.js +82 -0
  39. package/native/dist/market-row.d.ts +46 -0
  40. package/native/dist/market-row.js +30 -0
  41. package/native/dist/notifications-block.d.ts +53 -0
  42. package/native/dist/notifications-block.js +22 -0
  43. package/native/dist/pickers.d.ts +35 -5
  44. package/native/dist/pickers.js +21 -9
  45. package/native/dist/position-block.d.ts +107 -0
  46. package/native/dist/position-block.js +55 -0
  47. package/native/dist/profile-block.d.ts +66 -0
  48. package/native/dist/profile-block.js +48 -0
  49. package/native/dist/provider.d.ts +9 -3
  50. package/native/dist/provider.js +7 -3
  51. package/native/dist/radio-group.d.ts +9 -3
  52. package/native/dist/radio-group.js +4 -5
  53. package/native/dist/recipes.d.ts +6 -46
  54. package/native/dist/recipes.js +6 -33
  55. package/native/dist/reward-block.d.ts +122 -0
  56. package/native/dist/reward-block.js +53 -0
  57. package/native/dist/screen-header.d.ts +49 -0
  58. package/native/dist/screen-header.js +29 -0
  59. package/native/dist/selection.d.ts +2 -2
  60. package/native/dist/setting-header.d.ts +2 -0
  61. package/native/dist/setting-header.js +2 -0
  62. package/native/dist/setting-switch.d.ts +31 -0
  63. package/native/dist/setting-switch.js +20 -0
  64. package/native/dist/signals-block.d.ts +61 -0
  65. package/native/dist/signals-block.js +26 -0
  66. package/native/dist/sound-haptics-block.d.ts +66 -0
  67. package/native/dist/sound-haptics-block.js +32 -0
  68. package/native/dist/status.d.ts +6 -5
  69. package/native/dist/status.js +5 -5
  70. package/native/dist/sticky-header.d.ts +28 -0
  71. package/native/dist/sticky-header.js +21 -0
  72. package/native/dist/surface.d.ts +3 -1
  73. package/native/dist/surface.js +2 -1
  74. package/native/dist/{swap-panel.d.ts → swap-panel-block.d.ts} +8 -3
  75. package/native/dist/{swap-panel.js → swap-panel-block.js} +13 -8
  76. package/native/dist/swap-parts.d.ts +5 -3
  77. package/native/dist/swap-parts.js +2 -2
  78. package/native/dist/swap-shared.d.ts +6 -0
  79. package/native/dist/swap-sheet.d.ts +4 -4
  80. package/native/dist/swap-sheet.js +4 -4
  81. package/native/dist/swap-views.d.ts +1 -1
  82. package/native/dist/swap-views.js +9 -7
  83. package/native/dist/switch-row.d.ts +3 -2
  84. package/native/dist/switch-row.js +5 -3
  85. package/native/dist/switch.d.ts +4 -2
  86. package/native/dist/switch.js +3 -3
  87. package/native/dist/target-block.d.ts +110 -0
  88. package/native/dist/target-block.js +74 -0
  89. package/native/dist/token-action-block.d.ts +47 -0
  90. package/native/dist/token-action-block.js +28 -0
  91. package/native/dist/trade-history-detail-block.d.ts +84 -0
  92. package/native/dist/trade-history-detail-block.js +46 -0
  93. package/native/dist/trade-history-list-block.d.ts +110 -0
  94. package/native/dist/trade-history-list-block.js +64 -0
  95. package/native/dist/wallet-address-core.d.ts +25 -0
  96. package/native/dist/wallet-address-core.js +31 -0
  97. package/native/dist/wallet-address.d.ts +6 -10
  98. package/native/dist/wallet-address.js +16 -20
  99. package/native-fonts/README.md +1 -1
  100. package/og-fonts/README.md +1 -1
  101. package/package.json +266 -41
  102. package/react/README.md +1 -1
  103. package/react/dist/animated-number-model.d.ts +6 -0
  104. package/react/dist/animated-number-model.js +33 -0
  105. package/react/dist/animated-number.d.ts +5 -1
  106. package/react/dist/animated-number.js +12 -8
  107. package/react/dist/asset-balance-row.d.ts +35 -0
  108. package/react/dist/asset-balance-row.js +18 -0
  109. package/react/dist/bar-mark.d.ts +38 -0
  110. package/react/dist/bar-mark.js +23 -0
  111. package/react/dist/bar-pnl.d.ts +49 -0
  112. package/react/dist/bar-pnl.js +45 -0
  113. package/react/dist/blocks/account-block.d.ts +92 -0
  114. package/react/dist/blocks/account-block.js +62 -0
  115. package/react/dist/blocks/language-block.d.ts +36 -0
  116. package/react/dist/blocks/language-block.js +52 -0
  117. package/react/dist/blocks/manage-position-block.d.ts +93 -0
  118. package/react/dist/blocks/manage-position-block.js +47 -0
  119. package/react/dist/blocks/market-row.d.ts +36 -0
  120. package/react/dist/blocks/market-row.js +16 -0
  121. package/react/dist/blocks/notifications-block.d.ts +46 -0
  122. package/react/dist/blocks/notifications-block.js +17 -0
  123. package/react/dist/{recipes → blocks}/pickers.d.ts +32 -4
  124. package/react/dist/{recipes → blocks}/pickers.js +35 -11
  125. package/react/dist/blocks/position-block.d.ts +72 -0
  126. package/react/dist/blocks/position-block.js +25 -0
  127. package/react/dist/blocks/profile-block.d.ts +71 -0
  128. package/react/dist/blocks/profile-block.js +41 -0
  129. package/react/dist/blocks/reward-block.d.ts +120 -0
  130. package/react/dist/blocks/reward-block.js +34 -0
  131. package/react/dist/blocks/screen-header.d.ts +33 -0
  132. package/react/dist/blocks/screen-header.js +20 -0
  133. package/react/dist/blocks/setting-switch.d.ts +23 -0
  134. package/react/dist/blocks/setting-switch.js +12 -0
  135. package/react/dist/blocks/signals-block.d.ts +54 -0
  136. package/react/dist/blocks/signals-block.js +15 -0
  137. package/react/dist/blocks/sound-haptics-block.d.ts +59 -0
  138. package/react/dist/blocks/sound-haptics-block.js +22 -0
  139. package/react/dist/blocks/sticky-header.d.ts +9 -0
  140. package/react/dist/blocks/sticky-header.js +43 -0
  141. package/react/dist/blocks/swap/amount-card.js +8 -0
  142. package/react/dist/{recipes → blocks}/swap/picker.d.ts +1 -1
  143. package/react/dist/{recipes → blocks}/swap/picker.js +4 -4
  144. package/react/dist/{recipes → blocks}/swap/settings.js +2 -2
  145. package/react/dist/{recipes → blocks}/swap/shared.d.ts +8 -1
  146. package/react/dist/{recipes → blocks}/swap/shared.js +7 -4
  147. package/react/dist/{recipes/swap-panel.d.ts → blocks/swap-panel-block.d.ts} +8 -2
  148. package/react/dist/{recipes/swap-panel.js → blocks/swap-panel-block.js} +9 -7
  149. package/react/dist/{recipes → blocks}/swap-sheet.d.ts +4 -4
  150. package/react/dist/{recipes → blocks}/swap-sheet.js +4 -4
  151. package/react/dist/blocks/target-block.d.ts +103 -0
  152. package/react/dist/blocks/target-block.js +73 -0
  153. package/react/dist/blocks/token-action-block.d.ts +46 -0
  154. package/react/dist/blocks/token-action-block.js +21 -0
  155. package/react/dist/{recipes → blocks}/trade-entry.js +2 -2
  156. package/react/dist/blocks/trade-history-detail-block.d.ts +78 -0
  157. package/react/dist/blocks/trade-history-detail-block.js +17 -0
  158. package/react/dist/blocks/trade-history-list-block.d.ts +67 -0
  159. package/react/dist/blocks/trade-history-list-block.js +28 -0
  160. package/react/dist/blocks.d.ts +20 -0
  161. package/react/dist/blocks.js +21 -0
  162. package/react/dist/button.js +6 -4
  163. package/react/dist/data.js +3 -3
  164. package/react/dist/field.d.ts +14 -6
  165. package/react/dist/field.js +19 -8
  166. package/react/dist/figure.d.ts +23 -0
  167. package/react/dist/figure.js +12 -0
  168. package/react/dist/list-group.d.ts +59 -0
  169. package/react/dist/list-group.js +52 -0
  170. package/react/dist/provider.d.ts +40 -3
  171. package/react/dist/provider.js +63 -6
  172. package/react/dist/selection.d.ts +8 -2
  173. package/react/dist/selection.js +11 -6
  174. package/react/dist/styles.css +425 -5
  175. package/react/dist/surface.d.ts +5 -1
  176. package/react/dist/surface.js +1 -1
  177. package/react/dist/wallet-address-core.d.ts +23 -0
  178. package/react/dist/wallet-address-core.js +24 -0
  179. package/react/dist/wallet-address.d.ts +6 -12
  180. package/react/dist/wallet-address.js +5 -16
  181. package/tokens/README.md +1 -1
  182. package/react/dist/recipes/activity-list.d.ts +0 -8
  183. package/react/dist/recipes/activity-list.js +0 -6
  184. package/react/dist/recipes/balance-card.d.ts +0 -6
  185. package/react/dist/recipes/balance-card.js +0 -5
  186. package/react/dist/recipes/code-window.d.ts +0 -4
  187. package/react/dist/recipes/code-window.js +0 -4
  188. package/react/dist/recipes/market-row.d.ts +0 -25
  189. package/react/dist/recipes/market-row.js +0 -8
  190. package/react/dist/recipes/swap/amount-card.js +0 -7
  191. package/react/dist/recipes.d.ts +0 -10
  192. package/react/dist/recipes.js +0 -11
  193. /package/react/dist/{recipes → blocks}/install-command.d.ts +0 -0
  194. /package/react/dist/{recipes → blocks}/install-command.js +0 -0
  195. /package/react/dist/{recipes → blocks}/marketing-hero.d.ts +0 -0
  196. /package/react/dist/{recipes → blocks}/marketing-hero.js +0 -0
  197. /package/react/dist/{recipes → blocks}/swap/amount-card.d.ts +0 -0
  198. /package/react/dist/{recipes → blocks}/swap/settings.d.ts +0 -0
  199. /package/react/dist/{recipes → blocks}/trade-entry.d.ts +0 -0
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { type AddressKind } from './data.js';
3
+ export { VerticalAddress, addressKind, type AddressKind } from './data.js';
4
+ export interface WalletAddressCoreProps {
5
+ address: string;
6
+ kind?: AddressKind;
7
+ /** The QR code, drawn by the host (its own encoder or SVG), laid out in a `size` square. It is read as one image named by the built-in “QR code” label. */
8
+ qr: React.ReactNode;
9
+ /** QR edge in dp; default 196. The address column is exactly as tall. */
10
+ size?: number;
11
+ /** Host clipboard adapter. When set the whole component is one button that copies the address and shows the Tap to copy hint. */
12
+ onCopy?: () => Promise<void> | void;
13
+ /** `false` shows no “Address copied” notice after a copy, for a host that confirms the copy itself. Default `true`. */
14
+ announce?: boolean;
15
+ testID?: string;
16
+ }
17
+ /** @internal The layout both `WalletAddress` entries share. `code` is the QR as drawn, already named for assistive technology. */
18
+ export declare function WalletAddressFrame({ address, kind, code, size, onCopy, announce, testID }: Omit<WalletAddressCoreProps, 'qr'> & {
19
+ code: React.ReactNode;
20
+ }): React.JSX.Element;
21
+ /**
22
+ * `WalletAddress` without the QR encoder: the host passes the code as `qr`, so neither `cuer` nor `react-native-svg` is
23
+ * needed. The address column, the copy button, its hint and the notice are the same as `WalletAddress` from `wallet-address`.
24
+ */
25
+ export declare function WalletAddress({ qr, ...props }: WalletAddressCoreProps): React.JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Pressable, View } from 'react-native';
3
+ import { useColors, useMessages } from './provider.js';
4
+ import { Text } from './surface.js';
5
+ import { Toast, useTransientNotice } from './status.js';
6
+ import { VerticalAddress, addressKind } from './data.js';
7
+ export { VerticalAddress, addressKind } from './data.js';
8
+ const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
9
+ /** Two overlapping rounded squares: copy. */
10
+ function CopyIcon({ color }) { return _jsxs(View, { ...hidden, style: { width: 16, height: 16 }, children: [_jsx(View, { style: { position: 'absolute', left: 0, top: 0, width: 11, height: 11, borderRadius: 3, borderWidth: 1.5, borderColor: color } }), _jsx(View, { style: { position: 'absolute', right: 0, bottom: 0, width: 11, height: 11, borderRadius: 3, borderWidth: 1.5, borderColor: color } })] }); }
11
+ /** @internal The layout both `WalletAddress` entries share. `code` is the QR as drawn, already named for assistive technology. */
12
+ export function WalletAddressFrame({ address, kind, code, size = 196, onCopy, announce = true, testID }) {
13
+ const colors = useColors();
14
+ const t = useMessages();
15
+ const { notice, show, dismiss } = useTransientNotice();
16
+ const layout = kind ?? addressKind(address), rows = Math.max(1, Math.ceil(address.length / (layout === 'ethereum' ? 6 : 4)));
17
+ const body = _jsxs(_Fragment, { children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 16 }, children: [_jsx(View, { style: { width: size, height: size }, children: code }), _jsx(VerticalAddress, { address: address, kind: layout, rowHeight: size / rows, testID: 'wallet-address-column' })] }), onCopy ? _jsxs(View, { ...hidden, style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8, marginTop: 12 }, children: [_jsx(CopyIcon, { color: colors.muted }), _jsx(Text, { style: { color: colors.muted, fontSize: 14, lineHeight: 21 }, children: t.tapToCopy })] }) : null] });
18
+ const copy = () => { if (!onCopy)
19
+ return; Promise.resolve().then(onCopy).then(() => { if (announce)
20
+ show(t.addressCopied); }).catch(() => { }); };
21
+ // The toast sits outside the button so its dismiss control is not nested in another control.
22
+ return _jsxs(View, { testID: testID, style: { alignItems: 'center' }, children: [onCopy ? _jsx(Pressable, { accessibilityRole: 'button', accessibilityLabel: `${t.copyAddress}: ${address}`, testID: 'wallet-address-copy', onPress: copy, style: ({ pressed }) => ({ opacity: pressed ? 0.8 : 1 }), children: body }) : _jsx(View, { children: body }), notice ? _jsx(View, { style: { marginTop: 8 }, children: _jsx(Toast, { notices: [notice], onDismiss: dismiss }) }) : null] });
23
+ }
24
+ /**
25
+ * `WalletAddress` without the QR encoder: the host passes the code as `qr`, so neither `cuer` nor `react-native-svg` is
26
+ * needed. The address column, the copy button, its hint and the notice are the same as `WalletAddress` from `wallet-address`.
27
+ */
28
+ export function WalletAddress({ qr, ...props }) {
29
+ const t = useMessages();
30
+ return _jsx(WalletAddressFrame, { ...props, code: _jsx(View, { accessible: true, accessibilityRole: 'image', accessibilityLabel: t.qrCode, testID: 'wallet-address-qr', style: { width: '100%', height: '100%' }, children: qr }) });
31
+ }
@@ -1,18 +1,14 @@
1
1
  import React from 'react';
2
- import { type AddressKind } from './data.js';
2
+ import { type WalletAddressCoreProps } from './wallet-address-core.js';
3
3
  export { VerticalAddress, addressKind, type AddressKind } from './data.js';
4
- export interface WalletAddressProps {
5
- address: string;
6
- kind?: AddressKind;
4
+ export type { WalletAddressCoreProps } from './wallet-address-core.js';
5
+ export interface WalletAddressProps extends Omit<WalletAddressCoreProps, 'qr'> {
7
6
  /** QR payload when it differs from the address, e.g. an EIP-681 or Solana Pay URI. Defaults to the address. */
8
7
  qrValue?: string;
9
8
  /** Image URL shown in the centre of the QR. */
10
9
  arena?: string;
11
- /** QR edge in dp; default 196. */
12
- size?: number;
13
- /** Host clipboard adapter. When set the whole component is one button that copies the address and shows the Tap to copy hint. */
14
- onCopy?: () => Promise<void> | void;
15
- testID?: string;
10
+ /** The host's own QR drawing in place of the cuer-style code; `qrValue` and `arena` are then unused and nothing is encoded. Without `cuer` installed, import `WalletAddress` from `wallet-address-core` instead. */
11
+ qr?: React.ReactNode;
16
12
  }
17
13
  /** The QR's drawing, in module units: three finder origins, one path of round dots for every other dark module, and the centre square left clear for an arena. */
18
14
  export declare function qrGeometry(grid: readonly (readonly boolean[])[], withArena: boolean): {
@@ -34,4 +30,4 @@ export declare function qrGeometry(grid: readonly (readonly boolean[])[], withAr
34
30
  * With `onCopy` the whole component is one button and a Tap to copy hint sits under it. Needs the optional `cuer` and
35
31
  * `react-native-svg` peers; the encoder comes from `cuer/QrCode`, so React DOM is never loaded.
36
32
  */
37
- export declare function WalletAddress({ address, kind, qrValue, arena, size, onCopy, testID }: WalletAddressProps): React.JSX.Element;
33
+ export declare function WalletAddress({ qrValue, arena, qr, ...props }: WalletAddressProps): React.JSX.Element;
@@ -1,12 +1,10 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useMemo } from 'react';
3
- import { Image, Pressable, View } from 'react-native';
3
+ import { Image } from 'react-native';
4
4
  import Svg, { Path, Rect } from 'react-native-svg';
5
5
  import { create } from 'cuer/QrCode';
6
6
  import { useColors, useMessages } from './provider.js';
7
- import { Text } from './surface.js';
8
- import { Toast, useTransientNotice } from './status.js';
9
- import { VerticalAddress, addressKind } from './data.js';
7
+ import { WalletAddress as WalletAddressCore, WalletAddressFrame } from './wallet-address-core.js';
10
8
  export { VerticalAddress, addressKind } from './data.js';
11
9
  const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
12
10
  /** The QR's drawing, in module units: three finder origins, one path of round dots for every other dark module, and the centre square left clear for an arena. */
@@ -25,26 +23,24 @@ export function qrGeometry(grid, withArena) {
25
23
  }
26
24
  return { edge, finders: [{ x: 0, y: 0 }, { x: far, y: 0 }, { x: 0, y: far }], dots, count, arena: size > 0 ? { origin, size } : null };
27
25
  }
28
- /** Two overlapping rounded squares: copy. */
29
- function CopyIcon({ color }) { return _jsxs(View, { ...hidden, style: { width: 16, height: 16 }, children: [_jsx(View, { style: { position: 'absolute', left: 0, top: 0, width: 11, height: 11, borderRadius: 3, borderWidth: 1.5, borderColor: color } }), _jsx(View, { style: { position: 'absolute', right: 0, bottom: 0, width: 11, height: 11, borderRadius: 3, borderWidth: 1.5, borderColor: color } })] }); }
26
+ /** The cuer-style code: round dots, rounded finder patterns, no tile, and an optional arena image in the centre. */
27
+ function CuerCode({ value, arena, size }) {
28
+ const colors = useColors();
29
+ const t = useMessages();
30
+ const withArena = !!arena;
31
+ const qr = useMemo(() => qrGeometry(create(value, { errorCorrection: withArena ? 'high' : 'medium' }).grid, withArena), [value, withArena]);
32
+ const unit = size / qr.edge;
33
+ return _jsxs(_Fragment, { children: [_jsxs(Svg, { width: size, height: size, viewBox: `0 0 ${qr.edge} ${qr.edge}`, accessible: true, accessibilityRole: 'image', accessibilityLabel: t.qrCode, testID: 'wallet-address-qr', children: [qr.finders.map((finder, index) => _jsxs(React.Fragment, { children: [_jsx(Rect, { x: finder.x + 0.5, y: finder.y + 0.5, width: 6, height: 6, rx: 1.75, fill: 'none', stroke: colors.text, strokeWidth: 1 }), _jsx(Rect, { x: finder.x + 2, y: finder.y + 2, width: 3, height: 3, rx: 0.75, fill: colors.text })] }, index)), _jsx(Path, { d: qr.dots, fill: colors.text })] }), arena && qr.arena ? _jsx(Image, { ...hidden, source: { uri: arena }, testID: 'wallet-address-arena', style: { position: 'absolute', left: (qr.arena.origin + 0.5) * unit, top: (qr.arena.origin + 0.5) * unit, width: (qr.arena.size - 1) * unit, height: (qr.arena.size - 1) * unit, borderRadius: unit } }) : null] });
34
+ }
30
35
  /**
31
36
  * A wallet address to scan or copy: the QR in the cuer style (round dots, rounded finder patterns, no tile) beside the
32
37
  * address as a monospace column exactly as tall as the code. Ethereum (`0x…`) lays out 6 characters a row and Solana 4.
33
38
  * With `onCopy` the whole component is one button and a Tap to copy hint sits under it. Needs the optional `cuer` and
34
39
  * `react-native-svg` peers; the encoder comes from `cuer/QrCode`, so React DOM is never loaded.
35
40
  */
36
- export function WalletAddress({ address, kind, qrValue, arena, size = 196, onCopy, testID }) {
37
- const colors = useColors();
38
- const t = useMessages();
39
- const { notice, show, dismiss } = useTransientNotice();
40
- const layout = kind ?? addressKind(address), rows = Math.max(1, Math.ceil(address.length / (layout === 'ethereum' ? 6 : 4)));
41
- const value = qrValue ?? address, withArena = !!arena;
42
- const qr = useMemo(() => qrGeometry(create(value, { errorCorrection: withArena ? 'high' : 'medium' }).grid, withArena), [value, withArena]);
43
- const unit = size / qr.edge;
44
- const code = _jsxs(View, { style: { width: size, height: size }, children: [_jsxs(Svg, { width: size, height: size, viewBox: `0 0 ${qr.edge} ${qr.edge}`, accessible: true, accessibilityRole: 'image', accessibilityLabel: t.qrCode, testID: 'wallet-address-qr', children: [qr.finders.map((finder, index) => _jsxs(React.Fragment, { children: [_jsx(Rect, { x: finder.x + 0.5, y: finder.y + 0.5, width: 6, height: 6, rx: 1.75, fill: 'none', stroke: colors.text, strokeWidth: 1 }), _jsx(Rect, { x: finder.x + 2, y: finder.y + 2, width: 3, height: 3, rx: 0.75, fill: colors.text })] }, index)), _jsx(Path, { d: qr.dots, fill: colors.text })] }), arena && qr.arena ? _jsx(Image, { ...hidden, source: { uri: arena }, testID: 'wallet-address-arena', style: { position: 'absolute', left: (qr.arena.origin + 0.5) * unit, top: (qr.arena.origin + 0.5) * unit, width: (qr.arena.size - 1) * unit, height: (qr.arena.size - 1) * unit, borderRadius: unit } }) : null] });
45
- const body = _jsxs(_Fragment, { children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 16 }, children: [code, _jsx(VerticalAddress, { address: address, kind: layout, rowHeight: size / rows, testID: 'wallet-address-column' })] }), onCopy ? _jsxs(View, { ...hidden, style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8, marginTop: 12 }, children: [_jsx(CopyIcon, { color: colors.muted }), _jsx(Text, { style: { color: colors.muted, fontSize: 14, lineHeight: 21 }, children: t.tapToCopy })] }) : null] });
46
- const copy = () => { if (!onCopy)
47
- return; Promise.resolve().then(onCopy).then(() => show(t.addressCopied)).catch(() => { }); };
48
- // The toast sits outside the button so its dismiss control is not nested in another control.
49
- return _jsxs(View, { testID: testID, style: { alignItems: 'center' }, children: [onCopy ? _jsx(Pressable, { accessibilityRole: 'button', accessibilityLabel: `${t.copyAddress}: ${address}`, testID: 'wallet-address-copy', onPress: copy, style: ({ pressed }) => ({ opacity: pressed ? 0.8 : 1 }), children: body }) : _jsx(View, { children: body }), notice ? _jsx(View, { style: { marginTop: 8 }, children: _jsx(Toast, { notices: [notice], onDismiss: dismiss }) }) : null] });
41
+ export function WalletAddress({ qrValue, arena, qr, ...props }) {
42
+ // As on web, `null` falls back to the cuer code like a missing `qr`.
43
+ if (qr != null)
44
+ return _jsx(WalletAddressCore, { ...props, qr: qr });
45
+ return _jsx(WalletAddressFrame, { ...props, code: _jsx(CuerCode, { value: qrValue ?? props.address, arena: arena, size: props.size ?? 196 }) });
50
46
  }
@@ -1,6 +1,6 @@
1
1
  # @bloxwap/hig/native-fonts
2
2
 
3
- Version 0.5.2, an entry of `@bloxwap/hig`. Static Bloxwap Sans/Mono (and Korean/Simplified Chinese Sans) TTF faces for React Native and Expo hosts, derived reproducibly from pinned `@bloxwap/font` 0.1.4 by `npm run generate:fonts`.
3
+ Version 0.7.0, an entry of `@bloxwap/hig`. Static Bloxwap Sans/Mono (and Korean/Simplified Chinese Sans) TTF faces for React Native and Expo hosts, derived reproducibly from pinned `@bloxwap/font` 0.1.4 by `npm run generate:fonts`.
4
4
 
5
5
  Web hosts never import this entry: load fonts through `@bloxwap/font` and use `@bloxwap/hig/tokens/css`. Open Graph card renderers (Satori, `next/og`) use the much smaller `@bloxwap/hig/og-fonts` entry instead (#99).
6
6
 
@@ -1,6 +1,6 @@
1
1
  # @bloxwap/hig/og-fonts
2
2
 
3
- Version 0.5.2, an entry of `@bloxwap/hig`. Five static Latin Bloxwap Sans/Mono TTF faces for Open Graph card renderers: Satori, `next/og` `ImageResponse` and `@vercel/og`. Satori reads TTF/OTF but not WOFF2, and `@bloxwap/font` ships only WOFF2.
3
+ Version 0.7.0, an entry of `@bloxwap/hig`. Five static Latin Bloxwap Sans/Mono TTF faces for Open Graph card renderers: Satori, `next/og` `ImageResponse` and `@vercel/og`. Satori reads TTF/OTF but not WOFF2, and `@bloxwap/font` ships only WOFF2.
4
4
 
5
5
  | Face | File | Weight |
6
6
  | --- | --- | --- |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloxwap/hig",
3
- "version": "0.5.2",
3
+ "version": "0.7.0",
4
4
  "description": "Bloxwap Human Interface Guidelines: tokens, contracts, React and React Native components, chart adapter, feedback and fonts in one package.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -155,60 +155,90 @@
155
155
  "import": "./react/dist/brand.js",
156
156
  "default": "./react/dist/brand.js"
157
157
  },
158
+ "./react/blocks": {
159
+ "types": "./react/dist/blocks.d.ts",
160
+ "import": "./react/dist/blocks.js",
161
+ "default": "./react/dist/blocks.js"
162
+ },
158
163
  "./react/recipes": {
159
- "types": "./react/dist/recipes.d.ts",
160
- "import": "./react/dist/recipes.js",
161
- "default": "./react/dist/recipes.js"
164
+ "types": "./react/dist/blocks.d.ts",
165
+ "import": "./react/dist/blocks.js",
166
+ "default": "./react/dist/blocks.js"
167
+ },
168
+ "./react/blocks/market-row": {
169
+ "types": "./react/dist/blocks/market-row.d.ts",
170
+ "import": "./react/dist/blocks/market-row.js",
171
+ "default": "./react/dist/blocks/market-row.js"
162
172
  },
163
173
  "./react/recipes/market-row": {
164
- "types": "./react/dist/recipes/market-row.d.ts",
165
- "import": "./react/dist/recipes/market-row.js",
166
- "default": "./react/dist/recipes/market-row.js"
174
+ "types": "./react/dist/blocks/market-row.d.ts",
175
+ "import": "./react/dist/blocks/market-row.js",
176
+ "default": "./react/dist/blocks/market-row.js"
167
177
  },
168
- "./react/recipes/balance-card": {
169
- "types": "./react/dist/recipes/balance-card.d.ts",
170
- "import": "./react/dist/recipes/balance-card.js",
171
- "default": "./react/dist/recipes/balance-card.js"
178
+ "./react/blocks/trade-entry": {
179
+ "types": "./react/dist/blocks/trade-entry.d.ts",
180
+ "import": "./react/dist/blocks/trade-entry.js",
181
+ "default": "./react/dist/blocks/trade-entry.js"
172
182
  },
173
183
  "./react/recipes/trade-entry": {
174
- "types": "./react/dist/recipes/trade-entry.d.ts",
175
- "import": "./react/dist/recipes/trade-entry.js",
176
- "default": "./react/dist/recipes/trade-entry.js"
184
+ "types": "./react/dist/blocks/trade-entry.d.ts",
185
+ "import": "./react/dist/blocks/trade-entry.js",
186
+ "default": "./react/dist/blocks/trade-entry.js"
187
+ },
188
+ "./react/blocks/swap-panel-block": {
189
+ "types": "./react/dist/blocks/swap-panel-block.d.ts",
190
+ "import": "./react/dist/blocks/swap-panel-block.js",
191
+ "default": "./react/dist/blocks/swap-panel-block.js"
192
+ },
193
+ "./react/blocks/swap-panel": {
194
+ "types": "./react/dist/blocks/swap-panel-block.d.ts",
195
+ "import": "./react/dist/blocks/swap-panel-block.js",
196
+ "default": "./react/dist/blocks/swap-panel-block.js"
177
197
  },
178
198
  "./react/recipes/swap-panel": {
179
- "types": "./react/dist/recipes/swap-panel.d.ts",
180
- "import": "./react/dist/recipes/swap-panel.js",
181
- "default": "./react/dist/recipes/swap-panel.js"
199
+ "types": "./react/dist/blocks/swap-panel-block.d.ts",
200
+ "import": "./react/dist/blocks/swap-panel-block.js",
201
+ "default": "./react/dist/blocks/swap-panel-block.js"
202
+ },
203
+ "./react/blocks/pickers": {
204
+ "types": "./react/dist/blocks/pickers.d.ts",
205
+ "import": "./react/dist/blocks/pickers.js",
206
+ "default": "./react/dist/blocks/pickers.js"
182
207
  },
183
208
  "./react/recipes/pickers": {
184
- "types": "./react/dist/recipes/pickers.d.ts",
185
- "import": "./react/dist/recipes/pickers.js",
186
- "default": "./react/dist/recipes/pickers.js"
209
+ "types": "./react/dist/blocks/pickers.d.ts",
210
+ "import": "./react/dist/blocks/pickers.js",
211
+ "default": "./react/dist/blocks/pickers.js"
212
+ },
213
+ "./react/blocks/swap-sheet": {
214
+ "types": "./react/dist/blocks/swap-sheet.d.ts",
215
+ "import": "./react/dist/blocks/swap-sheet.js",
216
+ "default": "./react/dist/blocks/swap-sheet.js"
187
217
  },
188
218
  "./react/recipes/swap-sheet": {
189
- "types": "./react/dist/recipes/swap-sheet.d.ts",
190
- "import": "./react/dist/recipes/swap-sheet.js",
191
- "default": "./react/dist/recipes/swap-sheet.js"
219
+ "types": "./react/dist/blocks/swap-sheet.d.ts",
220
+ "import": "./react/dist/blocks/swap-sheet.js",
221
+ "default": "./react/dist/blocks/swap-sheet.js"
222
+ },
223
+ "./react/blocks/install-command": {
224
+ "types": "./react/dist/blocks/install-command.d.ts",
225
+ "import": "./react/dist/blocks/install-command.js",
226
+ "default": "./react/dist/blocks/install-command.js"
192
227
  },
193
228
  "./react/recipes/install-command": {
194
- "types": "./react/dist/recipes/install-command.d.ts",
195
- "import": "./react/dist/recipes/install-command.js",
196
- "default": "./react/dist/recipes/install-command.js"
229
+ "types": "./react/dist/blocks/install-command.d.ts",
230
+ "import": "./react/dist/blocks/install-command.js",
231
+ "default": "./react/dist/blocks/install-command.js"
197
232
  },
198
- "./react/recipes/code-window": {
199
- "types": "./react/dist/recipes/code-window.d.ts",
200
- "import": "./react/dist/recipes/code-window.js",
201
- "default": "./react/dist/recipes/code-window.js"
233
+ "./react/blocks/marketing-hero": {
234
+ "types": "./react/dist/blocks/marketing-hero.d.ts",
235
+ "import": "./react/dist/blocks/marketing-hero.js",
236
+ "default": "./react/dist/blocks/marketing-hero.js"
202
237
  },
203
238
  "./react/recipes/marketing-hero": {
204
- "types": "./react/dist/recipes/marketing-hero.d.ts",
205
- "import": "./react/dist/recipes/marketing-hero.js",
206
- "default": "./react/dist/recipes/marketing-hero.js"
207
- },
208
- "./react/recipes/activity-list": {
209
- "types": "./react/dist/recipes/activity-list.d.ts",
210
- "import": "./react/dist/recipes/activity-list.js",
211
- "default": "./react/dist/recipes/activity-list.js"
239
+ "types": "./react/dist/blocks/marketing-hero.d.ts",
240
+ "import": "./react/dist/blocks/marketing-hero.js",
241
+ "default": "./react/dist/blocks/marketing-hero.js"
212
242
  },
213
243
  "./react/css": {
214
244
  "types": "./css.d.ts",
@@ -228,6 +258,101 @@
228
258
  "import": "./react/dist/wallet-address.js",
229
259
  "default": "./react/dist/wallet-address.js"
230
260
  },
261
+ "./react/wallet-address-core": {
262
+ "types": "./react/dist/wallet-address-core.d.ts",
263
+ "import": "./react/dist/wallet-address-core.js",
264
+ "default": "./react/dist/wallet-address-core.js"
265
+ },
266
+ "./react/asset-balance-row": {
267
+ "types": "./react/dist/asset-balance-row.d.ts",
268
+ "import": "./react/dist/asset-balance-row.js",
269
+ "default": "./react/dist/asset-balance-row.js"
270
+ },
271
+ "./react/blocks/account-block": {
272
+ "types": "./react/dist/blocks/account-block.d.ts",
273
+ "import": "./react/dist/blocks/account-block.js",
274
+ "default": "./react/dist/blocks/account-block.js"
275
+ },
276
+ "./react/blocks/token-action-block": {
277
+ "types": "./react/dist/blocks/token-action-block.d.ts",
278
+ "import": "./react/dist/blocks/token-action-block.js",
279
+ "default": "./react/dist/blocks/token-action-block.js"
280
+ },
281
+ "./react/blocks/language-block": {
282
+ "types": "./react/dist/blocks/language-block.d.ts",
283
+ "import": "./react/dist/blocks/language-block.js",
284
+ "default": "./react/dist/blocks/language-block.js"
285
+ },
286
+ "./react/blocks/manage-position-block": {
287
+ "types": "./react/dist/blocks/manage-position-block.d.ts",
288
+ "import": "./react/dist/blocks/manage-position-block.js",
289
+ "default": "./react/dist/blocks/manage-position-block.js"
290
+ },
291
+ "./react/blocks/target-block": {
292
+ "types": "./react/dist/blocks/target-block.d.ts",
293
+ "import": "./react/dist/blocks/target-block.js",
294
+ "default": "./react/dist/blocks/target-block.js"
295
+ },
296
+ "./react/blocks/position-block": {
297
+ "types": "./react/dist/blocks/position-block.d.ts",
298
+ "import": "./react/dist/blocks/position-block.js",
299
+ "default": "./react/dist/blocks/position-block.js"
300
+ },
301
+ "./react/blocks/reward-block": {
302
+ "types": "./react/dist/blocks/reward-block.d.ts",
303
+ "import": "./react/dist/blocks/reward-block.js",
304
+ "default": "./react/dist/blocks/reward-block.js"
305
+ },
306
+ "./react/blocks/sound-haptics-block": {
307
+ "types": "./react/dist/blocks/sound-haptics-block.d.ts",
308
+ "import": "./react/dist/blocks/sound-haptics-block.js",
309
+ "default": "./react/dist/blocks/sound-haptics-block.js"
310
+ },
311
+ "./react/blocks/signals-block": {
312
+ "types": "./react/dist/blocks/signals-block.d.ts",
313
+ "import": "./react/dist/blocks/signals-block.js",
314
+ "default": "./react/dist/blocks/signals-block.js"
315
+ },
316
+ "./react/blocks/notifications-block": {
317
+ "types": "./react/dist/blocks/notifications-block.d.ts",
318
+ "import": "./react/dist/blocks/notifications-block.js",
319
+ "default": "./react/dist/blocks/notifications-block.js"
320
+ },
321
+ "./react/blocks/trade-history-list-block": {
322
+ "types": "./react/dist/blocks/trade-history-list-block.d.ts",
323
+ "import": "./react/dist/blocks/trade-history-list-block.js",
324
+ "default": "./react/dist/blocks/trade-history-list-block.js"
325
+ },
326
+ "./react/blocks/trade-history-detail-block": {
327
+ "types": "./react/dist/blocks/trade-history-detail-block.d.ts",
328
+ "import": "./react/dist/blocks/trade-history-detail-block.js",
329
+ "default": "./react/dist/blocks/trade-history-detail-block.js"
330
+ },
331
+ "./react/blocks/profile-block": {
332
+ "types": "./react/dist/blocks/profile-block.d.ts",
333
+ "import": "./react/dist/blocks/profile-block.js",
334
+ "default": "./react/dist/blocks/profile-block.js"
335
+ },
336
+ "./react/blocks/screen-header": {
337
+ "types": "./react/dist/blocks/screen-header.d.ts",
338
+ "import": "./react/dist/blocks/screen-header.js",
339
+ "default": "./react/dist/blocks/screen-header.js"
340
+ },
341
+ "./react/bar-mark": {
342
+ "types": "./react/dist/bar-mark.d.ts",
343
+ "import": "./react/dist/bar-mark.js",
344
+ "default": "./react/dist/bar-mark.js"
345
+ },
346
+ "./react/bar-pnl": {
347
+ "types": "./react/dist/bar-pnl.d.ts",
348
+ "import": "./react/dist/bar-pnl.js",
349
+ "default": "./react/dist/bar-pnl.js"
350
+ },
351
+ "./react/list-group": {
352
+ "types": "./react/dist/list-group.d.ts",
353
+ "import": "./react/dist/list-group.js",
354
+ "default": "./react/dist/list-group.js"
355
+ },
231
356
  "./react/gesture-sheet": {
232
357
  "types": "./react/dist/gesture-sheet.d.ts",
233
358
  "import": "./react/dist/gesture-sheet.js",
@@ -243,6 +368,101 @@
243
368
  "import": "./native/dist/wallet-address.js",
244
369
  "default": "./native/dist/wallet-address.js"
245
370
  },
371
+ "./native/wallet-address-core": {
372
+ "types": "./native/dist/wallet-address-core.d.ts",
373
+ "import": "./native/dist/wallet-address-core.js",
374
+ "default": "./native/dist/wallet-address-core.js"
375
+ },
376
+ "./native/asset-balance-row": {
377
+ "types": "./native/dist/asset-balance-row.d.ts",
378
+ "import": "./native/dist/asset-balance-row.js",
379
+ "default": "./native/dist/asset-balance-row.js"
380
+ },
381
+ "./native/account-block": {
382
+ "types": "./native/dist/account-block.d.ts",
383
+ "import": "./native/dist/account-block.js",
384
+ "default": "./native/dist/account-block.js"
385
+ },
386
+ "./native/token-action-block": {
387
+ "types": "./native/dist/token-action-block.d.ts",
388
+ "import": "./native/dist/token-action-block.js",
389
+ "default": "./native/dist/token-action-block.js"
390
+ },
391
+ "./native/language-block": {
392
+ "types": "./native/dist/language-block.d.ts",
393
+ "import": "./native/dist/language-block.js",
394
+ "default": "./native/dist/language-block.js"
395
+ },
396
+ "./native/manage-position-block": {
397
+ "types": "./native/dist/manage-position-block.d.ts",
398
+ "import": "./native/dist/manage-position-block.js",
399
+ "default": "./native/dist/manage-position-block.js"
400
+ },
401
+ "./native/target-block": {
402
+ "types": "./native/dist/target-block.d.ts",
403
+ "import": "./native/dist/target-block.js",
404
+ "default": "./native/dist/target-block.js"
405
+ },
406
+ "./native/position-block": {
407
+ "types": "./native/dist/position-block.d.ts",
408
+ "import": "./native/dist/position-block.js",
409
+ "default": "./native/dist/position-block.js"
410
+ },
411
+ "./native/reward-block": {
412
+ "types": "./native/dist/reward-block.d.ts",
413
+ "import": "./native/dist/reward-block.js",
414
+ "default": "./native/dist/reward-block.js"
415
+ },
416
+ "./native/sound-haptics-block": {
417
+ "types": "./native/dist/sound-haptics-block.d.ts",
418
+ "import": "./native/dist/sound-haptics-block.js",
419
+ "default": "./native/dist/sound-haptics-block.js"
420
+ },
421
+ "./native/signals-block": {
422
+ "types": "./native/dist/signals-block.d.ts",
423
+ "import": "./native/dist/signals-block.js",
424
+ "default": "./native/dist/signals-block.js"
425
+ },
426
+ "./native/notifications-block": {
427
+ "types": "./native/dist/notifications-block.d.ts",
428
+ "import": "./native/dist/notifications-block.js",
429
+ "default": "./native/dist/notifications-block.js"
430
+ },
431
+ "./native/trade-history-list-block": {
432
+ "types": "./native/dist/trade-history-list-block.d.ts",
433
+ "import": "./native/dist/trade-history-list-block.js",
434
+ "default": "./native/dist/trade-history-list-block.js"
435
+ },
436
+ "./native/trade-history-detail-block": {
437
+ "types": "./native/dist/trade-history-detail-block.d.ts",
438
+ "import": "./native/dist/trade-history-detail-block.js",
439
+ "default": "./native/dist/trade-history-detail-block.js"
440
+ },
441
+ "./native/profile-block": {
442
+ "types": "./native/dist/profile-block.d.ts",
443
+ "import": "./native/dist/profile-block.js",
444
+ "default": "./native/dist/profile-block.js"
445
+ },
446
+ "./native/screen-header": {
447
+ "types": "./native/dist/screen-header.d.ts",
448
+ "import": "./native/dist/screen-header.js",
449
+ "default": "./native/dist/screen-header.js"
450
+ },
451
+ "./native/bar-mark": {
452
+ "types": "./native/dist/bar-mark.d.ts",
453
+ "import": "./native/dist/bar-mark.js",
454
+ "default": "./native/dist/bar-mark.js"
455
+ },
456
+ "./native/bar-pnl": {
457
+ "types": "./native/dist/bar-pnl.d.ts",
458
+ "import": "./native/dist/bar-pnl.js",
459
+ "default": "./native/dist/bar-pnl.js"
460
+ },
461
+ "./native/list-group": {
462
+ "types": "./native/dist/list-group.d.ts",
463
+ "import": "./native/dist/list-group.js",
464
+ "default": "./native/dist/list-group.js"
465
+ },
246
466
  "./native/pickers": {
247
467
  "types": "./native/dist/pickers.d.ts",
248
468
  "import": "./native/dist/pickers.js",
@@ -303,10 +523,15 @@
303
523
  "import": "./native/dist/brand.js",
304
524
  "default": "./native/dist/brand.js"
305
525
  },
526
+ "./native/blocks": {
527
+ "types": "./native/dist/blocks.d.ts",
528
+ "import": "./native/dist/blocks.js",
529
+ "default": "./native/dist/blocks.js"
530
+ },
306
531
  "./native/recipes": {
307
- "types": "./native/dist/recipes.d.ts",
308
- "import": "./native/dist/recipes.js",
309
- "default": "./native/dist/recipes.js"
532
+ "types": "./native/dist/blocks.d.ts",
533
+ "import": "./native/dist/blocks.js",
534
+ "default": "./native/dist/blocks.js"
310
535
  },
311
536
  "./native/switch": {
312
537
  "types": "./native/dist/switch.d.ts",
package/react/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @bloxwap/hig/react
2
2
 
3
- Version 0.5.2, an entry of `@bloxwap/hig`. Import individual entries; see docs/components for platform and accessibility contracts.
3
+ Version 0.7.0, an entry of `@bloxwap/hig`. Import individual entries; see docs/components for platform and accessibility contracts.
4
4
 
5
5
  Set a brand accent with `<HIGProvider primaryColor='#ff0000'>` from
6
6
  `@bloxwap/hig/react/provider`. It accepts opaque sRGB hex (`#RGB` or `#RRGGBB`),
@@ -17,4 +17,10 @@ export interface AnimatedNumberTransitionToken extends AnimatedNumberToken {
17
17
  changed: boolean;
18
18
  }
19
19
  export declare function createAnimatedNumberModel(value: number | null | undefined, locale: string, options?: Intl.NumberFormatOptions): AnimatedNumberModel;
20
+ /**
21
+ * A model for host-formatted text. Without `animate` it is the text as one static token. With it, every digit of the text
22
+ * (ASCII, or the locale's own digits) is a place keyed by its position counted from the end, so a host's own number table
23
+ * still moves place by place; everything else stays as written.
24
+ */
25
+ export declare function createFormattedAnimatedNumberModel(text: string, locale: string, animate: boolean): AnimatedNumberModel;
20
26
  export declare function createAnimatedNumberTransitions(previous: AnimatedNumberModel | null, next: AnimatedNumberModel): readonly AnimatedNumberTransitionToken[];
@@ -59,6 +59,39 @@ export function createAnimatedNumberModel(value, locale, options) {
59
59
  }
60
60
  return tokens.some(token => token.digit) ? { reading, tokens, animatable: true } : staticModel(reading);
61
61
  }
62
+ /**
63
+ * A model for host-formatted text. Without `animate` it is the text as one static token. With it, every digit of the text
64
+ * (ASCII, or the locale's own digits) is a place keyed by its position counted from the end, so a host's own number table
65
+ * still moves place by place; everything else stays as written.
66
+ */
67
+ export function createFormattedAnimatedNumberModel(text, locale, animate) {
68
+ if (!animate)
69
+ return staticModel(text);
70
+ const ascii = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
71
+ let local = null;
72
+ try {
73
+ local = digitsFor(new Intl.NumberFormat(locale));
74
+ }
75
+ catch {
76
+ local = null;
77
+ }
78
+ const characters = Array.from(text), values = characters.map(character => { const own = ascii.indexOf(character); return own >= 0 ? own : local ? local.indexOf(character) : -1; });
79
+ const count = values.filter(value => value >= 0).length;
80
+ if (!count)
81
+ return staticModel(text);
82
+ const tokens = [];
83
+ let run = '', seen = 0;
84
+ const flush = () => { if (run) {
85
+ tokens.push({ key: `literal:${tokens.length}`, text: run, digit: false });
86
+ run = '';
87
+ } };
88
+ characters.forEach((character, index) => { const value = values[index]; if (value < 0) {
89
+ run += character;
90
+ return;
91
+ } flush(); const place = count - ++seen; tokens.push({ key: `digit:number:${place}`, text: character, digit: true, value, place, section: 'number' }); });
92
+ flush();
93
+ return { reading: text, tokens, animatable: true };
94
+ }
62
95
  export function createAnimatedNumberTransitions(previous, next) {
63
96
  if (!previous?.animatable || !next.animatable)
64
97
  return next.tokens.map(token => ({ ...token, changed: false }));
@@ -4,5 +4,9 @@ export type AnimatedNumberTrend = -1 | 0 | 1 | ((oldValue: number, newValue: num
4
4
  export interface AnimatedNumberProps extends NumberProps {
5
5
  duration?: number;
6
6
  trend?: AnimatedNumberTrend;
7
+ /** Host-formatted text for a finite `value`, drawn in place of the Intl reading and read the same way, for a host whose number table the browser's Intl does not match. Never parse it back. Empty text falls back to Intl. Unknown values still read as the dash. */
8
+ formattedValue?: string;
9
+ /** With `formattedValue`, moves the host's text place by place: each digit rolls in place, counted from the end, and the rest stays as written. Without it `formattedValue` is drawn static. */
10
+ animateFormatted?: boolean;
7
11
  }
8
- export declare function AnimatedNumberReadout({ duration, trend, ...props }: AnimatedNumberProps): React.JSX.Element;
12
+ export declare function AnimatedNumberReadout({ duration, trend, options: requested, formattedValue, animateFormatted, ...rest }: AnimatedNumberProps): React.JSX.Element;