@bloxwap/hig 0.6.0 → 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 (167) hide show
  1. package/chart/README.md +1 -1
  2. package/contracts/README.md +1 -1
  3. package/contracts/dist/index.d.ts +16 -0
  4. package/contracts/dist/index.js +22 -0
  5. package/contracts/dist/messages.d.ts +6 -0
  6. package/contracts/dist/messages.js +3 -1
  7. package/feedback/README.md +1 -1
  8. package/native/README.md +1 -1
  9. package/native/dist/account-block.d.ts +53 -7
  10. package/native/dist/account-block.js +42 -9
  11. package/native/dist/animated-number-model.d.ts +7 -1
  12. package/native/dist/animated-number-model.js +50 -1
  13. package/native/dist/animated-number.d.ts +3 -1
  14. package/native/dist/animated-number.js +8 -5
  15. package/native/dist/asset-balance-row.d.ts +17 -1
  16. package/native/dist/asset-balance-row.js +13 -8
  17. package/native/dist/bar-mark.d.ts +14 -2
  18. package/native/dist/bar-mark.js +19 -5
  19. package/native/dist/bar-pnl.js +5 -4
  20. package/native/dist/blocks.d.ts +8 -14
  21. package/native/dist/blocks.js +5 -6
  22. package/native/dist/button.js +3 -1
  23. package/native/dist/data.d.ts +1 -1
  24. package/native/dist/data.js +6 -4
  25. package/native/dist/field.d.ts +14 -4
  26. package/native/dist/field.js +33 -7
  27. package/native/dist/figure.d.ts +23 -0
  28. package/native/dist/figure.js +10 -0
  29. package/native/dist/language-block.d.ts +5 -1
  30. package/native/dist/language-block.js +3 -3
  31. package/native/dist/list-group.d.ts +42 -8
  32. package/native/dist/list-group.js +71 -13
  33. package/native/dist/manage-position-block.d.ts +28 -2
  34. package/native/dist/manage-position-block.js +36 -11
  35. package/native/dist/market-row.d.ts +46 -0
  36. package/native/dist/market-row.js +30 -0
  37. package/native/dist/notifications-block.d.ts +30 -2
  38. package/native/dist/notifications-block.js +16 -8
  39. package/native/dist/pickers.d.ts +24 -2
  40. package/native/dist/pickers.js +16 -8
  41. package/native/dist/position-block.d.ts +66 -10
  42. package/native/dist/position-block.js +45 -11
  43. package/native/dist/profile-block.d.ts +29 -5
  44. package/native/dist/profile-block.js +25 -5
  45. package/native/dist/provider.d.ts +9 -3
  46. package/native/dist/provider.js +7 -3
  47. package/native/dist/radio-group.d.ts +9 -3
  48. package/native/dist/radio-group.js +4 -5
  49. package/native/dist/recipes.d.ts +6 -0
  50. package/native/dist/recipes.js +6 -0
  51. package/native/dist/reward-block.d.ts +45 -6
  52. package/native/dist/reward-block.js +30 -12
  53. package/native/dist/screen-header.d.ts +49 -0
  54. package/native/dist/screen-header.js +29 -0
  55. package/native/dist/selection.d.ts +2 -2
  56. package/native/dist/setting-header.d.ts +2 -8
  57. package/native/dist/setting-header.js +2 -11
  58. package/native/dist/setting-switch.d.ts +14 -1
  59. package/native/dist/setting-switch.js +5 -2
  60. package/native/dist/signals-block.d.ts +26 -2
  61. package/native/dist/signals-block.js +14 -4
  62. package/native/dist/sound-haptics-block.d.ts +29 -2
  63. package/native/dist/sound-haptics-block.js +18 -7
  64. package/native/dist/status.d.ts +6 -5
  65. package/native/dist/status.js +5 -5
  66. package/native/dist/sticky-header.d.ts +28 -0
  67. package/native/dist/sticky-header.js +21 -0
  68. package/native/dist/surface.d.ts +3 -1
  69. package/native/dist/surface.js +2 -1
  70. package/native/dist/swap-panel-block.d.ts +2 -1
  71. package/native/dist/swap-panel-block.js +9 -6
  72. package/native/dist/swap-parts.d.ts +5 -3
  73. package/native/dist/swap-parts.js +2 -2
  74. package/native/dist/swap-shared.d.ts +6 -0
  75. package/native/dist/swap-views.js +5 -3
  76. package/native/dist/switch-row.d.ts +3 -2
  77. package/native/dist/switch-row.js +5 -3
  78. package/native/dist/switch.d.ts +4 -2
  79. package/native/dist/switch.js +3 -3
  80. package/native/dist/target-block.d.ts +33 -6
  81. package/native/dist/target-block.js +19 -6
  82. package/native/dist/token-action-block.d.ts +17 -9
  83. package/native/dist/token-action-block.js +14 -6
  84. package/native/dist/trade-history-detail-block.d.ts +26 -1
  85. package/native/dist/trade-history-detail-block.js +17 -9
  86. package/native/dist/trade-history-list-block.d.ts +71 -5
  87. package/native/dist/trade-history-list-block.js +50 -15
  88. package/native/dist/wallet-address-core.d.ts +25 -0
  89. package/native/dist/wallet-address-core.js +31 -0
  90. package/native/dist/wallet-address.d.ts +6 -10
  91. package/native/dist/wallet-address.js +16 -20
  92. package/native-fonts/README.md +1 -1
  93. package/og-fonts/README.md +1 -1
  94. package/package.json +21 -1
  95. package/react/README.md +1 -1
  96. package/react/dist/animated-number-model.d.ts +6 -0
  97. package/react/dist/animated-number-model.js +33 -0
  98. package/react/dist/animated-number.d.ts +5 -1
  99. package/react/dist/animated-number.js +12 -8
  100. package/react/dist/asset-balance-row.d.ts +17 -1
  101. package/react/dist/asset-balance-row.js +11 -3
  102. package/react/dist/bar-mark.d.ts +5 -2
  103. package/react/dist/bar-mark.js +5 -3
  104. package/react/dist/blocks/account-block.d.ts +53 -7
  105. package/react/dist/blocks/account-block.js +45 -10
  106. package/react/dist/blocks/language-block.d.ts +5 -1
  107. package/react/dist/blocks/language-block.js +6 -5
  108. package/react/dist/blocks/manage-position-block.d.ts +28 -2
  109. package/react/dist/blocks/manage-position-block.js +23 -4
  110. package/react/dist/blocks/market-row.d.ts +20 -9
  111. package/react/dist/blocks/market-row.js +12 -4
  112. package/react/dist/blocks/notifications-block.d.ts +25 -2
  113. package/react/dist/blocks/notifications-block.js +11 -2
  114. package/react/dist/blocks/pickers.d.ts +21 -1
  115. package/react/dist/blocks/pickers.js +30 -10
  116. package/react/dist/blocks/position-block.d.ts +34 -11
  117. package/react/dist/blocks/position-block.js +16 -5
  118. package/react/dist/blocks/profile-block.d.ts +29 -6
  119. package/react/dist/blocks/profile-block.js +31 -5
  120. package/react/dist/blocks/reward-block.d.ts +53 -14
  121. package/react/dist/blocks/reward-block.js +20 -10
  122. package/react/dist/blocks/screen-header.d.ts +26 -2
  123. package/react/dist/blocks/screen-header.js +13 -5
  124. package/react/dist/blocks/setting-switch.d.ts +14 -1
  125. package/react/dist/blocks/setting-switch.js +8 -4
  126. package/react/dist/blocks/signals-block.d.ts +21 -2
  127. package/react/dist/blocks/signals-block.js +5 -5
  128. package/react/dist/blocks/sound-haptics-block.d.ts +25 -3
  129. package/react/dist/blocks/sound-haptics-block.js +11 -7
  130. package/react/dist/blocks/sticky-header.d.ts +9 -0
  131. package/react/dist/blocks/sticky-header.js +43 -0
  132. package/react/dist/blocks/swap/amount-card.js +2 -1
  133. package/react/dist/blocks/swap/settings.js +2 -2
  134. package/react/dist/blocks/swap/shared.d.ts +7 -1
  135. package/react/dist/blocks/swap/shared.js +6 -4
  136. package/react/dist/blocks/swap-panel-block.d.ts +2 -0
  137. package/react/dist/blocks/swap-panel-block.js +6 -6
  138. package/react/dist/blocks/target-block.d.ts +28 -6
  139. package/react/dist/blocks/target-block.js +17 -9
  140. package/react/dist/blocks/token-action-block.d.ts +17 -8
  141. package/react/dist/blocks/token-action-block.js +9 -6
  142. package/react/dist/blocks/trade-history-detail-block.d.ts +21 -1
  143. package/react/dist/blocks/trade-history-detail-block.js +5 -4
  144. package/react/dist/blocks/trade-history-list-block.d.ts +29 -5
  145. package/react/dist/blocks/trade-history-list-block.js +15 -8
  146. package/react/dist/blocks.d.ts +8 -8
  147. package/react/dist/blocks.js +2 -2
  148. package/react/dist/button.js +6 -4
  149. package/react/dist/data.js +3 -3
  150. package/react/dist/field.d.ts +14 -4
  151. package/react/dist/field.js +19 -6
  152. package/react/dist/figure.d.ts +23 -0
  153. package/react/dist/figure.js +12 -0
  154. package/react/dist/list-group.d.ts +41 -8
  155. package/react/dist/list-group.js +44 -12
  156. package/react/dist/provider.d.ts +40 -3
  157. package/react/dist/provider.js +63 -6
  158. package/react/dist/selection.d.ts +8 -2
  159. package/react/dist/selection.js +11 -6
  160. package/react/dist/styles.css +164 -9
  161. package/react/dist/surface.d.ts +5 -1
  162. package/react/dist/surface.js +1 -1
  163. package/react/dist/wallet-address-core.d.ts +23 -0
  164. package/react/dist/wallet-address-core.js +24 -0
  165. package/react/dist/wallet-address.d.ts +6 -12
  166. package/react/dist/wallet-address.js +5 -16
  167. package/tokens/README.md +1 -1
