@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
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import { View, type PressableProps, type StyleProp, type ViewStyle } from 'react-native';
3
+ export { ChevronIcon } from './icons.js';
4
+ export { useStickyHeaderScroll, type StickyHeaderScroll } from './sticky-header.js';
5
+ /** Pressable props passed through to a header control, such as `android_disableSound` or `onPressIn`. HIG keeps its own name, role, state, target and press. */
6
+ export type ScreenHeaderControlProps = Omit<PressableProps, 'children' | 'onPress' | 'disabled' | 'style' | 'accessibilityLabel' | 'accessibilityRole' | 'accessibilityState' | 'testID'>;
7
+ export interface ScreenHeaderProps {
8
+ /** The heading, centred. Host text. */
9
+ title: string;
10
+ /** Shows Back on the leading edge. */
11
+ onBack?: () => void;
12
+ /** Draws Back unavailable: dimmed, read as disabled and not pressable, for example while a close is being signed. */
13
+ backDisabled?: boolean;
14
+ /** Pressable props for Back, such as `{android_disableSound: true}` when the host plays its own sound. */
15
+ backProps?: ScreenHeaderControlProps;
16
+ /** A control on the trailing edge, usually an `IconButton`. */
17
+ action?: React.ReactNode;
18
+ /** Prefix of the test IDs: `<testID>-header`, `<testID>-back` and `<testID>-title`. Omitted, the header sets none. */
19
+ testID?: string;
20
+ /** Sets `nativeID` on the title, so a sheet around the pane can name itself with `accessibilityLabelledBy` (Android). Omitted, the title has none. */
21
+ headingId?: string;
22
+ /** A ref to the heading's accessible element (the title, or the title and badge as one header), for example to move accessibility focus to it when the pane opens. */
23
+ titleRef?: React.Ref<React.ComponentRef<typeof View>>;
24
+ /** Short host text in a badge beside the title, read as part of the heading after a pause: Demo. */
25
+ badge?: string;
26
+ /** Hides the title visually while it stays the accessible heading, for a host that draws its own visible title and must not have it read twice. The header keeps its height. */
27
+ hideTitle?: boolean;
28
+ /** Marks the header as pinned in the host's scroller: it is transparent at rest and takes `stickyHeaderBackground` once `scrolled` is true. Get `scrolled` from `useStickyHeaderScroll()` on that scroller. */
29
+ stickyHeader?: boolean;
30
+ /** With `stickyHeader`: content has scrolled under the header, so it draws its fill. */
31
+ scrolled?: boolean;
32
+ /** With `stickyHeader`: the fill once content is under the header. Defaults to the background role; in a sheet pass the sheet's fill (`useColors().overlay`). */
33
+ stickyHeaderBackground?: string;
34
+ /** Style of the header's container, such as padding when it sits in a scroller's sticky slot. */
35
+ style?: StyleProp<ViewStyle>;
36
+ }
37
+ /** The block header's Close control, shared by the blocks that draw one. */
38
+ export declare function HeaderClose({ onClose, label, testID, closeProps }: {
39
+ onClose: () => void;
40
+ label: string;
41
+ testID?: string;
42
+ closeProps?: ScreenHeaderControlProps;
43
+ }): React.JSX.Element;
44
+ /**
45
+ * The header of a block that is its own screen: Back on the leading edge, the title centred, an optional control on the trailing
46
+ * edge. The settings blocks (Notifications, Signals, Sound & Haptics) draw it; the other native blocks draw a header that matches
47
+ * it. Import it from `@bloxwap/hig/native/screen-header` for a host pane that has no block.
48
+ */
49
+ export declare function ScreenHeader({ title, onBack, backDisabled, backProps, action, testID, headingId, titleRef, badge, hideTitle, stickyHeader, scrolled, stickyHeaderBackground, style }: ScreenHeaderProps): React.JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ import { useColors, useHIG, useMessages } from './provider.js';
4
+ import { Text } from './surface.js';
5
+ import { IconButton } from './button.js';
6
+ import { ChevronIcon, CloseIcon } from './icons.js';
7
+ import { Badge } from './status.js';
8
+ import { stickyHeaderFill } from './sticky-header.js';
9
+ export { ChevronIcon } from './icons.js';
10
+ export { useStickyHeaderScroll } from './sticky-header.js';
11
+ /** The block header's Close control, shared by the blocks that draw one. */
12
+ export function HeaderClose({ onClose, label, testID, closeProps }) {
13
+ const colors = useColors();
14
+ return _jsx(IconButton, { ...closeProps, intent: 'ghost', label: label, suppressFeedback: true, testID: testID, onPress: onClose, children: _jsx(CloseIcon, { color: colors.text }) });
15
+ }
16
+ /**
17
+ * The header of a block that is its own screen: Back on the leading edge, the title centred, an optional control on the trailing
18
+ * edge. The settings blocks (Notifications, Signals, Sound & Haptics) draw it; the other native blocks draw a header that matches
19
+ * it. Import it from `@bloxwap/hig/native/screen-header` for a host pane that has no block.
20
+ */
21
+ export function ScreenHeader({ title, onBack, backDisabled, backProps, action, testID, headingId, titleRef, badge, hideTitle, stickyHeader, scrolled, stickyHeaderBackground, style }) {
22
+ const colors = useColors(), t = useMessages(), { direction } = useHIG();
23
+ const id = (part) => testID === undefined ? undefined : `${testID}-${part}`;
24
+ // Clear white stays in the accessibility tree where opacity 0 might not; the title keeps its line so the header keeps its height.
25
+ const ink = hideTitle ? '#ffffff00' : colors.text;
26
+ const heading = { textAlign: 'center', fontSize: 17, lineHeight: 24, fontWeight: '600', color: ink };
27
+ const fill = stickyHeader ? stickyHeaderFill(!!scrolled, stickyHeaderBackground ?? colors.background) : undefined;
28
+ return _jsxs(View, { testID: id('header'), style: [{ flexDirection: 'row', alignItems: 'center', minHeight: 44 }, fill, style], children: [_jsx(View, { style: { minWidth: 44, alignItems: 'flex-start' }, children: onBack ? _jsx(IconButton, { ...backProps, intent: 'ghost', label: t.back, disabled: backDisabled, suppressFeedback: true, testID: id('back'), onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: backDisabled ? colors.faint : colors.text }) }) }) : null }), badge ? _jsxs(View, { ref: titleRef, nativeID: headingId, accessible: true, accessibilityRole: 'header', accessibilityLabel: `${title}, ${badge}`, style: { flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8, minWidth: 0 }, children: [_jsx(Text, { testID: id('title'), accessible: false, numberOfLines: 1, style: { ...heading, flexShrink: 1 }, children: title }), hideTitle ? null : _jsx(View, { testID: id('badge'), style: { flexShrink: 0 }, children: _jsx(Badge, { children: _jsx(Text, { style: { fontSize: 12, lineHeight: 16, fontWeight: '600', color: colors.text }, children: badge }) }) })] }) : _jsx(Text, { ref: titleRef, testID: id('title'), nativeID: headingId, accessibilityRole: 'header', numberOfLines: 1, style: { flex: 1, ...heading }, children: title }), _jsx(View, { style: { minWidth: 44, alignItems: 'flex-end' }, children: action })] });
29
+ }
@@ -1,8 +1,8 @@
1
1
  export type { Choice, CheckedProps, ChoicesProps } from './selection-types.js';