@@ -1,6 +1,6 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { View } from 'react-native';
3
- import { useColors, useFills, useHIG } from './provider.js';
3
+ import { useColors, useFills, useHIG, useNumberLocale, usePresentNumber } from './provider.js';
4
4
  import { Surface, Text } from './surface.js';
5
5
  import { AnimatedNumberReadout } from './animated-number.js';
6
6
  import { formatNumberReadout } from './animated-number-model.js';
@@ -40,15 +40,16 @@ export function barPnlLayout({ entry, mark, liquidation, side, fit }) {
40
40
  }
41
41
  /** A position's profit or loss as one bar: the stretch between entry and mark is filled solid in the result colour, a tick marks each price, and the liquidation, mark and entry prices read under the bar in price order, so mark and entry trade places as the position moves. The bar is decorative; each readout reads its label and price. */
42
42
  export function BarPnl({ entry, mark, liquidation, side, labels, title, description, priceOptions = usd, compact = false, fit = false, surface = true, testID }) {
43
- const colors = useColors(), { locale, direction } = useHIG();
43
+ const colors = useColors(), { direction } = useHIG(), locale = useNumberLocale(), present = usePresentNumber();
44
44
  const { result, positions, order } = barPnlLayout({ entry, mark, liquidation, side, fit });
45
- const tone = result === 'profit' ? colors.positive : result === 'loss' ? colors.negative : colors.muted;
45
+ // The result follows the market direction roles (HIGProvider marketColors), which default to buy and sell.
46
+ const tone = result === 'profit' ? colors.up : result === 'loss' ? colors.down : colors.muted;
46
47
  const from = Math.min(positions.entry ?? 0.5, positions.mark ?? 0.5), to = Math.max(positions.entry ?? 0.5, positions.mark ?? 0.5);
47
48
  const markLeads = (positions.mark ?? 0) < (positions.entry ?? 0);
48
49
  const values = { liquidation, mark, entry };
49
50
  const format = (kind) => compact ? barPnlCompactOptions(values[kind], priceOptions) : priceOptions;
50
51
  const align = (index) => order.length > 1 && index === order.length - 1 ? 'flex-end' : order.length === 3 && index === 1 ? 'center' : 'flex-start';
51
- const content = _jsxs(_Fragment, { children: [title || description != null ? _jsxs(View, { style: { flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }, children: [title ? _jsx(Text, { accessibilityRole: 'header', style: { fontSize: 16, lineHeight: 24, fontWeight: '600', flexShrink: 1 }, children: title }) : _jsx(View, {}), description == null || description === false ? null : typeof description === 'string' || typeof description === 'number' ? _jsx(Text, { style: { color: colors.muted, fontSize: 14, lineHeight: 21, flexShrink: 1 }, children: description }) : description] }) : null, _jsx(Bar, { from: from, to: to, markLeads: markLeads, tone: tone, liquidation: positions.liquidation, testID: testID }), _jsx(View, { style: { flexDirection: 'row', justifyContent: 'space-between', gap: 12 }, children: order.map((kind, index) => _jsxs(View, { accessible: true, accessibilityLabel: `${labels[kind]}, ${formatNumberReadout(values[kind], locale, format(kind)).text}`, testID: testID ? `${testID}-${kind}` : undefined, style: { alignItems: align(index), flexShrink: 1, minWidth: 0 }, children: [_jsx(View, { ...hidden, children: _jsx(AnimatedNumberReadout, { value: values[kind], options: format(kind), tone: kind === 'liquidation' ? 'negative' : kind === 'mark' && result !== 'flat' ? (result === 'profit' ? 'positive' : 'negative') : 'text', style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }) }), _jsx(Text, { ...hidden, numberOfLines: 1, style: { color: colors.muted, fontSize: 12, lineHeight: 16 }, children: labels[kind] })] }, kind)) })] });
52
+ const content = _jsxs(_Fragment, { children: [title || description != null ? _jsxs(View, { style: { flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }, children: [title ? _jsx(Text, { accessibilityRole: 'header', style: { fontSize: 16, lineHeight: 24, fontWeight: '600', flexShrink: 1 }, children: title }) : _jsx(View, {}), description == null || description === false ? null : typeof description === 'string' || typeof description === 'number' ? _jsx(Text, { style: { color: colors.muted, fontSize: 14, lineHeight: 21, flexShrink: 1 }, children: description }) : description] }) : null, _jsx(Bar, { from: from, to: to, markLeads: markLeads, tone: tone, liquidation: positions.liquidation, testID: testID }), _jsx(View, { style: { flexDirection: 'row', justifyContent: 'space-between', gap: 12 }, children: order.map((kind, index) => _jsxs(View, { accessible: true, accessibilityLabel: `${labels[kind]}, ${formatNumberReadout(values[kind], locale, present(format(kind))).text}`, testID: testID ? `${testID}-${kind}` : undefined, style: { alignItems: align(index), flexShrink: 1, minWidth: 0 }, children: [_jsx(View, { ...hidden, children: _jsx(AnimatedNumberReadout, { value: values[kind], options: format(kind), tone: kind === 'liquidation' ? 'negative' : kind === 'mark' && result !== 'flat' ? (result === 'profit' ? 'up' : 'down') : 'text', style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }) }), _jsx(Text, { ...hidden, numberOfLines: 1, style: { color: colors.muted, fontSize: 12, lineHeight: 16 }, children: labels[kind] })] }, kind)) })] });
52
53
  return surface ? _jsx(Surface, { testID: testID, style: { gap: 12 }, children: content }) : _jsx(View, { testID: testID, style: { direction, gap: 12, minWidth: 0 }, children: content });
53
54
  }
54
55
  // Inside the Surface, so the track takes the fill that sits one step above the card.
@@ -1,11 +1,5 @@
1
1
  import React from 'react';
2
- export declare function MarketRow({ symbol, name, price, change, onSelect }: {
3
- symbol: string;
4
- name: string;
5
- price: number | null;
6
- change: number | null;
7
- onSelect: () => void;
8
- }): React.JSX.Element;
2
+ export { MarketRow, type MarketRowProps } from './market-row.js';
9
3
  export declare function TradeEntry({ asset, amount, onAmountChange, onConfirm, busy, error, available }: {
10
4
  asset: string;
11
5
  amount: string;
@@ -26,19 +20,19 @@ export declare function MarketingHero({ title, description, href, cta }: {
26
20
  href: string;
27
21
  cta: string;
28
22
  }): React.JSX.Element;
29
- export { AccountBlock, accountRows, assetValue, AssetBalanceRow, type AccountBlockProps, type AccountAsset, type AssetArtwork, type AssetBalanceRowProps } from './account-block.js';
23
+ export { AccountBlock, accountRows, accountSectionRows, accountSectionTotal, assetValue, AssetBalanceRow, type AccountBlockProps, type AccountAsset, type AccountSection, type AccountOrder, type AccountRowsOptions, type AssetArtwork, type AssetBalanceRowProps } from './account-block.js';
30
24
  export { LanguageBlock, filterLanguages, type LanguageBlockProps, type LanguageOption } from './language-block.js';
31
25
  export { TokenActionBlock, tokenActionLabel, type TokenActionBlockProps, type TokenAction, type TokenActionId } from './token-action-block.js';
32
- export { ManagePositionBlock, positionCorridor, type ManagePositionBlockProps, type ManagePositionBlockLabels, type ManagePositionBlockAction, type ManagePositionBlockSummary } from './manage-position-block.js';
26
+ export { ManagePositionBlock, positionCorridor, type ManagePositionBlockProps, type ManagePositionBlockLabels, type ManagePositionBlockAction, type ManagePositionBlockSummary, type ManagePositionBlockFigure, type ManagePositionIcon } from './manage-position-block.js';
33
27
  export { TradeHistoryListBlock, tradeHistorySide, type TradeHistoryListBlockProps, type TradeHistoryListLabels, type TradeHistoryItem } from './trade-history-list-block.js';
34
28
  export { TradeHistoryDetailBlock, type TradeHistoryDetailBlockProps, type TradeHistoryDetailLabels, type TradeHistoryDetail, type TradeHistoryAction } from './trade-history-detail-block.js';
35
- export { TargetBlock, targetLayout, targetFormat, type TargetBlockProps, type TargetBlockLabels, type TargetKind, type TargetUnit, type TargetPrice } from './target-block.js';
36
- export { ProfileBlock, type ProfileBlockProps, type ProfileRow, type ProfileSection, type ProfileStatus } from './profile-block.js';
37
- export { PositionBlock, type PositionBlockProps, type PositionBlockDetail, type PositionBlockFigure, type PositionBlockRow, type PositionBlockFlag } from './position-block.js';
29
+ export { TargetBlock, targetLayout, targetFormat, targetPresets, targetUnits, type TargetBlockProps, type TargetBlockLabels, type TargetKind, type TargetUnit, type TargetPrice, type TargetPreset, type TargetUnitOption } from './target-block.js';
30
+ export { ProfileBlock, type ProfileBlockProps, type ProfileRow, type ProfileSection, type ProfileStatus, type ProfileAction, type ProfileFigure } from './profile-block.js';
31
+ export { PositionBlock, PositionBlockHeader, type PositionBlockProps, type PositionBlockHeaderProps, type PositionBlockDetail, type PositionBlockFigure, type PositionBlockRow, type PositionBlockFlag, type PositionBlockFlagAction } from './position-block.js';
38
32
  export { RewardBlock, rewardProgress, type RewardBlockProps, type RewardPromo, type RewardEntry } from './reward-block.js';
39
- export { SoundHapticsBlock, soundLevel, type SoundHapticsBlockProps, type SoundSection, type SoundVolume } from './sound-haptics-block.js';
33
+ export { SoundHapticsBlock, soundLevel, type SoundHapticsBlockProps, type SoundSection, type SoundVolume, type SettingAction } from './sound-haptics-block.js';
40
34
  export { SignalsBlock, type SignalsBlockProps, type SignalsGroup, type SignalsItem } from './signals-block.js';
41
35
  export { NotificationsBlock, type NotificationsBlockProps, type NotificationsItem } from './notifications-block.js';
42
- export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, type FromPickerBlockProps, type ToPickerBlockProps, type FromPickerProps, type ToPickerProps, type PickerListProps } from './pickers.js';
36
+ export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, type FromPickerBlockProps, type ToPickerBlockProps, type FromPickerProps, type ToPickerProps, type PickerListProps, type PickerInputProps, SwapHostContext } from './pickers.js';
43
37
  export { SwapKeypad, SwapCapsule } from './swap-parts.js';
44
38
  export { SwapPanelBlock, SwapPanel, swapAction, type SwapPanelBlockProps, type SwapPanelProps, type SwapToken, type SwapArtwork, type SwapChain, type SwapAction, type SwapDenomination, type SwapWallet, type SwapFee, type SwapFigure, type SwapReceive, type SwapDestination, type SwapDetail, type SwapView } from './swap-panel-block.js';
@@ -7,9 +7,8 @@ import { Button, Link } from './button.js';
7
7
  import { Surface, Stack, Heading, Text } from './surface.js';
8
8
  import { Field, Input } from './field.js';
9
9
  import { Dialog } from './overlay.js';
10
- import { Row, Usd, Percent } from './data.js';
11
10
  import { Toast, useTransientNotice } from './status.js';
12
- export function MarketRow({ symbol, name, price, change, onSelect }) { return _jsxs(Row, { children: [_jsxs(Button, { intent: 'ghost', onPress: onSelect, children: [name, " (", symbol, ")"] }), _jsx(Usd, { value: price }), _jsx(Percent, { value: change })] }); }
11
+ export { MarketRow } from './market-row.js';
13
12
  /** The call to action that closes a form sits a double step, 16dp, below it (the Stack gap is 12). */
14
13
  const formAction = { marginTop: 4 };
15
14
  /** In a dialog the confirm action is 16dp below the content and 8dp above the dialog's own closing button, which adds 4dp itself. */
@@ -25,19 +24,19 @@ export function InstallCommand({ command, onCopy }) {
25
24
  return _jsxs(Surface, { style: { gap: 12 }, children: [_jsx(Text, { selectable: true, style: code, children: command }), _jsx(Button, { intent: 'secondary', onPress: () => { Promise.resolve().then(onCopy).then(() => show(messages.copied ?? en.copied, 'success')).catch(() => show(messages.copyFailed ?? en.copyFailed, 'error')); }, children: messages.copyInstallCommand ?? en.copyInstallCommand }), notice && _jsx(Toast, { notices: [notice], onDismiss: dismiss })] });
26
25
  }
27
26
  export function MarketingHero({ title, description, href, cta }) { return _jsxs(Stack, { children: [_jsx(Heading, { children: title }), _jsx(Text, { children: description }), _jsx(Link, { href: href, children: cta })] }); }
28
- export { AccountBlock, accountRows, assetValue, AssetBalanceRow } from './account-block.js';
27
+ export { AccountBlock, accountRows, accountSectionRows, accountSectionTotal, assetValue, AssetBalanceRow } from './account-block.js';
29
28
  export { LanguageBlock, filterLanguages } from './language-block.js';
30
29
  export { TokenActionBlock, tokenActionLabel } from './token-action-block.js';
31
30
  export { ManagePositionBlock, positionCorridor } from './manage-position-block.js';
32
31
  export { TradeHistoryListBlock, tradeHistorySide } from './trade-history-list-block.js';
33
32
  export { TradeHistoryDetailBlock } from './trade-history-detail-block.js';
34
- export { TargetBlock, targetLayout, targetFormat } from './target-block.js';
33
+ export { TargetBlock, targetLayout, targetFormat, targetPresets, targetUnits } from './target-block.js';
35
34
  export { ProfileBlock } from './profile-block.js';
36
- export { PositionBlock } from './position-block.js';
35
+ export { PositionBlock, PositionBlockHeader } from './position-block.js';
37
36
  export { RewardBlock, rewardProgress } from './reward-block.js';
38
37
  export { SoundHapticsBlock, soundLevel } from './sound-haptics-block.js';
39
38
  export { SignalsBlock } from './signals-block.js';
40
39
  export { NotificationsBlock } from './notifications-block.js';
41
- export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker } from './pickers.js';
40
+ export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, SwapHostContext } from './pickers.js';
42
41
  export { SwapKeypad, SwapCapsule } from './swap-parts.js';
43
42
  export { SwapPanelBlock, SwapPanel, swapAction } from './swap-panel-block.js';
@@ -16,6 +16,8 @@ function labelRuns(children) { const runs = []; for (const child of React.Childr
16
16
  } return runs; }
17
17
  /** A 44dp control keeps a 48dp touch target. */
18
18
  const touchSlop = { top: 2, bottom: 2 };
19
+ /** An icon button is 44dp both ways, so its 48dp target reaches out on every side. */
20
+ const iconSlop = { top: 2, bottom: 2, left: 2, right: 2 };
19
21
  /** Android appends its localized busy state; including the suffix there would speak it twice. */
20
22
  export function busyAccessibilityLabel(text, busyText, os = Platform.OS) { return text ? (busyText && os !== 'android' ? `${text} · ${busyText}` : text) : undefined; }
21
23
  export const Button = /* @__PURE__ */ forwardRef(function Button({ children, contentMode = 'default', intent = 'primary', disabled, busy, busyLabel, maxFontSizeMultiplier, script, fullWidth, suppressFeedback, onPress, style, ...props }, ref) { const env = useHIG(); const colors = useColors(); const fills = useFills(); const id = useId(); const sequence = useRef(0); const busyText = busyLabel ?? env.messages.busy ?? en.busy; const filled = intent === 'primary' || intent === 'destructive'; /* Unavailable is neutral: a well fill and muted text. Busy keeps the intent colour under its spinner. */ /* Unavailable is neutral: a well fill and muted text. Busy keeps the intent colour under its spinner. */ const inert = !!disabled && !busy; const label = plainText(children); const accessibleLabel = props.accessibilityLabel ?? (busy ? busyAccessibilityLabel(label, busyText) : undefined); const labelStyle = { color: inert ? (intent === 'ghost' ? colors.faint : colors.muted) : intent === 'destructive' ? colors.background : intent === 'primary' ? colors.onAction : intent === 'ghost' ? colors.muted : colors.text, fontSize: 16, fontWeight: '600', textAlign: 'center' }; return _jsx(Pressable, { ...props, ref: ref, disabled: disabled || busy, accessibilityRole: 'button', accessibilityLabel: accessibleLabel, accessibilityState: { ...props.accessibilityState, disabled: !!disabled || !!busy, busy: !!busy }, "aria-busy": !!busy, onPress: e => { if (disabled || busy)
@@ -27,7 +29,7 @@ export const Button = /* @__PURE__ */ forwardRef(function Button({ children, con
27
29
  catch { /* Best effort only. */ }
28
30
  } }, hitSlop: props.hitSlop ?? touchSlop, style: state => [{ minHeight: 44, paddingHorizontal: 20, paddingVertical: 10, borderRadius: 9999, alignItems: 'center', justifyContent: 'center', backgroundColor: inert ? (intent === 'ghost' ? 'transparent' : fills.well) : filled ? (intent === 'destructive' ? colors.negative : colors.action) : intent === 'ghost' && !state.pressed ? 'transparent' : colors.nested, opacity: busy ? 0.7 : state.pressed && !inert ? 0.85 : 1, alignSelf: fullWidth ? 'stretch' : 'flex-start' }, typeof style === 'function' ? style(state) : style], children: contentMode === 'custom' ? children : _jsxs(View, { style: { direction: env.direction, flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center', gap: 8 }, children: [busy ? _jsx(ActivityIndicator, { size: 'small', color: labelStyle.color, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' }) : null, labelRuns(children).map((child, i) => typeof child === 'string' ? _jsx(Text, { script: script, maxFontSizeMultiplier: maxFontSizeMultiplier, style: labelStyle, children: child }, `label-${i}`) : child)] }) }); });