2
- export { Switch, SwitchRow, type SwitchRowProps } from './switch.js';
2
+ export { Switch, SwitchRow, type SwitchProps, type SwitchRowProps } from './switch.js';
3
3
  export { Checkbox } from './checkbox.js';
4
4
  export { RadioGroup } from './radio-group.js';
5
5
  export { Select } from './select.js';
6
6
  export { Slider } from './slider.js';
7
- export { SegmentedControl } from './radio-group.js';
7
+ export { SegmentedControl, type SegmentedControlProps } from './radio-group.js';
8
8
  export { Filter, type FilterOption, type FilterProps } from './radio-group.js';
@@ -1,8 +1,2 @@
1
- import React from 'react';
2
- /** The header of a block that is its own screen: Back on the leading edge, the title centred, an optional control on the trailing edge. */
3
- export declare function SettingHeader({ title, onBack, action, testID }: {
4
- title: string;
5
- onBack?: () => void;
6
- action?: React.ReactNode;
7
- testID: string;
8
- }): React.JSX.Element;
1
+ /** The settings blocks' header, published as `ScreenHeader` from `@bloxwap/hig/native/screen-header`. */
2
+ export { ScreenHeader as SettingHeader } from './screen-header.js';
@@ -1,11 +1,2 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { View } from 'react-native';
3
- import { useColors, useHIG, useMessages } from './provider.js';
4
- import { Text } from './surface.js';
5
- import { IconButton } from './button.js';
6
- import { ChevronIcon } from './icons.js';
7
- /** The header of a block that is its own screen: Back on the leading edge, the title centred, an optional control on the trailing edge. */
8
- export function SettingHeader({ title, onBack, action, testID }) {
9
- const colors = useColors(), t = useMessages(), { direction } = useHIG();
10
- return _jsxs(View, { testID: `${testID}-header`, 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}-back`, onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: `${testID}-title`, accessibilityRole: 'header', numberOfLines: 1, style: { flex: 1, textAlign: 'center', fontSize: 17, lineHeight: 24, fontWeight: '600', color: colors.text }, children: title }), _jsx(View, { style: { minWidth: 44, alignItems: 'flex-end' }, children: action })] });
11
- }
1
+ /** The settings blocks' header, published as `ScreenHeader` from `@bloxwap/hig/native/screen-header`. */
2
+ export { ScreenHeader as SettingHeader } from './screen-header.js';
@@ -1,4 +1,11 @@
1
1
  import React from 'react';
2
+ /** A secondary button under a setting, such as Open Settings. `feedback: false` keeps the provider's press feedback off this one button, for a host that plays its own cue for it; by default it plays like any `Button`. */
3
+ export interface SettingAction {
4
+ label: string;
5
+ onSelect: () => void;
6
+ disabled?: boolean;
7
+ feedback?: boolean;
8
+ }
2
9
  export interface SettingSwitchProps {
3
10
  label: string;
4
11
  description?: string;
@@ -6,9 +13,15 @@ export interface SettingSwitchProps {
6
13
  onCheckedChange: (checked: boolean) => void;
7
14
  disabled?: boolean;
8
15
  testID?: string;
16
+ /** Always on and not changeable: the switch shows on at full strength and is read as unavailable. Presses do nothing. */
17
+ locked?: boolean;
18
+ /** Host content after the label, such as a badge. It is drawn only: the switch is read by `label` (and `labelAccessoryLabel`), so put any meaning it carries there or in the description. */
19
+ labelAccessory?: React.ReactNode;
20
+ /** Host words for the `labelAccessory`, read after the label and a pause: `Feed, New`. Same prop on web. */
21
+ labelAccessoryLabel?: string;
9
22
  }
10
23
  /** One setting as a switch: the label over an optional description on the leading edge, the track on the trailing edge. The whole row is the switch; the label names it and the description is its hint. */
11
- export declare function SettingSwitch({ label, description, checked, onCheckedChange, disabled, testID }: SettingSwitchProps): React.JSX.Element;
24
+ export declare function SettingSwitch({ label, description, checked: requested, onCheckedChange, disabled, locked, labelAccessory, labelAccessoryLabel, testID }: SettingSwitchProps): React.JSX.Element;
12
25
  /** The card a setting sits in. Inside a list the cards share one rounded container, so they drop their own radius. */
13
26
  export declare function SettingCard({ children, joined, testID }: React.PropsWithChildren<{
14
27
  joined?: boolean;
@@ -4,9 +4,12 @@ import { useColors, useFills, useHIG } from './provider.js';
4
4
  import { Text } from './surface.js';
5
5
  import { SwitchRow } from './switch-row.js';
6
6
  /** One setting as a switch: the label over an optional description on the leading edge, the track on the trailing edge. The whole row is the switch; the label names it and the description is its hint. */
7
- export function SettingSwitch({ label, description, checked, onCheckedChange, disabled, testID }) {
7
+ export function SettingSwitch({ label, description, checked: requested, onCheckedChange, disabled, locked, labelAccessory, labelAccessoryLabel, testID }) {
8
8
  const colors = useColors(), fills = useFills(), { direction } = useHIG();
9
- return _jsx(SwitchRow, { testID: testID, label: label, accessibilityHint: description, checked: checked, disabled: disabled, onCheckedChange: onCheckedChange, style: { minHeight: 32, opacity: disabled ? 0.5 : 1 }, children: _jsxs(View, { style: { direction, flex: 1, flexDirection: 'row', alignItems: 'flex-start', gap: 12 }, children: [_jsxs(View, { style: { flex: 1, minWidth: 0, gap: 2 }, children: [_jsx(Text, { style: { fontSize: 16, lineHeight: 24, color: colors.text }, children: label }), description ? _jsx(Text, { style: { fontSize: 14, lineHeight: 21, color: colors.muted }, children: description }) : null] }), _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 } }) })] }) });
9
+ const checked = locked ? true : requested;
10
+ const name = _jsx(Text, { style: { fontSize: 16, lineHeight: 24, color: colors.text }, children: label });
11
+ const named = labelAccessoryLabel && labelAccessory != null && labelAccessory !== false ? `${label}, ${labelAccessoryLabel}` : label;
12
+ return _jsx(SwitchRow, { testID: testID, label: named, accessibilityHint: description, checked: checked, disabled: locked ? true : disabled, onCheckedChange: onCheckedChange, style: { minHeight: 32, opacity: disabled ? 0.5 : 1 }, children: _jsxs(View, { style: { direction, flex: 1, flexDirection: 'row', alignItems: 'flex-start', gap: 12 }, children: [_jsxs(View, { style: { flex: 1, minWidth: 0, gap: 2 }, children: [labelAccessory != null && labelAccessory !== false ? _jsxs(View, { testID: testID ? `${testID}-label` : undefined, style: { direction, flexDirection: 'row', alignItems: 'center', flexWrap: 'wrap', gap: 8 }, children: [name, labelAccessory] }) : name, description ? _jsx(Text, { style: { fontSize: 14, lineHeight: 21, color: colors.muted }, children: description }) : null] }), _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 } }) })] }) });
10
13
  }
11
14
  /** The card a setting sits in. Inside a list the cards share one rounded container, so they drop their own radius. */
12
15
  export function SettingCard({ children, joined, testID }) {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { View, type ScrollViewProps } from 'react-native';
2
3
  /** One signal the viewer can turn on. */
3
4
  export interface SignalsItem {
4
5
  id: string;
@@ -7,6 +8,16 @@ export interface SignalsItem {
7
8
  checked: boolean;
8
9
  onCheckedChange: (checked: boolean) => void;
9
10
  disabled?: boolean;
11
+ /** Always on and not changeable: shown on at full strength and read as unavailable. */
12
+ locked?: boolean;
13
+ /** Host content after the label, such as a badge. It is drawn only; the switch is read by `label`. */
14
+ labelAccessory?: React.ReactNode;
15
+ /** Host words for the `labelAccessory`, read after the label and a pause: `Feed, New`. */
16
+ labelAccessoryLabel?: string;
17
+ /** A neutral line under the switch, announced when it changes: Needs this device's permission. */
18
+ hint?: string;
19
+ /** A failure under the switch, in the negative role and announced. */
20
+ error?: string;
10
21
  }
11
22
  /** A family of signals under one heading: Trend, Swing. Every word is host text. */
12
23
  export interface SignalsGroup {
@@ -14,24 +25,37 @@ export interface SignalsGroup {
14
25
  title: string;
15
26
  /** Shows the verified mark after the title. */
16
27
  verified?: boolean;
17
- /** A small pill on the trailing edge of the heading: How it works. The host opens its own explanation. */
28
+ /** A small pill on the trailing edge of the heading: How it works. The host opens its own explanation. `ref` reaches the pill, so the host can move accessibility focus back to it when the explanation closes. */
18
29
  help?: {
19
30
  label: string;
20
31
  onSelect: () => void;
32
+ ref?: React.Ref<View>;
21
33
  };
22
34
  items: readonly SignalsItem[];
23
35
  }
24
36
  export interface SignalsBlockProps {
25
37
  /** Heading: Signals. */
26
38
  title: string;
39
+ /** A muted line under the header that explains the screen. */
40
+ description?: string;
27
41
  groups: readonly SignalsGroup[];
28
42
  /** Words for the verified mark, read after the group title. */
29
43
  verifiedLabel?: string;
44
+ /** Host artwork in place of the built-in verified mark, inside the heading's one accessible element. */
45
+ verifiedMark?: React.ReactNode;
46
+ /** The `verifiedMark` is a control: it stays in the accessibility tree, the heading then sits on the title text and the mark follows as its own element. */
47
+ verifiedMarkInteractive?: boolean;
30
48
  /** Shows Back on the leading edge of the header. */
31
49
  onBack?: () => void;
32
50
  /** A control on the trailing edge of the header, usually an IconButton. */
33
51
  headerAction?: React.ReactNode;
52
+ /** Keeps the header pinned while the groups scroll: the block becomes its own scroll view with the header as its sticky first child, transparent at rest and filled once content scrolls under it. Place it in a bounded container. */
53
+ stickyHeader?: boolean;
54
+ /** Fill behind the pinned header once content scrolls under it. Defaults to the background role; in a sheet pass the sheet's fill. */
55
+ stickyHeaderBackground?: string;
56
+ /** The scroll view used with `stickyHeader`, such as a sheet library's own. */
57
+ scrollComponent?: React.ComponentType<ScrollViewProps>;
34
58
  testID?: string;
35
59
  }
36
60
  /** The signals the viewer receives, as a screen, in groups: each group has a heading with an optional verified mark and a small help pill, and its signals as switches with a line of explanation, sharing one rounded container. */
37
- export declare function SignalsBlock({ title, groups, verifiedLabel, onBack, headerAction, testID }: SignalsBlockProps): React.JSX.Element;
61
+ export declare function SignalsBlock({ title, description, groups, verifiedLabel, verifiedMark, verifiedMarkInteractive, onBack, headerAction, stickyHeader, stickyHeaderBackground, scrollComponent, testID }: SignalsBlockProps): React.JSX.Element;
@@ -1,16 +1,26 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { View } from 'react-native';
3
+ import { StickyHeaderLayout } from './sticky-header.js';
3
4
  import { useColors, useHIG } from './provider.js';
4
5
  import { Text } from './surface.js';
5
6
  import { SwapCapsule } from './swap-parts.js';
6
7
  import { SeverityIcon } from './icons.js';
7
8
  import { SettingCard, SettingHeader, SettingSwitch } from './setting-switch.js';
9
+ /** The 32dp help pill keeps a 48dp touch target: 8dp beyond each edge, clear of the switches 8dp below the 44dp heading row. */
10
+ const helpSlop = { top: 8, bottom: 8, left: 8, right: 8 };
8
11
  /** The signals the viewer receives, as a screen, in groups: each group has a heading with an optional verified mark and a small help pill, and its signals as switches with a line of explanation, sharing one rounded container. */
9
- export function SignalsBlock({ title, groups, verifiedLabel, onBack, headerAction, testID }) {
12
+ export function SignalsBlock({ title, description, groups, verifiedLabel, verifiedMark, verifiedMarkInteractive, onBack, headerAction, stickyHeader, stickyHeaderBackground, scrollComponent, testID }) {
10
13
  const colors = useColors(), { direction } = useHIG();
14
+ const note = { fontSize: 14, lineHeight: 21 };
15
+ const split = (group) => !!group.verified && verifiedMark != null && !!verifiedMarkInteractive;
16
+ const heading = (group) => [group.title, group.verified && verifiedLabel ? verifiedLabel : null].filter(Boolean).join(', ');
11
17
  const sections = groups.map(group => {
12
18
  const id = `signals-${group.id}`;
13
- return _jsxs(View, { testID: id, style: { gap: 8, marginTop: 16 }, children: [_jsxs(View, { style: { direction, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12, minHeight: 44, paddingStart: 4 }, children: [_jsxs(View, { accessible: true, accessibilityRole: 'header', accessibilityLabel: [group.title, group.verified && verifiedLabel ? verifiedLabel : null].filter(Boolean).join(', '), testID: `${id}-title`, style: { flexDirection: 'row', alignItems: 'center', gap: 6, flexShrink: 1 }, children: [_jsx(Text, { accessible: false, numberOfLines: 1, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '500', color: colors.muted }, children: group.title }), group.verified ? _jsx(View, { testID: `${id}-verified`, style: { transform: [{ scale: 0.8 }] }, children: _jsx(SeverityIcon, { kind: 'success', color: colors.warning }) }) : null] }), group.help ? _jsx(SwapCapsule, { testID: `${id}-help`, onPress: group.help.onSelect, children: _jsx(Text, { style: { fontSize: 14, lineHeight: 20, fontWeight: '500', color: colors.muted }, children: group.help.label }) }) : null] }), group.items.length > 0 ? _jsx(View, { testID: `${id}-items`, style: { gap: 2, borderRadius: 20, overflow: 'hidden' }, children: group.items.map(item => _jsx(SettingCard, { joined: true, testID: `${id}-${item.id}`, children: _jsx(SettingSwitch, { testID: `${id}-${item.id}-switch`, label: item.label, description: item.description, checked: item.checked, disabled: item.disabled, onCheckedChange: item.onCheckedChange }) }, item.id)) }) : null] }, group.id);
19
+ return _jsxs(View, { testID: id, style: { gap: 8, marginTop: 16 }, children: [_jsxs(View, { style: { direction, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12, minHeight: 44, paddingStart: 4 }, children: [_jsxs(View, { accessible: !split(group), accessibilityRole: split(group) ? undefined : 'header', accessibilityLabel: split(group) ? undefined : heading(group), testID: `${id}-title`, style: { flexDirection: 'row', alignItems: 'center', gap: 6, flexShrink: 1 }, children: [_jsx(Text, { accessible: split(group), accessibilityRole: split(group) ? 'header' : undefined, accessibilityLabel: split(group) ? heading(group) : undefined, numberOfLines: 1, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '500', color: colors.muted }, children: group.title }), group.verified ? (verifiedMark != null ? _jsx(View, { testID: `${id}-verified`, children: verifiedMark }) : _jsx(View, { testID: `${id}-verified`, style: { transform: [{ scale: 0.8 }] }, children: _jsx(SeverityIcon, { kind: 'success', color: colors.warning }) })) : null] }), group.help ? _jsx(SwapCapsule, { ref: group.help.ref, testID: `${id}-help`, hitSlop: helpSlop, onPress: group.help.onSelect, children: _jsx(Text, { style: { fontSize: 14, lineHeight: 20, fontWeight: '500', color: colors.muted }, children: group.help.label }) }) : null] }), group.items.length > 0 ? _jsx(View, { testID: `${id}-items`, style: { gap: 2, borderRadius: 20, overflow: 'hidden' }, children: group.items.map(item => _jsxs(SettingCard, { joined: true, testID: `${id}-${item.id}`, children: [_jsx(SettingSwitch, { testID: `${id}-${item.id}-switch`, label: item.label, description: item.description, checked: item.checked, disabled: item.disabled, locked: item.locked, labelAccessory: item.labelAccessory, labelAccessoryLabel: item.labelAccessoryLabel, onCheckedChange: item.onCheckedChange }), item.hint || item.error ? _jsxs(View, { style: { gap: 4 }, children: [item.hint ? _jsx(Text, { testID: `${id}-${item.id}-hint`, accessibilityLiveRegion: 'polite', style: { ...note, color: colors.muted }, children: item.hint }) : null, item.error ? _jsx(Text, { testID: `${id}-${item.id}-error`, accessibilityRole: 'alert', accessibilityLiveRegion: 'polite', style: { ...note, color: colors.negative }, children: item.error }) : null] }) : null] }, item.id)) }) : null] }, group.id);
14
20
  });
15
- return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [_jsx(SettingHeader, { testID: 'signals', title: title, onBack: onBack, action: headerAction }), sections] });
21
+ const header = _jsx(SettingHeader, { testID: 'signals', title: title, onBack: onBack, action: headerAction });
22
+ const body = _jsxs(_Fragment, { children: [description ? _jsx(Text, { testID: 'signals-description', style: { ...note, color: colors.muted, marginTop: 16, paddingHorizontal: 4 }, children: description }) : null, sections] });
23
+ if (stickyHeader)
24
+ return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: 'signals-sticky-header', header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, children: body });
25
+ return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [header, body] });
16
26
  }
@@ -1,4 +1,8 @@
1
1
  import React from 'react';
2
+ import { type ScrollViewProps } from 'react-native';
3
+ import { type SettingAction } from './setting-switch.js';
4
+ export type { SettingAction } from './setting-switch.js';
5
+ import type { Choice } from './selection-types.js';
2
6
  /** A volume as a few fixed steps. `value` and `options` are fractions: 0.25 reads 25%. */
3
7
  export interface SoundVolume {
4
8
  /** Names the steps and is drawn above them: Volume. */
@@ -18,22 +22,45 @@ export interface SoundSection {
18
22
  disabled?: boolean;
19
23
  /** The device in use, under the switch: iPhone Microphone. */
20
24
  source?: string;
25
+ /** A choice between devices, as radios under the source: Automatic, iPhone Microphone, AirPods. Shown while the channel is on. */
26
+ choices?: SoundChoices;
21
27
  /** A live input level from 0 to 1, drawn as a meter. `null` draws an empty meter. */
22
28
  level?: number | null;
29
+ /** Names the meter for assistive technology, which then reads the level as a percentage. Without it the meter is decorative. */
30
+ levelLabel?: string;
23
31
  volume?: SoundVolume;
32
+ /** What the volume does while the channel is off: `hidden` (the default) leaves it out, `disabled` keeps it in place and unavailable. */
33
+ volumeWhenOff?: 'hidden' | 'disabled';
34
+ /** A secondary action at the foot of the card, shown whether the channel is on or off: Open Settings. `feedback: false` keeps the provider's press feedback off it. */
35
+ action?: SettingAction;
36
+ }
37
+ /** A choice of device under the source, such as which microphone to use. `label` names the group and is drawn above it. */
38
+ export interface SoundChoices {
39
+ label: string;
40
+ options: readonly Choice[];
41
+ value: string;
42
+ onValueChange: (value: string) => void;
24
43
  }
25
44
  export interface SoundHapticsBlockProps {
26
45
  /** Heading: Sound & Haptics. */
27
46
  title: string;
28
- /** One card each, in order. A section's source, meter and volume show only while it is on. */
47
+ /** A muted line under the header that explains the screen. */
48
+ description?: string;
49
+ /** One card each, in order. A section's source, choices and meter show only while it is on; its volume too unless `volumeWhenOff` is `disabled`. */
29
50
  sections: readonly SoundSection[];
30
51
  /** Shows Back on the leading edge of the header. */
31
52
  onBack?: () => void;
32
53
  /** A control on the trailing edge of the header, usually an IconButton. */
33
54
  headerAction?: React.ReactNode;
55
+ /** Keeps the header pinned while the cards scroll: the block becomes its own scroll view with the header as its sticky first child, transparent at rest and filled once content scrolls under it. Place it in a bounded container. */
56
+ stickyHeader?: boolean;
57
+ /** Fill behind the pinned header once content scrolls under it. Defaults to the background role; in a sheet pass the sheet's fill. */
58
+ stickyHeaderBackground?: string;
59
+ /** The scroll view used with `stickyHeader`, such as a sheet library's own. */
60
+ scrollComponent?: React.ComponentType<ScrollViewProps>;
34
61
  testID?: string;
35
62
  }
36
63
  /** The share of the meter filled, from 0 to 1. Unknown and out-of-range levels are clamped. */
37
64
  export declare const soundLevel: (level: number | null | undefined) => number;
38
65
  /** The settings for what the app plays and feels like, as a screen: each channel is a card with a switch, and a channel that is on can show the device it uses, a live input meter and its volume as fixed steps. */
39
- export declare function SoundHapticsBlock({ title, sections, onBack, headerAction, testID }: SoundHapticsBlockProps): React.JSX.Element;
66
+ export declare function SoundHapticsBlock({ title, description, sections, onBack, headerAction, stickyHeader, stickyHeaderBackground, scrollComponent, testID }: SoundHapticsBlockProps): React.JSX.Element;
@@ -1,21 +1,32 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { View } from 'react-native';
3
3
  import { formatNumber } from '@bloxwap/hig/contracts';
4
- import { useColors, useFills, useHIG } from './provider.js';
4
+ import { useColors, useFills, useHIG, useNumberLocale } from './provider.js';
5
5
  import { Text } from './surface.js';
6
6
  import { Button } from './button.js';
7
7
  import { SettingCard, SettingHeader, SettingSwitch } from './setting-switch.js';
8
+ import { StickyHeaderLayout } from './sticky-header.js';
9
+ import { RadioGroup } from './radio-group.js';
8
10
  const steps = [0.25, 0.5, 0.75, 1], percent = { style: 'percent', maximumFractionDigits: 0 };
9
11
  const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
10
12
  /** The share of the meter filled, from 0 to 1. Unknown and out-of-range levels are clamped. */
11
13
  export const soundLevel = (level) => level == null || !Number.isFinite(level) ? 0 : Math.min(1, Math.max(0, level));
12
14
  /** The settings for what the app plays and feels like, as a screen: each channel is a card with a switch, and a channel that is on can show the device it uses, a live input meter and its volume as fixed steps. */
13
- export function SoundHapticsBlock({ title, sections, onBack, headerAction, testID }) {
14
- const colors = useColors(), fills = useFills(), { direction, locale } = useHIG();
15
+ export function SoundHapticsBlock({ title, description, sections, onBack, headerAction, stickyHeader, stickyHeaderBackground, scrollComponent, testID }) {
16
+ const colors = useColors(), fills = useFills(), { direction } = useHIG(), locale = useNumberLocale();
15
17
  const caption = { fontSize: 14, lineHeight: 21, color: colors.muted };
16
18
  const cards = sections.map(section => {
17
- const { source, level, volume } = section, open = section.checked && (!!source || level !== undefined || !!volume), id = `sound-${section.id}`;
18
- return _jsxs(SettingCard, { testID: id, children: [_jsx(SettingSwitch, { testID: `${id}-switch`, label: section.label, description: section.description, checked: section.checked, disabled: section.disabled, onCheckedChange: section.onCheckedChange }), open ? _jsxs(View, { testID: `${id}-body`, style: { gap: 8 }, children: [source ? _jsx(Text, { testID: `${id}-source`, style: caption, children: source }) : null, level !== undefined ? _jsx(View, { ...hidden, testID: `${id}-meter`, style: { direction, flexDirection: 'row', height: 4, borderRadius: 2, backgroundColor: fills.raised, overflow: 'hidden' }, children: _jsx(View, { testID: `${id}-level`, style: { width: `${soundLevel(level) * 100}%`, borderRadius: 2, backgroundColor: colors.action } }) }) : null, volume ? _jsxs(View, { testID: `${id}-volume`, accessibilityRole: 'radiogroup', accessibilityLabel: volume.label, style: { gap: 8 }, children: [_jsx(Text, { ...hidden, style: caption, children: volume.label }), _jsx(View, { style: { direction, flexDirection: 'row', gap: 8 }, children: (volume.options ?? steps).map(option => _jsx(Button, { testID: `${id}-volume-${option}`, intent: option === volume.value ? 'primary' : 'secondary', accessibilityState: { selected: option === volume.value }, disabled: section.disabled, onPress: () => volume.onValueChange(option), style: { flex: 1, alignSelf: 'auto', paddingHorizontal: 8 }, children: formatNumber(option, locale, percent) }, option)) })] }) : null] }) : null] }, section.id);
19
+ const { source, choices, level, levelLabel, volume, action } = section, on = section.checked, id = `sound-${section.id}`;
20
+ const showVolume = !!volume && (on || section.volumeWhenOff === 'disabled');
21
+ const open = (on && (!!source || !!choices || level !== undefined)) || showVolume || !!action;
22
+ const share = soundLevel(level);
23
+ const fill = _jsx(View, { testID: `${id}-level`, style: { width: `${share * 100}%`, borderRadius: 2, backgroundColor: colors.action } }), track = { direction, flexDirection: 'row', height: 4, borderRadius: 2, backgroundColor: fills.raised, overflow: 'hidden' };
24
+ return _jsxs(SettingCard, { testID: id, children: [_jsx(SettingSwitch, { testID: `${id}-switch`, label: section.label, description: section.description, checked: section.checked, disabled: section.disabled, onCheckedChange: section.onCheckedChange }), open ? _jsxs(View, { testID: `${id}-body`, style: { gap: 8 }, children: [on && source ? _jsx(Text, { testID: `${id}-source`, style: caption, children: source }) : null, on && choices ? _jsx(View, { testID: `${id}-choices`, children: _jsx(RadioGroup, { label: choices.label, options: choices.options, value: choices.value, disabled: section.disabled, onValueChange: choices.onValueChange }) }) : null, on && level !== undefined ? (levelLabel ? _jsx(View, { testID: `${id}-meter`, accessible: true, accessibilityRole: 'progressbar', accessibilityLabel: levelLabel, accessibilityValue: { min: 0, max: 100, now: Math.round(share * 100), text: formatNumber(share, locale, percent) }, style: track, children: fill })
25
+ : _jsx(View, { ...hidden, testID: `${id}-meter`, style: track, children: fill })) : null, showVolume && volume ? _jsxs(View, { testID: `${id}-volume`, accessibilityRole: 'radiogroup', accessibilityLabel: volume.label, style: { gap: 8 }, children: [_jsx(Text, { ...hidden, style: caption, children: volume.label }), _jsx(View, { style: { direction, flexDirection: 'row', gap: 8 }, children: (volume.options ?? steps).map(option => _jsx(Button, { testID: `${id}-volume-${option}`, intent: option === volume.value ? 'primary' : 'secondary', accessibilityState: { selected: option === volume.value }, disabled: on ? section.disabled : true, onPress: () => volume.onValueChange(option), style: { flex: 1, alignSelf: 'auto', paddingHorizontal: 8 }, children: formatNumber(option, locale, percent) }, option)) })] }) : null, action ? _jsx(View, { style: { marginTop: on && (source || choices || level !== undefined) || showVolume ? 8 : 0 }, children: _jsx(Button, { testID: `${id}-action`, intent: 'secondary', fullWidth: true, disabled: action.disabled, suppressFeedback: action.feedback === false, onPress: action.onSelect, children: action.label }) }) : null] }) : null] }, section.id);
19
26
  });
20
- return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [_jsx(SettingHeader, { testID: 'sound', title: title, onBack: onBack, action: headerAction }), sections.length > 0 ? _jsx(View, { testID: 'sound-sections', style: { gap: 8, marginTop: 16 }, children: cards }) : null] });
27
+ const header = _jsx(SettingHeader, { testID: 'sound', title: title, onBack: onBack, action: headerAction });
28
+ const body = _jsxs(_Fragment, { children: [description ? _jsx(Text, { testID: 'sound-description', style: { ...caption, marginTop: 16, paddingHorizontal: 4 }, children: description }) : null, sections.length > 0 ? _jsx(View, { testID: 'sound-sections', style: { gap: 8, marginTop: 16 }, children: cards }) : null] });
29
+ if (stickyHeader)
30
+ return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: 'sound-sticky-header', header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, children: body });
31
+ return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [header, body] });
21
32
  }
@@ -14,12 +14,12 @@ declare const severityRole: {
14
14
  export type AlertSeverity = keyof typeof severityRole | 'default';
15
15
  /** Neutral chip in the dark well fill (one step lighter inside a Surface, Dialog or sheet). */
16
16
  export declare function Badge({ children }: React.PropsWithChildren): React.JSX.Element;
17
- /** Severity tints the fill 10% and colours the title from a token role (info/note → info, success/tip → positive, warning, error → negative; default → 6% of `text`), with no stroke or glow; `tone` swaps in another approved token role, never a raw colour. A non-string title renders inside the Heading, so pass strings or inline Text; its visible text is announced. */
18
- export declare function Alert({ title, children, severity, tone, action, announce }: React.PropsWithChildren<{
17
+ /** Severity tints the fill 10% and colours the title from a token role (info/note → info, success/tip → positive, warning, error → negative; default → 6% of `text`), with no stroke or glow; `tone` swaps in another approved token role, never a raw colour. A non-string title renders inside the Heading, so pass strings or inline Text; its visible text is announced. A string or number child is drawn in a HIG `Text`. `announce` (default true) speaks the title and body when they appear or change; pass `false` for guidance that is present from the start. */
18
+ export declare function Alert({ title, children: body, severity, tone, action, announce }: React.PropsWithChildren<{
19
19
  title: React.ReactNode;
20
20
  severity?: AlertSeverity;
21
21
  tone?: AccentRole;
22
- action?: React.ReactNode;
22
+ action?: React.ReactNode; /** Speaks the alert when it appears or changes (iOS announcement, Android live region). Defaults to true. */
23
23
  announce?: boolean;
24
24
  }>): React.JSX.Element;
25
25
  export declare const Callout: typeof Alert;
@@ -52,10 +52,11 @@ export declare function useTransientNotice(duration?: number): {
52
52
  export declare function Spinner({ label }: {
53
53
  label?: string;
54
54
  }): React.JSX.Element;
55
- export declare function Progress({ label, value, max }: {
55
+ export declare function Progress({ label, value, max, hideValue }: {
56
56
  label: string;
57
57
  value?: number;
58
- max?: number;
58
+ max?: number; /** Draws the label without the ` value/max` suffix (or the `…` while indeterminate), for a host that shows the figure itself. The value is still read. */
59
+ hideValue?: boolean;
59
60
  }): React.JSX.Element;
60
61
  /** Pulses while content is on its way; still with reduced motion. */
61
62
  export declare function Skeleton({ label }: {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef, useState } from 'react';
2
+ import React, { useEffect, useRef, useState } from 'react';
3
3
  import { tokens } from '@bloxwap/hig/tokens';
4
4
  import { CloseIcon, EmptyIcon, SeverityIcon } from './icons.js';
5
5
  import { notificationDelta } from '@bloxwap/hig/contracts/announcements';
@@ -24,8 +24,8 @@ catch { /* The visible message and navigable text remain available. */ } }
24
24
  export function Badge({ children }) { const fills = useFills(); return _jsx(Text, { style: { alignSelf: 'flex-start', maxWidth: '100%', backgroundColor: fills.well, overflow: 'hidden', borderRadius: 9999, paddingVertical: 4, paddingHorizontal: 10 }, children: children }); }
25
25
  /** Opaque sRGB blend of `tone` into `base` (both `#rrggbb`): the native counterpart of CSS `color-mix`. */
26
26
  const tint = (tone, base, amount) => '#' + [1, 3, 5].map(i => Math.round(parseInt(base.slice(i, i + 2), 16) * (1 - amount) + parseInt(tone.slice(i, i + 2), 16) * amount).toString(16).padStart(2, '0')).join('');
27
- /** Severity tints the fill 10% and colours the title from a token role (info/note → info, success/tip → positive, warning, error → negative; default → 6% of `text`), with no stroke or glow; `tone` swaps in another approved token role, never a raw colour. A non-string title renders inside the Heading, so pass strings or inline Text; its visible text is announced. */
28
- export function Alert({ title, children, severity = 'info', tone, action, announce = true }) { const colors = useColors(); const neutral = severity === 'default' && tone === undefined; const accent = neutral ? colors.text : roleColor(tone, severityRole[severity] ?? 'info', colors); const message = [plainText(title), blockText(children)].filter(Boolean).join('. '); const previous = useRef(''); useEffect(() => { const key = severity + message; if (announce && key !== previous.current) {
27
+ /** Severity tints the fill 10% and colours the title from a token role (info/note → info, success/tip → positive, warning, error → negative; default → 6% of `text`), with no stroke or glow; `tone` swaps in another approved token role, never a raw colour. A non-string title renders inside the Heading, so pass strings or inline Text; its visible text is announced. A string or number child is drawn in a HIG `Text`. `announce` (default true) speaks the title and body when they appear or change; pass `false` for guidance that is present from the start. */
28
+ export function Alert({ title, children: body, severity = 'info', tone, action, announce = true }) { const children = React.Children.map(body, child => typeof child === 'string' || typeof child === 'number' ? _jsx(Text, { children: child }) : child); const colors = useColors(); const neutral = severity === 'default' && tone === undefined; const accent = neutral ? colors.text : roleColor(tone, severityRole[severity] ?? 'info', colors); const message = [plainText(title), blockText(children)].filter(Boolean).join('. '); const previous = useRef(''); useEffect(() => { const key = severity + message; if (announce && key !== previous.current) {
29
29
  previous.current = key;
30
30
  if (Platform.OS === 'ios')
31
31
  speak(message, severity);
@@ -81,12 +81,12 @@ export function useTransientNotice(duration = 4000) {
81
81
  return; stop(); setNotice({ id: `notice-${++sequence.current}`, message, severity }); timer.current = setTimeout(() => { timer.current = null; setNotice(null); }, duration); } };
82
82
  }
83
83
  export function Spinner({ label }) { const { messages } = useHIG(); const colors = useColors(); const text = label ?? messages.loading ?? en.loading; return _jsxs(View, { accessible: true, accessibilityLabel: text, children: [_jsx(ActivityIndicator, { color: colors.action }), _jsx(Text, { children: text })] }); }
84
- export function Progress({ label, value, max = 100 }) {
84
+ export function Progress({ label, value, max = 100, hideValue }) {
85
85
  const { locale, messages, direction } = useHIG();
86
86
  const colors = useColors();
87
87
  const fills = useFills();
88
88
  const fill = value === undefined ? 35 : Math.min(100, Math.max(0, Number.isFinite(value) && max > 0 ? value / max * 100 : 0));
89
- return _jsxs(View, { style: { gap: 12, direction }, accessibilityRole: 'progressbar', accessibilityLabel: label, accessibilityValue: { min: 0, max, now: value, text: value === undefined ? messages.inProgress ?? en.inProgress : (messages.progressValue ?? en.progressValue)(formatNumber(value, locale), formatNumber(max, locale)) }, children: [_jsxs(Text, { children: [label, value === undefined ? '…' : ` ${value}/${max}`] }), _jsx(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', style: { height: 6, borderRadius: 9999, overflow: 'hidden', backgroundColor: fills.raised }, children: _jsx(View, { style: { width: `${fill}%`, height: '100%', alignSelf: value === undefined ? 'center' : 'flex-start', borderRadius: 9999, backgroundColor: colors.action } }) })] });
89
+ return _jsxs(View, { style: { gap: 12, direction }, accessibilityRole: 'progressbar', accessibilityLabel: label, accessibilityValue: { min: 0, max, now: value, text: value === undefined ? messages.inProgress ?? en.inProgress : (messages.progressValue ?? en.progressValue)(formatNumber(value, locale), formatNumber(max, locale)) }, children: [_jsxs(Text, { children: [label, hideValue ? null : value === undefined ? '…' : ` ${value}/${max}`] }), _jsx(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', style: { height: 6, borderRadius: 9999, overflow: 'hidden', backgroundColor: fills.raised }, children: _jsx(View, { style: { width: `${fill}%`, height: '100%', alignSelf: value === undefined ? 'center' : 'flex-start', borderRadius: 9999, backgroundColor: colors.action } }) })] });
90
90
  }
91
91
  /** Pulses while content is on its way; still with reduced motion. */
92
92
  export function Skeleton({ label }) { const { messages, reducedMotion } = useHIG(); const fills = useFills(); const pulse = useLoop(!reducedMotion, 1500); return _jsx(Animated.View, { accessible: true, accessibilityLabel: label ?? messages.loadingContent ?? en.loadingContent, style: { minHeight: 48, backgroundColor: fills.raised, borderRadius: 10, opacity: pulse.interpolate({ inputRange: [0, .5, 1], outputRange: [1, .5, 1] }) } }); }
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { type NativeScrollEvent, type NativeSyntheticEvent, type ScrollViewProps, type StyleProp, type ViewStyle } from 'react-native';
3
+ /** What a scroller needs so a pinned header knows when content is under it. Spread `onScroll` and `scrollEventThrottle` on the scroll view and pass `scrolled` to the header. */
4
+ export interface StickyHeaderScroll {
5
+ /** True once the scroll view has moved, so content sits under the pinned header. */
6
+ scrolled: boolean;
7
+ onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
8
+ scrollEventThrottle: number;
9
+ }
10
+ /** Tracks a scroll view's offset for a pinned header: `scrolled` turns true once it has moved and false again at the top. It re-renders only when that changes. */
11
+ export declare function useStickyHeaderScroll(onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void): StickyHeaderScroll;
12
+ /** The fill of a pinned header: transparent at rest so what the host draws behind it shows through, `background` once content has scrolled under it. */
13
+ export declare function stickyHeaderFill(scrolled: boolean, background: string): ViewStyle;
14
+ export interface StickyHeaderLayoutProps {
15
+ /** The header, pinned as the scroll view's first child. */
16
+ header: React.ReactNode;
17
+ children: React.ReactNode;
18
+ /** Fill once content scrolls under the header. Defaults to the background role. */
19
+ background?: string;
20
+ scrollComponent?: React.ComponentType<ScrollViewProps>;
21
+ testID?: string;
22
+ /** Test ID of the header's container. */
23
+ headerTestID?: string;
24
+ /** Layout of the content under the header, such as its gap. Side padding is 16dp. */
25
+ bodyStyle?: StyleProp<ViewStyle>;
26
+ }
27
+ /** A block as its own scroll view with its header pinned: 16dp around the content as the block draws it, the header transparent until content scrolls under it. Place it in a bounded container, such as a sheet body. */
28
+ export declare function StickyHeaderLayout({ header, children, background, scrollComponent: Scroll, testID, headerTestID, bodyStyle }: StickyHeaderLayoutProps): React.JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useState } from 'react';
3
+ import { ScrollView, View } from 'react-native';
4
+ import { useColors } from './provider.js';
5
+ /** Tracks a scroll view's offset for a pinned header: `scrolled` turns true once it has moved and false again at the top. It re-renders only when that changes. */
6
+ export function useStickyHeaderScroll(onScroll) {
7
+ const [scrolled, setScrolled] = useState(false);
8
+ const handle = useCallback((event) => {
9
+ const next = (event.nativeEvent?.contentOffset?.y ?? 0) > 0.5;
10
+ setScrolled(current => current === next ? current : next);
11
+ onScroll?.(event);
12
+ }, [onScroll]);
13
+ return { scrolled, onScroll: handle, scrollEventThrottle: 16 };
14
+ }
15
+ /** The fill of a pinned header: transparent at rest so what the host draws behind it shows through, `background` once content has scrolled under it. */
16
+ export function stickyHeaderFill(scrolled, background) { return { backgroundColor: scrolled ? background : 'transparent' }; }
17
+ /** A block as its own scroll view with its header pinned: 16dp around the content as the block draws it, the header transparent until content scrolls under it. Place it in a bounded container, such as a sheet body. */
18
+ export function StickyHeaderLayout({ header, children, background, scrollComponent: Scroll = ScrollView, testID, headerTestID, bodyStyle }) {
19
+ const colors = useColors(), { scrolled, onScroll, scrollEventThrottle } = useStickyHeaderScroll();
20
+ return _jsxs(Scroll, { testID: testID, stickyHeaderIndices: [0], onScroll: onScroll, scrollEventThrottle: scrollEventThrottle, contentContainerStyle: { paddingBottom: 16 }, children: [_jsx(View, { testID: headerTestID, style: [{ paddingHorizontal: 16, paddingTop: 16 }, stickyHeaderFill(scrolled, background ?? colors.background)], children: header }), _jsx(View, { style: [{ paddingHorizontal: 16 }, bodyStyle], children: children })] });
21
+ }
@@ -7,7 +7,9 @@ export declare const scriptLetterSpacing: Readonly<Record<Exclude<TextScript, 'l
7
7
  export declare function detectScript(text: string, locale: string): TextScript;
8
8
  export interface HIGTextProps extends TextProps {
9
9
  script?: TextScript; /** Caps Dynamic Type / Android font scale for dense numeric readouts (2 = 200%). Defaults to HIGProvider `maxFontSizeMultiplier`; never disable scaling. */
10
- maxFontSizeMultiplier?: number;
10
+ maxFontSizeMultiplier?: number; /** `muted` draws secondary text, such as a note under a group, in the muted role. A `style` colour still wins. */
11
+ tone?: 'muted'; /** `caption` draws the 12/18 caption size instead of the 16/24 body size. A `style` size still wins. */
12
+ size?: 'caption';
11
13
  }
12
14
  export declare const Text: React.ForwardRefExoticComponent<HIGTextProps & React.RefAttributes<React.ComponentRef<typeof RNText>>>;
13
15
  export declare const Heading: React.ForwardRefExoticComponent<HIGTextProps & React.RefAttributes<React.ComponentRef<typeof RNText>>>;
@@ -22,9 +22,10 @@ function scriptFont(families, weight) {
22
22
  weights.sort((a, b) => Math.abs(a - Number(weight)) - Math.abs(b - Number(weight)) || a - b);
23
23
  return weights.length ? families[weights[0]] : undefined;
24
24
  }
25
- export const Text = forwardRef(function Text({ style, script, maxFontSizeMultiplier, ...props }, ref) {
25
+ export const Text = forwardRef(function Text({ style: own, script, maxFontSizeMultiplier, tone, size, ...props }, ref) {
26
26
  const env = useHIG();
27
27
  const colors = useColors();
28
+ const style = tone || size ? [tone === 'muted' ? { color: colors.muted } : null, size === 'caption' ? { fontSize: 12, lineHeight: 18 } : null, own] : own;
28
29
  const resolved = StyleSheet.flatten(style);
29
30
  const requested = resolved?.fontWeight ?? 400;
30
31
  const weight = requested === 'normal' ? 400 : requested === 'bold' ? 700 : requested;
@@ -26,7 +26,8 @@ export interface SwapDetail {
26
26
  value: string | number;
27
27
  options?: Intl.NumberFormatOptions;
28
28
  prefix?: string;
29
- suffix?: string;
29
+ suffix?: string; /** With a number `value`: host-formatted text drawn and read in place of Intl's, still moving place by place. */
30
+ formattedValue?: string;
30
31
  }
31
32
  /** The receive view: the host's address and its rendered QR code. HIG ships no QR encoder. */
32
33
  export interface SwapReceive {