29
31
  /** While busy, the spinner takes the icon's place. */
30
- export function IconButton({ label, children, style, ...props }) { return _jsx(Button, { ...props, accessibilityLabel: label, style: state => [{ minWidth: 44, paddingHorizontal: 10 }, typeof style === 'function' ? style(state) : style], children: props.busy && props.contentMode !== 'custom' ? null : children }); }
32
+ export function IconButton({ label, children, style, ...props }) { return _jsx(Button, { ...props, hitSlop: props.hitSlop ?? iconSlop, accessibilityLabel: label, style: state => [{ minWidth: 44, paddingHorizontal: 10 }, typeof style === 'function' ? style(state) : style], children: props.busy && props.contentMode !== 'custom' ? null : children }); }
31
33
  export const Link = /* @__PURE__ */ forwardRef(function Link({ href, children, onError, onPress, contentMode = 'default', disabled, style, ...props }, ref) { const colors = useColors(); const web = Platform.OS === 'web', webHref = web && !disabled ? { href } : {}; return _jsx(Pressable, { ...props, ...webHref, ref: ref, accessibilityRole: 'link', disabled: disabled, accessibilityState: { ...props.accessibilityState, disabled: !!disabled }, "aria-busy": props.accessibilityState?.busy, onPress: event => { if (disabled)
32
34
  return; if (onPress)
33
35
  onPress(event);
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type StyleProp, type TextStyle } from 'react-native';
3
3
  /** `up`/`down` are market direction (rising/long/gain, falling/short/loss) and follow `HIGProvider marketColors`; `positive`/`negative` stay success/error. */
4
- export type NumberTone = 'text' | 'positive' | 'negative' | 'muted' | 'up' | 'down';
4
+ export type NumberTone = 'text' | 'positive' | 'negative' | 'warning' | 'muted' | 'faint' | 'up' | 'down';
5
5
  /** Typography only: semantic tone owns colour and numeric glyphs remain tabular. */
6
6
  export type NumberReadoutStyle = Pick<TextStyle, 'fontFamily' | 'fontSize' | 'fontWeight' | 'lineHeight' | 'letterSpacing' | 'textAlign'>;
7
7
  export interface NumberProps {
@@ -2,19 +2,21 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from 'react';
3
3
  import { FlatList, Platform, View, StyleSheet } from 'react-native';
4
4
  import { formatNumberReadout } from './animated-number-model.js';
5
+ import { presentNumberFormat } from '@bloxwap/hig/contracts';
5
6
  import * as en from '@bloxwap/hig/contracts/messages';
6
- import { useColors, useHIG } from './provider.js';
7
+ import { useColors, useHIG, useNumberLocale } from './provider.js';
7
8
  import { Text, Surface, Separator } from './surface.js';
8
9
  import { Button } from './button.js';
9
10
  const numberTypographyKeys = new Set(['fontFamily', 'fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'textAlign']);
10
11
  export function NumberReadout({ value, options, formattedValue, stale, label, tone = 'text', style, testID, maxFontSizeMultiplier, prefix, suffix }) {
11
- const { locale, messages } = useHIG();
12
+ const { messages, numberFormat } = useHIG();
13
+ const locale = useNumberLocale();
12
14
  const colors = useColors();
13
- const reading = formatNumberReadout(value, locale, options, formattedValue, prefix, suffix).text;
15
+ const reading = formatNumberReadout(value, locale, presentNumberFormat(options, numberFormat), formattedValue, prefix, suffix).text;
14
16
  const staleSuffix = stale ? ` ${messages.stale ?? en.stale}` : '';
15
17
  // Keep the same boundary for untyped hosts and registered/array styles: no raw colour, glyph or layout overrides.
16
18
  const typography = Object.fromEntries(Object.entries(StyleSheet.flatten(style) ?? {}).filter(([key]) => numberTypographyKeys.has(key)));
17
- const color = colors[tone === 'positive' || tone === 'negative' || tone === 'muted' || tone === 'up' || tone === 'down' ? tone : 'text'];
19
+ const color = colors[tone === 'positive' || tone === 'negative' || tone === 'warning' || tone === 'muted' || tone === 'faint' || tone === 'up' || tone === 'down' ? tone : 'text'];
18
20
  return _jsxs(Text, { accessibilityLabel: label ? `${label}: ${reading}${staleSuffix}` : undefined, testID: testID, maxFontSizeMultiplier: maxFontSizeMultiplier, style: [typography, { color, fontVariant: ['tabular-nums'] }], children: [reading, staleSuffix] });
19
21
  }
20
22
  export function Usd(props) { return _jsx(NumberReadout, { ...props, options: { style: 'currency', currency: 'USD', ...props.options } }); }
@@ -1,15 +1,25 @@
1
1
  import React from 'react';
2
2
  import { TextInput, type TextInputProps } from 'react-native';
3
3
  import { Text } from './surface.js';
4
- export declare function Field({ label, description, error, required, disabled, children }: React.PropsWithChildren<{
4
+ export interface FieldProps {
5
5
  label: string;
6
- description?: string;
6
+ description?: string; /** `positive` draws the description as a success line, such as a name that is available, and announces it when it changes. The words carry the meaning; the colour repeats it. */
7
+ descriptionTone?: 'muted' | 'positive';
7
8
  error?: string;
8
9
  required?: boolean;
9
10
  disabled?: boolean;
10
- }>): React.JSX.Element;
11
+ }
12
+ export declare function Field({ label, description, descriptionTone, error, required, disabled, children }: React.PropsWithChildren<FieldProps>): React.JSX.Element;
11
13
  export declare const Label: typeof Text;
12
14
  /** No resting stroke: the fill separates the field (one step lighter inside a Surface, Dialog or sheet). The ring appears only for focus and for an invalid value. */
13
15
  export declare const Input: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<React.ComponentRef<typeof TextInput>>>;
14
16
  export declare const TextArea: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<React.ComponentRef<typeof TextInput>>>;
15
- export declare const SearchInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<React.ComponentRef<typeof TextInput>>>;
17
+ export interface SearchInputProps extends TextInputProps {
18
+ /** Host content on the trailing edge inside the field, such as a filter button. The text stops 48dp short of the edge; wider content sets the input's end padding through `style`. */
19
+ trailing?: React.ReactNode;
20
+ /** Shows a clear button (44dp, reaching 48dp through `hitSlop`) on the trailing edge while the controlled `value` is not empty. It calls this and returns focus to the field. */
21
+ onClear?: () => void;
22
+ /** Accessible name of the clear button; defaults to HIGProvider `messages.clearSearch`. */
23
+ clearLabel?: string;
24
+ }
25
+ export declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<React.ComponentRef<typeof TextInput>>>;
@@ -1,12 +1,28 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { createContext, useContext, forwardRef, useId, useState } from 'react';
3
- import { Platform, TextInput, View } from 'react-native';
4
- import { SearchIcon } from './icons.js';
2
+ import { createContext, useContext, forwardRef, useEffect, useId, useRef, useState } from 'react';
3
+ import { AccessibilityInfo, Platform, Pressable, TextInput, View } from 'react-native';
4
+ import { CloseIcon, SearchIcon } from './icons.js';
5
5
  import { Text } from './surface.js';
6
6
  import * as en from '@bloxwap/hig/contracts/messages';
7
7
  import { useColors, useFills, useHIG } from './provider.js';
8
8
  const Context = createContext({ label: '' });
9
- export function Field({ label, description, error, required, disabled, children }) { const id = useId(); const { messages } = useHIG(); const colors = useColors(); const marked = required ? `${label} ${messages.required ?? en.required}` : label; return _jsx(Context.Provider, { value: { label: marked, hint: [description, error].filter(Boolean).join('. '), disabled, invalid: !!error }, children: _jsxs(View, { style: { gap: 8 }, children: [_jsx(Text, { nativeID: id, children: marked }), children, description && _jsx(Text, { style: { color: colors.muted }, children: description }), error && _jsx(Text, { accessibilityLiveRegion: 'polite', style: { color: colors.negative }, children: error })] }) }); }
9
+ export function Field({ label, description, descriptionTone, error, required, disabled, children }) {
10
+ const id = useId();
11
+ const { messages } = useHIG();
12
+ const colors = useColors();
13
+ const marked = required ? `${label} ${messages.required ?? en.required}` : label;
14
+ const positive = descriptionTone === 'positive';
15
+ // iOS has no live regions: a changed success line is spoken explicitly, as an Alert is. Android reads the live region.
16
+ const spoken = useRef(description);
17
+ useEffect(() => { if (spoken.current === description)
18
+ return; spoken.current = description; if (positive && description && Platform.OS === 'ios') {
19
+ try {
20
+ AccessibilityInfo.announceForAccessibility(description);
21
+ }
22
+ catch { /* The visible line remains. */ }
23
+ } }, [description, positive]);
24
+ return _jsx(Context.Provider, { value: { label: marked, hint: [description, error].filter(Boolean).join('. '), disabled, invalid: !!error }, children: _jsxs(View, { style: { gap: 8 }, children: [_jsx(Text, { nativeID: id, children: marked }), children, description && _jsx(Text, { ...(positive ? { accessibilityLiveRegion: 'polite' } : {}), style: { color: positive ? colors.positive : colors.muted }, children: description }), error && _jsx(Text, { accessibilityLiveRegion: 'polite', style: { color: colors.negative }, children: error })] }) });
25
+ }
10
26
  export const Label = Text;
11
27
  /** No resting stroke: the fill separates the field (one step lighter inside a Surface, Dialog or sheet). The ring appears only for focus and for an invalid value. */
12
28
  export const Input = forwardRef(function Input({ style, onFocus, onBlur, ...props }, ref) { const field = useContext(Context); const colors = useColors(); const fills = useFills(); const env = useHIG(); const [focused, setFocused] = useState(false); return _jsx(TextInput, { ...props, ref: ref, accessibilityLabel: props.accessibilityLabel ?? field.label, accessibilityHint: props.accessibilityHint ?? field.hint, accessibilityState: { ...props.accessibilityState, disabled: !!field.disabled || !!props.accessibilityState?.disabled }, editable: field.disabled ? false : props.editable, onChangeText: field.disabled ? undefined : props.onChangeText, onChange: field.disabled ? undefined : props.onChange, onFocus: event => { setFocused(true); onFocus?.(event); }, onBlur: event => { setFocused(false); onBlur?.(event); }, placeholderTextColor: props.placeholderTextColor ?? colors.muted, style: [{ color: colors.text, backgroundColor: fills.well, minHeight: 48, borderWidth: 1.5, borderColor: field.invalid ? colors.negative : focused ? colors.faint : 'transparent', borderRadius: props.multiline ? 14 : 9999, paddingVertical: 12, paddingHorizontal: 20, fontSize: 16, fontFamily: env.fontFamilies?.[400] ?? env.fontFamily, opacity: field.disabled ? 0.5 : 1 }, style] }); });
@@ -14,12 +30,22 @@ export const TextArea = forwardRef(function TextArea(props, ref) { return _jsx(I
14
30
  /** The magnifying glass sits inset on the leading edge and the text starts past it. */
15
31
  /** A search box is as tall as a button, 44dp, not a 48dp form field. */
16
32
  const searchSize = { minHeight: 44, paddingVertical: 10 };
17
- export const SearchInput = forwardRef(function SearchInput({ style, ...props }, ref) {
33
+ export const SearchInput = forwardRef(function SearchInput({ style, trailing, onClear, clearLabel, ...props }, ref) {
18
34
  const colors = useColors();
19
- const { direction } = useHIG();
35
+ const { direction, messages } = useHIG();
36
+ const inner = useRef(null);
20
37
  // RN Web resolves `start` through its own locale context rather than this View's direction.
21
38
  const rtl = direction === 'rtl', web = Platform.OS === 'web';
22
39
  const edge = web ? (rtl ? { right: 18 } : { left: 18 }) : { start: 18 };
23
40
  const inset = web ? (rtl ? { paddingRight: 46 } : { paddingLeft: 46 }) : { paddingStart: 46 };
24
- return _jsxs(View, { style: { direction, justifyContent: 'center' }, children: [_jsx(Input, { ...props, ref: ref, returnKeyType: props.returnKeyType ?? 'search', style: [searchSize, inset, style] }), _jsx(View, { pointerEvents: 'none', style: { position: 'absolute', ...edge }, children: _jsx(SearchIcon, { color: colors.muted }) })] });
41
+ const extra = trailing != null && trailing !== false, reserve = extra || onClear != null;
42
+ const end = web ? (rtl ? { left: 0 } : { right: 0 }) : { end: 0 };
43
+ const endInset = reserve ? (web ? (rtl ? { paddingLeft: 48 } : { paddingRight: 48 }) : { paddingEnd: 48 }) : null;
44
+ const attach = (node) => { inner.current = node; if (typeof ref === 'function')
45
+ ref(node);
46
+ else if (ref)
47
+ ref.current = node; };
48
+ const off = props.editable === false || !!useContext(Context).disabled;
49
+ const clear = onClear && props.value != null && props.value !== '' ? _jsx(Pressable, { testID: props.testID ? `${props.testID}-clear` : undefined, accessibilityRole: 'button', accessibilityLabel: clearLabel ?? messages.clearSearch ?? en.clearSearch, accessibilityState: off ? { disabled: true } : undefined, disabled: off, hitSlop: 2, onPress: () => { onClear(); inner.current?.focus(); }, style: ({ pressed }) => ({ width: 44, height: 44, borderRadius: 22, alignItems: 'center', justifyContent: 'center', opacity: off ? 0.5 : pressed ? 0.6 : 1 }), children: _jsx(CloseIcon, { color: colors.muted }) }) : null;
50
+ return _jsxs(View, { style: { direction, justifyContent: 'center' }, children: [_jsx(Input, { ...props, ref: onClear ? attach : ref, returnKeyType: props.returnKeyType ?? 'search', style: [searchSize, inset, endInset, style] }), _jsx(View, { pointerEvents: 'none', style: { position: 'absolute', ...edge }, children: _jsx(SearchIcon, { color: colors.muted }) }), extra || clear ? _jsxs(View, { style: { position: 'absolute', top: 0, bottom: 0, ...end, flexDirection: 'row', alignItems: 'center', gap: 4 }, children: [trailing, clear] }) : null] });
25
51
  });
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A number the host supplies as a number so it updates place by place: `{value:0.53,options:{style:'currency',currency:'USD'}}`.
3
+ * `null` reads as unknown. `formattedValue` is the host's own text for the value, drawn and read in place of Intl's, which
4
+ * still moves place by place: use it where this runtime's Intl does not match the host's number table. Never parse it back.
5
+ */
6
+ export interface Figure {
7
+ value: number | null;
8
+ options?: Intl.NumberFormatOptions;
9
+ prefix?: string;
10
+ suffix?: string;
11
+ formattedValue?: string;
12
+ }
13
+ /** The props of an `AnimatedNumberReadout` that draws a figure: its host text, when given, moves place by place too. */
14
+ export declare function figureProps(figure: Figure): {
15
+ value: number | null;
16
+ options?: Intl.NumberFormatOptions;
17
+ prefix?: string;
18
+ suffix?: string;
19
+ formattedValue?: string;
20
+ animateFormatted?: boolean;
21
+ };
22
+ /** What a figure reads as, with the provider's money format already merged into `options` by the caller. */
23
+ export declare function figureReading(figure: Figure, locale: string, options?: Intl.NumberFormatOptions): string;
@@ -0,0 +1,10 @@
1
+ import { formatNumberReadout } from './animated-number-model.js';
2
+ /** The props of an `AnimatedNumberReadout` that draws a figure: its host text, when given, moves place by place too. */
3
+ export function figureProps(figure) {
4
+ const { value, options, prefix, suffix, formattedValue } = figure;
5
+ return formattedValue ? { value, options, prefix, suffix, formattedValue, animateFormatted: true } : { value, options, prefix, suffix };
6
+ }
7
+ /** What a figure reads as, with the provider's money format already merged into `options` by the caller. */
8
+ export function figureReading(figure, locale, options) {
9
+ return formatNumberReadout(figure.value, locale, options, figure.formattedValue, figure.prefix, figure.suffix).text;
10
+ }
@@ -23,9 +23,13 @@ export interface LanguageBlockProps {
23
23
  onSelect: (language: LanguageOption) => void;
24
24
  /** Set false to leave out the search field, for a short list. Default `true`. */
25
25
  search?: boolean;
26
+ /** Dims the rows and ignores presses, for example while a change is being applied. */
27
+ disabled?: boolean;
28
+ /** A muted line under the header that explains the screen: Choose the language used throughout the app. */
29
+ description?: string;
26
30
  testID?: string;
27
31
  }
28
32
  /** The languages whose name, description or code contains the query, ignoring case and accents. An empty query keeps every language, in the host's order. */
29
33
  export declare function filterLanguages(languages: readonly LanguageOption[], query: string): LanguageOption[];
30
34
  /** Choose the app's language as one screen: a header, a search field, then each language as a row with its flag, its own name over the reader's name for it, and a check on the one in use. */
31
- export declare function LanguageBlock({ title, onBack, headerAction, languages, value, onSelect, search, testID }: LanguageBlockProps): React.JSX.Element;
35
+ export declare function LanguageBlock({ title, onBack, headerAction, languages, value, onSelect, search, disabled, description, testID }: LanguageBlockProps): React.JSX.Element;
@@ -15,16 +15,16 @@ export function filterLanguages(languages, query) {
15
15
  const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
16
16
  const avatar = 40;
17
17
  /** Choose the app's language as one screen: a header, a search field, then each language as a row with its flag, its own name over the reader's name for it, and a check on the one in use. */
18
- export function LanguageBlock({ title, onBack, headerAction, languages, value = null, onSelect, search = true, testID }) {
18
+ export function LanguageBlock({ title, onBack, headerAction, languages, value = null, onSelect, search = true, disabled, description, testID }) {
19
19
  const colors = useColors(), fills = useFills(), t = useMessages(), { direction } = useHIG();
20
20
  const [query, setQuery] = useState('');
21
21
  const rows = useMemo(() => filterLanguages(languages, query), [languages, query]);
22
22
  const heading = title ?? t.language;
23
23
  const shape = { width: avatar, height: avatar, borderRadius: avatar / 2, backgroundColor: fills.raised, alignItems: 'center', justifyContent: 'center', overflow: 'hidden' };
24
24
  const row = (pressed) => ({ flexDirection: 'row', alignItems: 'center', gap: 12, minHeight: 56, paddingVertical: 8, paddingStart: 8, paddingEnd: 16, borderRadius: 28, backgroundColor: pressed ? fills.well : 'transparent' });
25
- return _jsxs(View, { testID: testID, style: { direction, padding: 16, gap: 16 }, children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', minHeight: 44 }, children: [_jsx(View, { style: { minWidth: 44, alignItems: 'flex-start' }, children: onBack ? _jsx(IconButton, { intent: 'ghost', label: t.back, suppressFeedback: true, testID: testID ? `${testID}-back` : undefined, onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: testID ? `${testID}-title` : undefined, accessibilityRole: 'header', numberOfLines: 1, style: { flex: 1, textAlign: 'center', fontSize: 17, lineHeight: 24, fontWeight: '600', color: colors.text }, children: heading }), _jsx(View, { style: { minWidth: 44, alignItems: 'flex-end' }, children: headerAction })] }), search ? _jsx(SearchInput, { testID: testID ? `${testID}-search` : undefined, accessibilityLabel: t.searchLanguages, placeholder: t.searchLanguages, value: query, onChangeText: setQuery, returnKeyType: 'search', autoCapitalize: 'none', autoCorrect: false, spellCheck: false }) : null, rows.length === 0 ? _jsx(Text, { testID: testID ? `${testID}-empty` : undefined, accessibilityLiveRegion: 'polite', style: { paddingVertical: 32, textAlign: 'center', fontSize: 14, lineHeight: 20, color: colors.muted }, children: t.noResults }) :
25
+ return _jsxs(View, { testID: testID, style: { direction, padding: 16, gap: 16 }, children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', minHeight: 44 }, children: [_jsx(View, { style: { minWidth: 44, alignItems: 'flex-start' }, children: onBack ? _jsx(IconButton, { intent: 'ghost', label: t.back, suppressFeedback: true, testID: testID ? `${testID}-back` : undefined, onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: testID ? `${testID}-title` : undefined, accessibilityRole: 'header', numberOfLines: 1, style: { flex: 1, textAlign: 'center', fontSize: 17, lineHeight: 24, fontWeight: '600', color: colors.text }, children: heading }), _jsx(View, { style: { minWidth: 44, alignItems: 'flex-end' }, children: headerAction })] }), description ? _jsx(Text, { testID: testID ? `${testID}-description` : undefined, style: { paddingHorizontal: 4, fontSize: 14, lineHeight: 21, color: colors.muted }, children: description }) : null, search ? _jsx(SearchInput, { testID: testID ? `${testID}-search` : undefined, accessibilityLabel: t.searchLanguages, placeholder: t.searchLanguages, value: query, onChangeText: setQuery, returnKeyType: 'search', autoCapitalize: 'none', autoCorrect: false, spellCheck: false }) : null, rows.length === 0 ? _jsx(Text, { testID: testID ? `${testID}-empty` : undefined, accessibilityLiveRegion: 'polite', style: { paddingVertical: 32, textAlign: 'center', fontSize: 14, lineHeight: 20, color: colors.muted }, children: t.noResults }) :
26
26
  _jsx(View, { testID: testID ? `${testID}-list` : undefined, accessibilityRole: 'radiogroup', accessibilityLabel: heading, style: { gap: 4 }, children: rows.map(language => {
27
27
  const selected = language.code === value;
28
- return _jsxs(Pressable, { testID: testID ? `${testID}-${language.code}` : undefined, accessibilityRole: 'radio', accessibilityState: { checked: selected }, accessibilityLabel: [language.name, language.description].filter(Boolean).join(', '), accessibilityLanguage: language.code, onPress: () => onSelect(language), style: ({ pressed }) => row(pressed), children: [_jsx(View, { ...hidden, children: typeof language.flag === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: language.flag }, style: shape }) : _jsx(View, { style: shape, children: language.flag ?? _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 12, lineHeight: 16, fontWeight: '600', color: colors.muted }, children: language.code.slice(0, 2).toUpperCase() }) }) }), _jsxs(View, { ...hidden, style: { flex: 1, flexShrink: 1, minWidth: 0 }, children: [_jsx(Text, { style: { fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: language.name }), language.description ? _jsx(Text, { style: { fontSize: 14, lineHeight: 20, color: colors.muted }, children: language.description }) : null] }), selected ? _jsx(View, { ...hidden, testID: testID ? `${testID}-check` : undefined, style: { width: 20, height: 20, alignItems: 'center', justifyContent: 'center' }, children: _jsx(View, { style: { width: 6, height: 12, borderRightWidth: 2, borderBottomWidth: 2, borderColor: colors.text, transform: [{ translateY: -1 }, { rotate: '45deg' }] } }) }) : null] }, language.code);
28
+ return _jsxs(Pressable, { testID: testID ? `${testID}-${language.code}` : undefined, accessibilityRole: 'radio', accessibilityState: disabled ? { checked: selected, disabled: true } : { checked: selected }, accessibilityLabel: [language.name, language.description].filter(Boolean).join(', '), accessibilityLanguage: language.code, disabled: disabled, onPress: () => onSelect(language), style: disabled ? ({ pressed }) => ({ ...row(pressed), opacity: 0.5 }) : ({ pressed }) => row(pressed), children: [_jsx(View, { ...hidden, children: typeof language.flag === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: language.flag }, style: shape }) : _jsx(View, { style: shape, children: language.flag ?? _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 12, lineHeight: 16, fontWeight: '600', color: colors.muted }, children: language.code.slice(0, 2).toUpperCase() }) }) }), _jsxs(View, { ...hidden, style: { flex: 1, flexShrink: 1, minWidth: 0 }, children: [_jsx(Text, { style: { fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: language.name }), language.description ? _jsx(Text, { style: { fontSize: 14, lineHeight: 20, color: colors.muted }, children: language.description }) : null] }), selected ? _jsx(View, { ...hidden, testID: testID ? `${testID}-check` : undefined, style: { width: 20, height: 20, alignItems: 'center', justifyContent: 'center' }, children: _jsx(View, { style: { width: 6, height: 12, borderRightWidth: 2, borderBottomWidth: 2, borderColor: colors.text, transform: [{ translateY: -1 }, { rotate: '45deg' }] } }) }) : null] }, language.code);
29
29
  }) })] });
30
30
  }
@@ -1,26 +1,60 @@
1
1
  import React from 'react';
2
+ import { View, type PressableProps } from 'react-native';
3
+ /** A text action on the trailing edge of a `ListGroup` heading, such as “Cancel all”. */
4
+ export interface ListGroupAction {
5
+ /** Host text drawn as the action and naming it. */
6
+ label: string;
7
+ onSelect: () => void;
8
+ disabled?: boolean;
9
+ }
2
10
  export interface ListGroupProps {
3
- /** Heading above the group, such as “Settings”. Omit it for an untitled group. */
4
- title?: string;
11
+ /** Heading above the group, such as “Settings”: host text or an element such as a live count. Omit it for an untitled group. */
12
+ title?: React.ReactNode;
13
+ /** Host content after the title, such as a count or a figure; a string is drawn muted. */
14
+ titleAccessory?: React.ReactNode;
15
+ /** A text action on the trailing edge of the heading. */
16
+ action?: ListGroupAction;
17
+ /** Host content between the heading and the rows, such as a note or a field. A group with `intro` and no rows draws no row container. */
18
+ intro?: React.ReactNode;
5
19
  /** `ListRow` elements. */
6
20
  children?: React.ReactNode;
7
21
  testID?: string;
8
22
  }
9
23
  /** A grouped list for menus and settings: an optional heading over rows that share one rounded container. */
10
- export declare function ListGroup({ title, children, testID }: ListGroupProps): React.JSX.Element;
11
- export interface ListRowProps {
24
+ export declare function ListGroup({ title, titleAccessory, action, intro, children, testID }: ListGroupProps): React.JSX.Element;
25
+ export interface ListRowProps extends Omit<PressableProps, 'children' | 'style' | 'onPress' | 'disabled' | 'role' | 'accessibilityRole' | 'accessibilityLabel' | 'accessibilityState' | 'aria-label' | 'aria-checked' | 'aria-disabled' | 'aria-busy' | 'aria-selected'> {
12
26
  label: string;
27
+ /** A muted second line under the label, such as a subtitle or an address. The row grows to fit it, and it is read with the label (as the hint of a switch row). */
28
+ description?: React.ReactNode;
29
+ /** Colours the label: `destructive` for an action that deletes or ends something, `muted` for one that is done or inactive. */
30
+ tone?: 'destructive' | 'muted';
13
31
  /** Artwork before the label, such as an icon. Decorative: the label names the row. */
14
32
  leading?: React.ReactNode;
15
- /** Short text on the trailing edge, such as `Off`, `English` or a balance. A string is drawn muted and read with the label. */
33
+ /** Short text on the trailing edge, such as `Off`, `English` or a balance. A string or number is drawn muted, or in `valueTone`, and read with the label. */
16
34
  value?: React.ReactNode;
35
+ /** What a `value` that is not text reads as, such as the formatted amount of a live figure. The element is then read as this text in its place: with the label on a pressable row, and on its own on a static row. */
36
+ valueLabel?: string;
37
+ /** Colours a string or number `value` instead of the muted default, keeping its layout and reading. */
38
+ valueTone?: 'positive' | 'warning' | 'negative' | 'muted';
17
39
  /** Anything richer on the trailing edge: icons, a Badge, or a control such as a Switch. */
18
40
  trailing?: React.ReactNode;
19
41
  /** Makes the whole row a button, usually one that opens another view, and shows the disclosure chevron. */
20
42
  onSelect?: () => void;
21
- /** Dims the row and blocks `onSelect`. */
43
+ /** Dims the row and blocks `onSelect` and the switch. */
22
44
  disabled?: boolean;
45
+ /** A row in a list of choices, such as a picker that selects and closes: `true` draws a check on the trailing edge, and the row exposes `accessibilityState.selected`. With `selected` set, true or false, the row draws no chevron unless `disclosure` asks for one. */
46
+ selected?: boolean;
47
+ /** Something the row started is in progress: a spinner takes the disclosure's place, the row is read as busy and presses are ignored, without dimming it. A busy switch row ignores presses and is read as unavailable. */
48
+ busy?: boolean;
49
+ /** Busy text appended to the accessible name while `busy` (not on Android, which speaks its own); defaults to HIGProvider `messages.busy`. `''` omits it. */
50
+ busyLabel?: string;
51
+ /** The glyph a row with `onSelect` draws on its trailing edge: the `chevron` (default), `external` (an arrow, for something that opens outside the app) or `none`. */
52
+ disclosure?: 'chevron' | 'external' | 'none';
53
+ /** Makes the row a switch: the whole row is the target, named by `label`, with the track on its trailing edge; `onCheckedChange` receives the new state. Use without `onSelect`. */
54
+ checked?: boolean;
55
+ defaultChecked?: boolean;
56
+ onCheckedChange?: (checked: boolean) => void;
23
57
  testID?: string;
24
58
  }
25
- /** One row of a ListGroup: the label leads; a value, icons, a badge or a control trail. With `onSelect` the whole row is one button and shows a disclosure chevron; without it the row is static, so a control in `trailing` is its only target. */
26
- export declare function ListRow({ label, leading, value, trailing, onSelect, disabled, testID }: ListRowProps): React.JSX.Element;
59
+ /** One row of a ListGroup: the label leads; a value, icons, a badge or a control trail. With `onSelect` the whole row is one button and shows a disclosure chevron; with `checked` or `onCheckedChange` the whole row is a switch; otherwise the row is static, so a control in `trailing` is its only target. Other Pressable props, such as `android_disableSound`, `hitSlop` or `onLongPress`, reach the row, and the ref reaches its view. */
60
+ export declare const ListRow: React.ForwardRefExoticComponent<ListRowProps & React.RefAttributes<React.ComponentRef<typeof View>>>;
@@ -1,27 +1,85 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Pressable, View } from 'react-native';
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { forwardRef, useState } from 'react';
3
+ import { ActivityIndicator, Platform, Pressable, View } from 'react-native';
4
+ import * as en from '@bloxwap/hig/contracts/messages';
3
5
  import { useColors, useFills, useHIG } from './provider.js';
4
6
  import { Text } from './surface.js';
5
7
  import { ChevronIcon } from './icons.js';
8
+ import { SwitchRow } from './switch-row.js';
9
+ import { plainText } from './text-content.js';
10
+ const shown = (node) => node != null && node !== false && node !== '';
11
+ const actionSlop = { top: 12, bottom: 12, left: 8, right: 8 };
6
12
  /** A grouped list for menus and settings: an optional heading over rows that share one rounded container. */
7
- export function ListGroup({ title, children, testID }) {
13
+ export function ListGroup({ title, titleAccessory, action, intro, children, testID }) {
8
14
  const colors = useColors(), { direction } = useHIG();
9
- return _jsxs(View, { testID: testID, style: { direction, gap: 8, minWidth: 0 }, children: [title ? _jsx(Text, { accessibilityRole: 'header', testID: testID ? `${testID}-title` : undefined, style: { paddingHorizontal: 4, color: colors.muted, fontSize: 14, lineHeight: 20, fontWeight: '500' }, children: title }) : null, _jsx(View, { testID: testID ? `${testID}-rows` : undefined, style: { gap: 2, borderRadius: 20, overflow: 'hidden' }, children: children })] });
15
+ const titled = shown(title), accessory = shown(titleAccessory);
16
+ const titleStyle = { color: colors.muted, fontSize: 14, lineHeight: 20, fontWeight: '500' };
17
+ const titleTestID = testID ? `${testID}-title` : undefined;
18
+ // A string title keeps its 0.6.0 anatomy; an element title is one header node. With an accessory, the title and the accessory are one header node instead.
19
+ const joined = titled && accessory;
20
+ const role = joined ? {} : { accessibilityRole: 'header' };
21
+ const name = !titled ? null : typeof title === 'string' || typeof title === 'number'
22
+ ? _jsx(Text, { ...role, testID: titleTestID, style: accessory || action ? { flexShrink: 1, ...titleStyle } : { paddingHorizontal: 4, ...titleStyle }, children: title })
23
+ : _jsx(View, { ...(joined ? {} : { accessible: true, ...role }), testID: titleTestID, style: accessory || action ? { flexShrink: 1 } : { paddingHorizontal: 4 }, children: title });
24
+ const extra = accessory ? _jsx(View, { testID: testID ? `${testID}-title-accessory` : undefined, style: { flexShrink: 1 }, children: typeof titleAccessory === 'string' || typeof titleAccessory === 'number' ? _jsx(Text, { style: titleStyle, children: titleAccessory }) : titleAccessory }) : null;
25
+ // An element with no text of its own, such as a live figure, leaves the platform to read the node's children.
26
+ const titleText = joined ? plainText(title) : '', accessoryText = joined ? plainText(titleAccessory) : '';
27
+ const heading = joined ? _jsxs(View, { accessible: true, accessibilityRole: 'header', accessibilityLabel: titleText && accessoryText ? `${titleText}, ${accessoryText}` : undefined, testID: testID ? `${testID}-heading` : undefined, style: { flexDirection: 'row', alignItems: 'center', gap: 8, flexShrink: 1, minWidth: 0 }, children: [name, extra] }) : _jsxs(_Fragment, { children: [name, extra] });
28
+ // The action stays outside the header node, so it remains its own button.
29
+ const header = !accessory && !action ? name : _jsxs(View, { testID: testID ? `${testID}-header` : undefined, style: { direction, flexDirection: 'row', alignItems: 'center', gap: 8, paddingHorizontal: 4, minWidth: 0 }, children: [heading, action ? _jsx(Pressable, { testID: testID ? `${testID}-action` : undefined, accessibilityRole: 'button', accessibilityLabel: action.label, accessibilityState: { disabled: !!action.disabled }, disabled: action.disabled, hitSlop: actionSlop, onPress: action.onSelect, style: ({ pressed }) => ({ marginStart: 'auto', minWidth: 32, alignItems: 'center', paddingVertical: 4, paddingHorizontal: 4, opacity: action.disabled ? 0.5 : pressed ? 0.6 : 1 }), children: _jsx(Text, { accessible: false, style: { fontSize: 14, lineHeight: 20, fontWeight: '600', color: colors.text }, children: action.label }) }) : null] });
30
+ const empty = React.Children.count(children) === 0;
31
+ return _jsxs(View, { testID: testID, style: { direction, gap: 8, minWidth: 0 }, children: [header, shown(intro) ? _jsx(View, { testID: testID ? `${testID}-intro` : undefined, style: { paddingHorizontal: 4, minWidth: 0 }, children: intro }) : null, shown(intro) && empty ? null : _jsx(View, { testID: testID ? `${testID}-rows` : undefined, style: { gap: 2, borderRadius: 20, overflow: 'hidden' }, children: children })] });
10
32
  }
11
33
  const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
12
- /** One row of a ListGroup: the label leads; a value, icons, a badge or a control trail. With `onSelect` the whole row is one button and shows a disclosure chevron; without it the row is static, so a control in `trailing` is its only target. */
13
- export function ListRow({ label, leading, value, trailing, onSelect, disabled, testID }) {
14
- const colors = useColors(), fills = useFills(), { direction } = useHIG();
34
+ /** The check of a selected row. It does not mirror in right-to-left layouts. */
35
+ function Check({ color, testID }) { return _jsx(View, { ...hidden, testID: testID, style: { width: 20, height: 20, alignItems: 'center', justifyContent: 'center' }, children: _jsx(View, { style: { width: 6, height: 12, borderRightWidth: 2, borderBottomWidth: 2, borderColor: color, transform: [{ translateY: -1 }, { rotate: '45deg' }] } }) }); }
36
+ /** An arrow pointing up and away, for a row that opens something outside the app; it mirrors in right-to-left layouts. */
37
+ function External({ color, rtl, testID }) {
38
+ return _jsxs(View, { ...hidden, testID: testID, style: { width: 20, height: 20, alignItems: 'center', justifyContent: 'center', transform: rtl ? [{ scaleX: -1 }] : undefined }, children: [_jsx(View, { style: { position: 'absolute', width: 12, height: 1.75, borderRadius: 1, backgroundColor: color, transform: [{ rotate: '-45deg' }] } }), _jsx(View, { style: { position: 'absolute', top: 5, right: 5, width: 7, height: 7, borderTopWidth: 1.75, borderRightWidth: 1.75, borderColor: color } })] });
39
+ }
40
+ /** One row of a ListGroup: the label leads; a value, icons, a badge or a control trail. With `onSelect` the whole row is one button and shows a disclosure chevron; with `checked` or `onCheckedChange` the whole row is a switch; otherwise the row is static, so a control in `trailing` is its only target. Other Pressable props, such as `android_disableSound`, `hitSlop` or `onLongPress`, reach the row, and the ref reaches its view. */
41
+ export const ListRow = /* @__PURE__ */ forwardRef(function ListRow({ label, description, tone, leading, value, valueLabel, valueTone, trailing, onSelect, disabled, selected, busy, busyLabel, disclosure, checked, defaultChecked, onCheckedChange, testID, ...rest }, ref) {
42
+ const colors = useColors(), fills = useFills(), { direction, messages } = useHIG();
43
+ const [internal, setInternal] = useState(!!defaultChecked);
44
+ const toggles = !onSelect && (checked !== undefined || defaultChecked !== undefined || onCheckedChange != null);
15
45
  const row = (pressed) => ({ flexDirection: 'row', alignItems: 'flex-start', gap: 12, minHeight: 56, paddingVertical: 8, paddingHorizontal: 20, backgroundColor: pressed ? fills.raised : fills.well, opacity: disabled ? 0.5 : 1 });
16
46
  const text = typeof value === 'string' || typeof value === 'number';
17
- const reading = [label, text ? String(value) : null].filter(Boolean).join(', ');
47
+ const described = shown(description), about = described ? plainText(description) : '';
48
+ const reading = [label, about || null, text ? String(value) : valueLabel ?? null].filter(Boolean).join(', ');
49
+ const busyText = busyLabel ?? messages.busy ?? en.busy;
50
+ const spoken = busy && busyText && Platform.OS !== 'android' ? `${reading} · ${busyText}` : reading;
18
51
  // Everything aligns to the first line of the label, so a trailing switch stays at the top when the label wraps.
19
52
  const first = { minHeight: 40, justifyContent: 'center' };
53
+ // A static row with a state is one element, so the state is read; a trailing control keeps the row open so the control stays its own target.
54
+ const announced = !onSelect && !toggles && (selected !== undefined || !!busy) && trailing == null;
55
+ const quiet = onSelect || toggles || announced ? hidden : {};
20
56
  const lead = leading == null ? null : _jsx(View, { ...hidden, style: first, children: leading });
21
- const name = _jsx(Text, { ...(onSelect ? hidden : {}), style: { flex: 1, flexShrink: 1, minWidth: 0, paddingVertical: 8, fontSize: 16, lineHeight: 24, color: colors.text }, children: label });
22
- const amount = value == null || value === false ? null : text ? _jsx(Text, { ...(onSelect ? hidden : {}), numberOfLines: 1, style: { flexShrink: 1, maxWidth: '50%', paddingVertical: 8, fontSize: 16, lineHeight: 24, color: colors.muted, textAlign: 'right' }, children: value }) : _jsx(View, { style: first, children: value });
23
- const extra = trailing == null ? null : _jsx(View, { pointerEvents: onSelect ? 'none' : 'auto', ...(onSelect ? hidden : {}), style: { flexDirection: 'row', alignItems: 'center', gap: 8, minHeight: 40 }, children: trailing });
57
+ const labelColor = tone === 'destructive' ? colors.negative : tone === 'muted' ? colors.muted : colors.text;
58
+ const name = described
59
+ ? _jsxs(View, { ...quiet, style: { flex: 1, flexShrink: 1, minWidth: 0, paddingVertical: 8 }, children: [_jsx(Text, { style: { fontSize: 16, lineHeight: 24, color: labelColor }, children: label }), _jsx(Text, { testID: testID ? `${testID}-description` : undefined, style: { fontSize: 14, lineHeight: 20, color: colors.muted }, children: description })] })
60
+ : _jsx(Text, { ...quiet, style: { flex: 1, flexShrink: 1, minWidth: 0, paddingVertical: 8, fontSize: 16, lineHeight: 24, color: labelColor }, children: label });
61
+ const amount = value == null || value === false ? null : text ? _jsx(Text, { ...quiet, testID: testID ? `${testID}-value` : undefined, numberOfLines: 1, style: { flexShrink: 1, maxWidth: '50%', paddingVertical: 8, fontSize: 16, lineHeight: 24, color: colors[valueTone ?? 'muted'], textAlign: 'right' }, children: value }) : _jsx(View, { ...(!onSelect && !toggles && !announced && valueLabel ? { accessible: true, accessibilityLabel: valueLabel } : {}), style: first, children: value });
62
+ const extra = trailing == null ? null : _jsx(View, { pointerEvents: onSelect || toggles ? 'none' : 'auto', ...quiet, style: { flexDirection: 'row', alignItems: 'center', gap: 8, minHeight: 40 }, children: trailing });
63
+ const chevron = _jsx(View, { testID: testID ? `${testID}-chevron` : undefined, style: { transform: [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] }, children: _jsx(ChevronIcon, { color: colors.muted }) });
64
+ const glyphKind = disclosure ?? (selected !== undefined ? 'none' : 'chevron');
65
+ const glyph = busy && !toggles ? _jsx(ActivityIndicator, { testID: testID ? `${testID}-busy` : undefined, size: 'small', color: colors.muted, ...hidden })
66
+ : selected ? _jsx(Check, { color: colors.text, testID: testID ? `${testID}-check` : undefined })
67
+ : onSelect ? (glyphKind === 'chevron' ? chevron : glyphKind === 'external' ? _jsx(External, { color: colors.muted, rtl: direction === 'rtl', testID: testID ? `${testID}-external` : undefined }) : null) : null;
68
+ const end = glyph ? _jsx(View, { ...hidden, style: first, children: glyph }) : null;
69
+ if (toggles) {
70
+ const on = checked ?? internal;
71
+ const hint = [about || null, text ? String(value) : valueLabel ?? null].filter(Boolean).join(', ') || undefined;
72
+ // The row holds an uncontrolled state itself so the drawn track follows it; SwitchRow stays controlled and emits feedback once.
73
+ return _jsx(SwitchRow, { ...rest, ref: ref, testID: testID, label: label, accessibilityHint: rest.accessibilityHint ?? hint, accessibilityState: busy ? { busy: true } : undefined, checked: on, disabled: disabled || busy, onCheckedChange: next => { if (checked === undefined)
74
+ setInternal(next); onCheckedChange?.(next); }, style: row(false), children: _jsx(SwitchRowContent, { first: first, lead: lead, name: name, amount: amount, extra: extra, checked: on, testID: testID }) });
75
+ }
76
+ const state = { ...(selected !== undefined ? { selected } : {}), ...(busy ? { busy: true } : {}) };
24
77
  if (!onSelect)
25
- return _jsxs(View, { testID: testID, style: row(false), children: [lead, name, amount, extra] });
26
- return _jsxs(Pressable, { testID: testID, accessibilityRole: 'button', accessibilityLabel: reading, accessibilityState: { disabled: !!disabled }, disabled: disabled, onPress: onSelect, style: ({ pressed }) => row(pressed), children: [lead, name, amount, extra, _jsx(View, { ...hidden, style: first, children: _jsx(View, { testID: testID ? `${testID}-chevron` : undefined, style: { transform: [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] }, children: _jsx(ChevronIcon, { color: colors.muted }) }) })] });
78
+ return _jsxs(View, { ...rest, ref: ref, testID: testID, ...(announced ? { accessible: true, accessibilityLabel: spoken } : {}), accessibilityState: Object.keys(state).length ? state : undefined, style: row(false), children: [lead, name, amount, extra, end] });
79
+ return _jsxs(Pressable, { ...rest, ref: ref, testID: testID, accessibilityRole: 'button', accessibilityLabel: spoken, accessibilityState: { disabled: !!disabled, ...state }, "aria-busy": busy || undefined, disabled: disabled, onPress: busy ? undefined : onSelect, style: ({ pressed }) => row(pressed && !busy), children: [lead, name, amount, extra, end] });
80
+ });
81
+ /** The decorative anatomy of a switch row: the label, value and trailing content, then the track. */
82
+ function SwitchRowContent({ first, lead, name, amount, extra, checked, testID }) {
83
+ const colors = useColors(), fills = useFills();
84
+ return _jsxs(View, { style: { flex: 1, flexDirection: 'row', alignItems: 'flex-start', gap: 12 }, children: [lead, name, amount, extra, _jsx(View, { style: first, children: _jsx(View, { testID: testID ? `${testID}-track` : undefined, style: { width: 40, height: 24, borderRadius: 12, padding: 3, backgroundColor: checked ? colors.action : fills.raised, alignItems: checked ? 'flex-end' : 'flex-start' }, children: _jsx(View, { style: { width: 18, height: 18, borderRadius: 9, backgroundColor: checked ? colors.onAction : colors.text } }) }) })] });
27
85
  }