@bloxwap/hig 0.6.0 → 0.8.1

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 (286) hide show
  1. package/README.md +2 -2
  2. package/chart/README.md +13 -2
  3. package/chart/dist/altimeter-burst.d.ts +4 -0
  4. package/chart/dist/altimeter-burst.js +43 -0
  5. package/chart/dist/altimeter-chart.d.ts +52 -0
  6. package/chart/dist/altimeter-chart.js +275 -0
  7. package/chart/dist/altimeter-model.d.ts +43 -0
  8. package/chart/dist/altimeter-model.js +148 -0
  9. package/chart/dist/altimeter-targets.d.ts +33 -0
  10. package/chart/dist/altimeter-targets.js +88 -0
  11. package/chart/dist/bitcoin-price.d.ts +8 -0
  12. package/chart/dist/bitcoin-price.js +41 -0
  13. package/chart/dist/champions-league.d.ts +19 -0
  14. package/chart/dist/champions-league.js +104 -0
  15. package/chart/dist/index.d.ts +6 -0
  16. package/chart/dist/index.js +5 -0
  17. package/chart/dist/outcome-chart.d.ts +37 -0
  18. package/chart/dist/outcome-chart.js +212 -0
  19. package/chart/dist/outcome-model.d.ts +43 -0
  20. package/chart/dist/outcome-model.js +71 -0
  21. package/chart/dist/plus-grid.d.ts +6 -0
  22. package/chart/dist/plus-grid.js +29 -0
  23. package/contracts/README.md +1 -1
  24. package/contracts/dist/avatar.d.ts +68 -0
  25. package/contracts/dist/avatar.js +93 -0
  26. package/contracts/dist/confetti.d.ts +174 -0
  27. package/contracts/dist/confetti.js +138 -0
  28. package/contracts/dist/decimal.d.ts +7 -0
  29. package/contracts/dist/decimal.js +35 -0
  30. package/contracts/dist/index.d.ts +45 -2
  31. package/contracts/dist/index.js +145 -4
  32. package/contracts/dist/invariants.d.ts +17 -0
  33. package/contracts/dist/invariants.js +24 -0
  34. package/contracts/dist/messages.d.ts +62 -2
  35. package/contracts/dist/messages.js +22 -2
  36. package/contracts/dist/number-flow.d.ts +90 -0
  37. package/contracts/dist/number-flow.js +150 -0
  38. package/contracts/dist/qr.d.ts +151 -0
  39. package/contracts/dist/qr.js +581 -0
  40. package/contracts/dist/toast.d.ts +168 -0
  41. package/contracts/dist/toast.js +171 -0
  42. package/feedback/README.md +1 -1
  43. package/feedback/dist/contract.js +1 -1
  44. package/feedback/dist/react.js +2 -4
  45. package/native/README.md +6 -1
  46. package/native/dist/account-block.d.ts +62 -7
  47. package/native/dist/account-block.js +54 -11
  48. package/native/dist/animated-number-model.d.ts +47 -1
  49. package/native/dist/animated-number-model.js +248 -21
  50. package/native/dist/animated-number.d.ts +41 -1
  51. package/native/dist/animated-number.js +165 -17
  52. package/native/dist/announce.d.ts +2 -0
  53. package/native/dist/announce.js +10 -0
  54. package/native/dist/asset-balance-row.d.ts +19 -1
  55. package/native/dist/asset-balance-row.js +24 -8
  56. package/native/dist/assets-block.d.ts +115 -0
  57. package/native/dist/assets-block.js +87 -0
  58. package/native/dist/async-result.d.ts +2 -0
  59. package/native/dist/async-result.js +11 -0
  60. package/native/dist/avatar-frame.d.ts +29 -0
  61. package/native/dist/avatar-frame.js +56 -0
  62. package/native/dist/avatar.d.ts +21 -0
  63. package/native/dist/avatar.js +31 -0
  64. package/native/dist/bar-mark.d.ts +16 -2
  65. package/native/dist/bar-mark.js +23 -7
  66. package/native/dist/bar-pnl.js +7 -5
  67. package/native/dist/blocks.d.ts +13 -14
  68. package/native/dist/blocks.js +10 -6
  69. package/native/dist/brand.js +2 -1
  70. package/native/dist/button.d.ts +7 -2
  71. package/native/dist/button.js +16 -4
  72. package/native/dist/checkbox.js +2 -1
  73. package/native/dist/confetti.d.ts +33 -0
  74. package/native/dist/confetti.js +143 -0
  75. package/native/dist/confirm-block.d.ts +98 -0
  76. package/native/dist/confirm-block.js +48 -0
  77. package/native/dist/data.d.ts +1 -1
  78. package/native/dist/data.js +8 -4
  79. package/native/dist/explainer-block.d.ts +91 -0
  80. package/native/dist/explainer-block.js +34 -0
  81. package/native/dist/field.d.ts +19 -5
  82. package/native/dist/field.js +56 -9
  83. package/native/dist/figure.d.ts +23 -0
  84. package/native/dist/figure.js +10 -0
  85. package/native/dist/gesture-sheet-model.d.ts +50 -0
  86. package/native/dist/gesture-sheet-model.js +105 -0
  87. package/native/dist/gesture-sheet-next.d.ts +82 -0
  88. package/native/dist/gesture-sheet-next.js +315 -0
  89. package/native/dist/gesture-sheet.d.ts +5 -1
  90. package/native/dist/gesture-sheet.js +13 -6
  91. package/native/dist/icons.d.ts +9 -6
  92. package/native/dist/icons.js +25 -24
  93. package/native/dist/language-block.d.ts +14 -1
  94. package/native/dist/language-block.js +11 -4
  95. package/native/dist/list-group.d.ts +44 -8
  96. package/native/dist/list-group.js +84 -13
  97. package/native/dist/manage-position-block.d.ts +35 -2
  98. package/native/dist/manage-position-block.js +41 -11
  99. package/native/dist/market-row.d.ts +46 -0
  100. package/native/dist/market-row.js +41 -0
  101. package/native/dist/navigation.js +5 -3
  102. package/native/dist/notifications-block.d.ts +30 -2
  103. package/native/dist/notifications-block.js +16 -8
  104. package/native/dist/number-format.d.ts +6 -0
  105. package/native/dist/number-format.js +9 -0
  106. package/native/dist/pickers.d.ts +32 -2
  107. package/native/dist/pickers.js +17 -9
  108. package/native/dist/position-block.d.ts +66 -10
  109. package/native/dist/position-block.js +45 -11
  110. package/native/dist/preset-group.d.ts +31 -0
  111. package/native/dist/preset-group.js +39 -0
  112. package/native/dist/preset-picker-block.d.ts +107 -0
  113. package/native/dist/preset-picker-block.js +43 -0
  114. package/native/dist/profile-block.d.ts +38 -5
  115. package/native/dist/profile-block.js +31 -6
  116. package/native/dist/provider.d.ts +14 -5
  117. package/native/dist/provider.js +32 -6
  118. package/native/dist/qr-code.d.ts +33 -0
  119. package/native/dist/qr-code.js +29 -0
  120. package/native/dist/radio-group.d.ts +23 -5
  121. package/native/dist/radio-group.js +40 -12
  122. package/native/dist/recipes.d.ts +6 -0
  123. package/native/dist/recipes.js +6 -0
  124. package/native/dist/reward-block.d.ts +55 -13
  125. package/native/dist/reward-block.js +37 -14
  126. package/native/dist/screen-header.d.ts +59 -0
  127. package/native/dist/screen-header.js +37 -0
  128. package/native/dist/select.js +4 -2
  129. package/native/dist/selection.d.ts +3 -2
  130. package/native/dist/selection.js +1 -0
  131. package/native/dist/setting-header.d.ts +2 -8
  132. package/native/dist/setting-header.js +2 -11
  133. package/native/dist/setting-switch.d.ts +15 -2
  134. package/native/dist/setting-switch.js +11 -4
  135. package/native/dist/signals-block.d.ts +26 -2
  136. package/native/dist/signals-block.js +14 -4
  137. package/native/dist/slider.js +5 -1
  138. package/native/dist/sound-haptics-block.d.ts +29 -2
  139. package/native/dist/sound-haptics-block.js +19 -8
  140. package/native/dist/status.d.ts +47 -14
  141. package/native/dist/status.js +39 -22
  142. package/native/dist/sticky-header.d.ts +28 -0
  143. package/native/dist/sticky-header.js +29 -0
  144. package/native/dist/surface.d.ts +3 -1
  145. package/native/dist/surface.js +2 -1
  146. package/native/dist/swap-amount-card.d.ts +57 -0
  147. package/native/dist/swap-amount-card.js +31 -0
  148. package/native/dist/swap-panel-block.d.ts +11 -4
  149. package/native/dist/swap-panel-block.js +67 -38
  150. package/native/dist/swap-parts.d.ts +5 -10
  151. package/native/dist/swap-parts.js +22 -24
  152. package/native/dist/swap-shared.d.ts +8 -2
  153. package/native/dist/swap-shared.js +10 -6
  154. package/native/dist/swap-views.js +6 -4
  155. package/native/dist/switch-row.d.ts +3 -2
  156. package/native/dist/switch-row.js +5 -3
  157. package/native/dist/switch.d.ts +4 -2
  158. package/native/dist/switch.js +3 -3
  159. package/native/dist/target-block.d.ts +40 -7
  160. package/native/dist/target-block.js +31 -11
  161. package/native/dist/toast.d.ts +47 -0
  162. package/native/dist/toast.js +386 -0
  163. package/native/dist/token-action-block.d.ts +26 -9
  164. package/native/dist/token-action-block.js +21 -8
  165. package/native/dist/trade-history-detail-block.d.ts +26 -1
  166. package/native/dist/trade-history-detail-block.js +17 -9
  167. package/native/dist/trade-history-list-block.d.ts +71 -5
  168. package/native/dist/trade-history-list-block.js +55 -17
  169. package/native/dist/wallet-address-core.d.ts +25 -0
  170. package/native/dist/wallet-address-core.js +34 -0
  171. package/native/dist/wallet-address.d.ts +6 -10
  172. package/native/dist/wallet-address.js +16 -20
  173. package/native-fonts/README.md +1 -1
  174. package/og-fonts/README.md +1 -1
  175. package/package.json +131 -2
  176. package/react/README.md +3 -1
  177. package/react/dist/animated-number-flow.d.ts +72 -0
  178. package/react/dist/animated-number-flow.js +316 -0
  179. package/react/dist/animated-number-model.d.ts +24 -0
  180. package/react/dist/animated-number-model.js +106 -3
  181. package/react/dist/animated-number.d.ts +49 -1
  182. package/react/dist/animated-number.js +146 -11
  183. package/react/dist/asset-balance-row.d.ts +19 -1
  184. package/react/dist/asset-balance-row.js +17 -3
  185. package/react/dist/async-result.d.ts +2 -0
  186. package/react/dist/async-result.js +11 -0
  187. package/react/dist/avatar.d.ts +25 -0
  188. package/react/dist/avatar.js +50 -0
  189. package/react/dist/bar-mark.d.ts +5 -2
  190. package/react/dist/bar-mark.js +5 -3
  191. package/react/dist/blocks/account-block.d.ts +57 -7
  192. package/react/dist/blocks/account-block.js +51 -11
  193. package/react/dist/blocks/assets-block.d.ts +106 -0
  194. package/react/dist/blocks/assets-block.js +135 -0
  195. package/react/dist/blocks/confirm-block.d.ts +91 -0
  196. package/react/dist/blocks/confirm-block.js +31 -0
  197. package/react/dist/blocks/explainer-block.d.ts +80 -0
  198. package/react/dist/blocks/explainer-block.js +20 -0
  199. package/react/dist/blocks/install-command.js +3 -1
  200. package/react/dist/blocks/language-block.d.ts +9 -1
  201. package/react/dist/blocks/language-block.js +8 -6
  202. package/react/dist/blocks/manage-position-block.d.ts +30 -2
  203. package/react/dist/blocks/manage-position-block.js +23 -4
  204. package/react/dist/blocks/market-row.d.ts +20 -9
  205. package/react/dist/blocks/market-row.js +17 -4
  206. package/react/dist/blocks/notifications-block.d.ts +27 -2
  207. package/react/dist/blocks/notifications-block.js +11 -2
  208. package/react/dist/blocks/pickers.d.ts +30 -1
  209. package/react/dist/blocks/pickers.js +32 -10
  210. package/react/dist/blocks/position-block.d.ts +34 -11
  211. package/react/dist/blocks/position-block.js +16 -5
  212. package/react/dist/blocks/preset-picker-block.d.ts +85 -0
  213. package/react/dist/blocks/preset-picker-block.js +19 -0
  214. package/react/dist/blocks/profile-block.d.ts +33 -6
  215. package/react/dist/blocks/profile-block.js +31 -6
  216. package/react/dist/blocks/reward-block.d.ts +65 -21
  217. package/react/dist/blocks/reward-block.js +24 -11
  218. package/react/dist/blocks/screen-header.d.ts +34 -2
  219. package/react/dist/blocks/screen-header.js +17 -6
  220. package/react/dist/blocks/setting-switch.d.ts +14 -1
  221. package/react/dist/blocks/setting-switch.js +11 -4
  222. package/react/dist/blocks/signals-block.d.ts +23 -2
  223. package/react/dist/blocks/signals-block.js +6 -5
  224. package/react/dist/blocks/sound-haptics-block.d.ts +27 -3
  225. package/react/dist/blocks/sound-haptics-block.js +11 -7
  226. package/react/dist/blocks/sticky-header.d.ts +19 -0
  227. package/react/dist/blocks/sticky-header.js +103 -0
  228. package/react/dist/blocks/swap/amount-card.js +2 -1
  229. package/react/dist/blocks/swap/settings.js +4 -3
  230. package/react/dist/blocks/swap/shared.d.ts +29 -23
  231. package/react/dist/blocks/swap/shared.js +36 -32
  232. package/react/dist/blocks/swap-panel-block.d.ts +12 -3
  233. package/react/dist/blocks/swap-panel-block.js +72 -37
  234. package/react/dist/blocks/target-block.d.ts +35 -7
  235. package/react/dist/blocks/target-block.js +26 -12
  236. package/react/dist/blocks/token-action-block.d.ts +21 -8
  237. package/react/dist/blocks/token-action-block.js +9 -6
  238. package/react/dist/blocks/trade-history-detail-block.d.ts +23 -1
  239. package/react/dist/blocks/trade-history-detail-block.js +5 -4
  240. package/react/dist/blocks/trade-history-list-block.d.ts +31 -5
  241. package/react/dist/blocks/trade-history-list-block.js +20 -10
  242. package/react/dist/blocks.d.ts +12 -8
  243. package/react/dist/blocks.js +6 -2
  244. package/react/dist/brand.js +2 -1
  245. package/react/dist/button.d.ts +9 -3
  246. package/react/dist/button.js +12 -5
  247. package/react/dist/confetti.d.ts +27 -0
  248. package/react/dist/confetti.js +240 -0
  249. package/react/dist/data.js +11 -4
  250. package/react/dist/field.d.ts +20 -5
  251. package/react/dist/field.js +30 -8
  252. package/react/dist/figure.d.ts +23 -0
  253. package/react/dist/figure.js +12 -0
  254. package/react/dist/gesture-sheet.d.ts +15 -1
  255. package/react/dist/gesture-sheet.js +53 -8
  256. package/react/dist/list-group.d.ts +41 -8
  257. package/react/dist/list-group.js +49 -13
  258. package/react/dist/navigation.js +11 -3
  259. package/react/dist/overlay.d.ts +28 -3
  260. package/react/dist/overlay.js +29 -3
  261. package/react/dist/preset-group.d.ts +30 -0
  262. package/react/dist/preset-group.js +13 -0
  263. package/react/dist/provider.d.ts +42 -5
  264. package/react/dist/provider.js +84 -10
  265. package/react/dist/qr-code.d.ts +32 -0
  266. package/react/dist/qr-code.js +28 -0
  267. package/react/dist/select.js +10 -3
  268. package/react/dist/selection.d.ts +18 -4
  269. package/react/dist/selection.js +20 -10
  270. package/react/dist/slider.js +5 -1
  271. package/react/dist/status.d.ts +14 -10
  272. package/react/dist/status.js +17 -9
  273. package/react/dist/styles.css +380 -150
  274. package/react/dist/surface.d.ts +5 -1
  275. package/react/dist/surface.js +1 -1
  276. package/react/dist/toast.d.ts +19 -12
  277. package/react/dist/toast.js +29 -7
  278. package/react/dist/wallet-address-core.d.ts +27 -0
  279. package/react/dist/wallet-address-core.js +29 -0
  280. package/react/dist/wallet-address.d.ts +6 -12
  281. package/react/dist/wallet-address.js +5 -16
  282. package/tokens/README.md +2 -2
  283. package/tokens/dist/index.d.ts +16 -0
  284. package/tokens/dist/index.js +16 -0
  285. package/tokens/dist/manifest.json +8 -0
  286. package/tokens/dist/tokens.css +6 -0
@@ -1,10 +1,14 @@
1
1
  "use client";
2
2
  import { createElement as _createElement } from "react";
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
- import { formatNumber } from '@bloxwap/hig/contracts';
4
+ import { ChevronUp } from '@bloxwap/icons/react/chevron-up';
5
+ import { ChevronDown } from '@bloxwap/icons/react/chevron-down';
6
+ import { ChevronsUpDown } from '@bloxwap/icons/react/chevrons-up-down';
7
+ import { assertUniqueKeys } from '@bloxwap/hig/contracts';
8
+ import { formatNumber, presentNumberFormat } from '@bloxwap/hig/contracts';
5
9
  import * as en from '@bloxwap/hig/contracts/messages';
6
- import { useHIG } from './provider.js';
7
- export function NumberReadout({ value, options, stale, label, prefix = '', suffix = '' }) { const { locale, messages } = useHIG(); const known = value != null && Number.isFinite(value), formatted = formatNumber(value, locale, options), reading = known ? `${prefix}${formatted}${suffix}` : formatted; return _jsxs("span", { className: 'hig-number', "aria-label": label ? `${label}: ${reading}${stale ? ` ${messages.stale ?? en.stale}` : ''}` : undefined, children: [reading, stale && _jsxs("span", { children: [" ", messages.stale ?? en.stale] })] }); }
10
+ import { useHIG, useNumberLocale } from './provider.js';
11
+ export function NumberReadout({ value, options, stale, label, prefix = '', suffix = '' }) { const { messages, numberFormat } = useHIG(); const locale = useNumberLocale(); const known = value != null && Number.isFinite(value), formatted = formatNumber(value, locale, presentNumberFormat(options, numberFormat)), reading = known ? `${prefix}${formatted}${suffix}` : formatted; return _jsxs("span", { className: 'hig-number', "aria-label": label ? `${label}: ${reading}${stale ? ` ${messages.stale ?? en.stale}` : ''}` : undefined, children: [reading, stale && _jsxs("span", { children: [" ", messages.stale ?? en.stale] })] }); }
8
12
  export function Usd(props) { return _jsx(NumberReadout, { ...props, options: { style: 'currency', currency: 'USD', ...props.options } }); }
9
13
  /** Input is percent points: 5 means 5%, not 500%. */
10
14
  export function Percent(props) { return _jsx(NumberReadout, { ...props, value: props.value == null ? props.value : props.value / 100, options: { maximumFractionDigits: Math.max(3, props.options?.minimumFractionDigits ?? 0), ...props.options, style: 'percent' } }); }
@@ -24,13 +28,16 @@ export function VerticalAddress({ address, kind, rowHeight, className }) {
24
28
  export function Metric({ label, value }) { return _jsxs("dl", { className: 'hig-surface', children: [_jsx("dt", { children: label }), _jsx("dd", { children: value })] }); }
25
29
  export const Stat = Metric;
26
30
  export function List({ items, keyFor, render, empty, label, loading = false, error, onRetry, onLoadMore }) {
31
+ assertUniqueKeys(items, keyFor, 'List');
27
32
  const { messages } = useHIG();
28
33
  return _jsxs("div", { className: 'hig-data-list', "aria-busy": loading, children: [items.length ? _jsx("ul", { className: 'hig-list', "aria-label": label, children: items.map(item => _jsx("li", { children: render(item) }, keyFor(item))) }) : !loading && !error ? _jsx("p", { className: 'hig-list-message', children: empty ?? messages.noItems ?? en.noItems }) : null, loading && _jsx("p", { className: 'hig-list-message', role: 'status', children: messages.loadingItems ?? en.loadingItems }), error && _jsxs("div", { className: 'hig-list-error', role: 'alert', children: [_jsx("p", { className: 'hig-list-message', children: error }), onRetry && _jsx("button", { className: 'hig-button', "data-intent": 'secondary', type: 'button', disabled: loading, onClick: onRetry, children: messages.retry ?? en.retry })] }), onLoadMore && _jsx("button", { className: 'hig-button', "data-intent": 'secondary', type: 'button', disabled: loading, onClick: onLoadMore, children: messages.loadMore ?? en.loadMore })] });
29
34
  }
30
35
  export function Row({ className, ...props }) { return _jsx("div", { ...props, className: `hig-row${className ? ` ${className}` : ''}` }); }
31
36
  function tableRowAttributes(props) { const attributes = { ...props }; delete attributes.children; delete attributes.dangerouslySetInnerHTML; delete attributes.role; return attributes; }
32
37
  export function Table({ caption, rows, columns, keyFor, rowProps, className, style, tableClassName, captionHidden = false, stickyHeader = false, loading = false, state }) {
38
+ assertUniqueKeys(rows, keyFor, 'Table');
39
+ assertUniqueKeys(columns, column => column.key, 'Table columns');
33
40
  const { messages } = useHIG();
34
41
  const status = state !== undefined ? state : loading ? _jsx("span", { role: 'status', children: messages.loading ?? en.loading }) : !rows.length ? messages.noRows ?? en.noRows : null;
35
- return _jsx("div", { className: `hig-table-scroll${className ? ` ${className}` : ''}`, style: style, tabIndex: 0, role: 'region', "aria-label": caption, "aria-busy": loading || undefined, children: _jsxs("table", { className: `hig-table${tableClassName ? ` ${tableClassName}` : ''}`, "data-sticky-header": stickyHeader || undefined, children: [_jsx("caption", { className: captionHidden ? 'hig-sr-only' : undefined, children: caption }), _jsx("thead", { children: _jsx("tr", { children: columns.map(c => _jsx("th", { scope: 'col', "aria-sort": c.sort, style: c.align ? { textAlign: c.align } : undefined, children: c.onSort ? _jsxs("button", { type: 'button', className: 'hig-table-sort', onClick: c.onSort, children: [c.label, _jsxs("svg", { className: 'hig-table-sort-icon', "aria-hidden": 'true', focusable: 'false', width: '14', height: '14', viewBox: '0 0 16 16', fill: 'none', stroke: 'currentColor', strokeWidth: '1.5', strokeLinecap: 'round', strokeLinejoin: 'round', children: [_jsx("path", { className: 'hig-table-sort-up', d: 'm4.5 6 3.5-3.5L11.5 6' }), _jsx("path", { className: 'hig-table-sort-down', d: 'm4.5 10 3.5 3.5 3.5-3.5' })] })] }) : c.label }, c.key)) }) }), _jsxs("tbody", { children: [rows.map((row, index) => _createElement("tr", { ...tableRowAttributes(rowProps?.(row, index)), key: keyFor(row) }, columns.map(c => _jsx("td", { style: c.align ? { textAlign: c.align } : undefined, children: c.render(row) }, c.key)))), status !== null && status !== false && _jsx("tr", { className: 'hig-table-state', children: _jsx("td", { colSpan: Math.max(1, columns.length), children: status }) })] })] }) });
42
+ return _jsx("div", { className: `hig-table-scroll${className ? ` ${className}` : ''}`, style: style, tabIndex: 0, role: 'region', "aria-label": caption, "aria-busy": loading || undefined, children: _jsxs("table", { className: `hig-table${tableClassName ? ` ${tableClassName}` : ''}`, "data-sticky-header": stickyHeader || undefined, children: [_jsx("caption", { className: captionHidden ? 'hig-sr-only' : undefined, children: caption }), _jsx("thead", { children: _jsx("tr", { children: columns.map(c => _jsx("th", { scope: 'col', "aria-sort": c.sort, style: c.align ? { textAlign: c.align } : undefined, children: c.onSort ? _jsxs("button", { type: 'button', className: 'hig-table-sort', onClick: c.onSort, children: [c.label, (c.sort === 'ascending' ? _jsx(ChevronUp, { size: 14, className: 'hig-table-sort-icon' }) : c.sort === 'descending' ? _jsx(ChevronDown, { size: 14, className: 'hig-table-sort-icon' }) : _jsx(ChevronsUpDown, { size: 14, className: 'hig-table-sort-icon' }))] }) : c.label }, c.key)) }) }), _jsxs("tbody", { children: [rows.map((row, index) => _createElement("tr", { ...tableRowAttributes(rowProps?.(row, index)), key: keyFor(row) }, columns.map(c => _jsx("td", { style: c.align ? { textAlign: c.align } : undefined, children: c.render(row) }, c.key)))), status !== null && status !== false && _jsx("tr", { className: 'hig-table-state', children: _jsx("td", { colSpan: Math.max(1, columns.length), children: status }) })] })] }) });
36
43
  }
@@ -1,14 +1,29 @@
1
1
  import React from 'react';
2
- export declare function Field({ id: provided, label, description, error, required, disabled, children }: React.PropsWithChildren<{
2
+ export interface FieldProps {
3
3
  id?: string;
4
4
  label: string;
5
- description?: string;
5
+ 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. */
6
+ descriptionTone?: 'muted' | 'positive';
6
7
  error?: string;
7
8
  required?: boolean;
8
9
  disabled?: boolean;
9
- }>): React.JSX.Element;
10
+ }
11
+ export declare function Field({ id: provided, label, description, descriptionTone, error, required, disabled, children }: React.PropsWithChildren<FieldProps>): React.JSX.Element;
10
12
  export declare const Label: (props: React.LabelHTMLAttributes<HTMLLabelElement>) => React.JSX.Element;
11
- export declare const Input: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
13
+ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'prefix'> {
14
+ /** Host text on the leading edge inside the field, before what is typed, such as `@` for a handle or `$` for an amount. Drawn muted and not part of the value; the input names it in its description (`aria-describedby`, before the field's help and error), so it is read after the label. The text starts after it. */
15
+ prefix?: string;
16
+ }
17
+ export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
18
+ /** Marked pure, as `SearchInput` is, so a bundle that imports only `Input` drops it. */
12
19
  export declare const TextArea: React.ForwardRefExoticComponent<React.TextareaHTMLAttributes<HTMLTextAreaElement> & React.RefAttributes<HTMLTextAreaElement>>;
13
20
  /** The magnifying glass sits inset on the leading edge; the input keeps the ref, class and every prop. Marked pure so a bundle that imports another field drops the icon. */
14
- export declare const SearchInput: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
21
+ export interface SearchInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
22
+ /** Host content on the trailing edge inside the field, such as a filter button. The text stops 48 units short of the edge; wider content sets the input's `padding-inline-end`. */
23
+ trailing?: React.ReactNode;
24
+ /** Shows a clear button on the trailing edge while the controlled `value` is not empty. It calls this and returns focus to the field. */
25
+ onClear?: () => void;
26
+ /** Accessible name of the clear button; defaults to HIGProvider `messages.clearSearch`. */
27
+ clearLabel?: string;
28
+ }
29
+ export declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLInputElement>>;
@@ -1,18 +1,40 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { createContext, useContext, useId, forwardRef } from 'react';
3
+ import { Search } from '@bloxwap/icons/react/search';
4
+ import { X } from '@bloxwap/icons/react/x';
5
+ import { createContext, useContext, useId, useRef, useCallback, useEffect, forwardRef } from 'react';
4
6
  import * as en from '@bloxwap/hig/contracts/messages';
5
- import { useHIG } from './provider.js';
7
+ import { PressDecoration, useHIG } from './provider.js';
6
8
  const Context = createContext({ id: '' });
7
- export function Field({ id: provided, label, description, error, required, disabled, children }) {
9
+ export function Field({ id: provided, label, description, descriptionTone, error, required, disabled, children }) {
8
10
  const { messages } = useHIG();
9
11
  const generated = useId();
10
12
  const id = provided ?? generated;
11
13
  const ids = [description && `${id}-help`, error && `${id}-error`].filter(Boolean).join(' ') || undefined;
12
- return _jsx(Context.Provider, { value: { id, description: ids, invalid: !!error, disabled, required }, children: _jsxs("div", { className: 'hig-field', children: [_jsxs("label", { htmlFor: id, children: [label, required ? ` ${messages.required ?? en.required}` : ''] }), children, description && _jsx("p", { id: `${id}-help`, children: description }), error && _jsx("p", { id: `${id}-error`, role: 'alert', children: error })] }) });
14
+ const controls = useRef(0);
15
+ const register = useCallback(() => { if (++controls.current > 1)
16
+ throw new Error('Field requires exactly one control.'); return () => { controls.current--; }; }, []);
17
+ const positive = descriptionTone === 'positive';
18
+ return _jsx(Context.Provider, { value: { id, description: ids, invalid: !!error, disabled, required, register }, children: _jsxs("div", { className: 'hig-field', children: [_jsxs("label", { htmlFor: id, children: [label, required ? ` ${messages.required ?? en.required}` : ''] }), children, description && _jsx("p", { id: `${id}-help`, "data-tone": positive ? 'positive' : undefined, "aria-live": positive ? 'polite' : undefined, children: description }), error && _jsx("p", { id: `${id}-error`, role: 'alert', children: error })] }) });
13
19
  }
14
20
  export const Label = (props) => _jsx("label", { ...props });
15
- export const Input = forwardRef(function Input(props, ref) { const field = useContext(Context); return _jsx("input", { id: field.id || undefined, "aria-describedby": field.description, "aria-invalid": field.invalid || undefined, required: field.required, ...props, disabled: !!field.disabled || props.disabled, ref: ref, className: `hig-input ${props.className ?? ''}` }); });
16
- export const TextArea = forwardRef(function TextArea(props, ref) { const field = useContext(Context); return _jsx("textarea", { id: field.id || undefined, "aria-describedby": field.description, "aria-invalid": field.invalid || undefined, required: field.required, ...props, disabled: !!field.disabled || props.disabled, ref: ref, className: `hig-input ${props.className ?? ''}` }); });
17
- /** The magnifying glass sits inset on the leading edge; the input keeps the ref, class and every prop. Marked pure so a bundle that imports another field drops the icon. */
18
- export const SearchInput = /* @__PURE__ */ forwardRef(function SearchInput(props, ref) { return _jsxs("span", { className: 'hig-search-input', children: [_jsxs("svg", { className: 'hig-search-icon', "aria-hidden": 'true', focusable: 'false', viewBox: '0 0 20 20', children: [_jsx("circle", { cx: '9', cy: '9', r: '5.25' }), _jsx("path", { d: 'm13 13 3.5 3.5' })] }), _jsx(Input, { type: 'search', ...props, ref: ref })] }); });
21
+ export const Input = forwardRef(function Input({ prefix, ...props }, ref) { const field = useContext(Context); useEffect(() => field.register?.(), [field.register]); const own = useId(); const input = _jsx("input", { ...props, id: field.id || props.id, "aria-describedby": [prefix && own, field.description, props['aria-describedby']].filter(Boolean).join(' ') || undefined, "aria-invalid": field.invalid || props['aria-invalid'], required: field.required || props.required, disabled: !!field.disabled || props.disabled, ref: ref, className: `hig-input ${props.className ?? ''}` }); return prefix ? _jsxs("span", { className: 'hig-input-affix', children: [_jsx("span", { id: own, className: 'hig-input-prefix', children: prefix }), input] }) : input; });
22
+ /** Marked pure, as `SearchInput` is, so a bundle that imports only `Input` drops it. */
23
+ export const TextArea = /* @__PURE__ */ forwardRef(function TextArea(props, ref) { const field = useContext(Context); useEffect(() => field.register?.(), [field.register]); return _jsx("textarea", { ...props, id: field.id || props.id, "aria-describedby": [field.description, props['aria-describedby']].filter(Boolean).join(' ') || undefined, "aria-invalid": field.invalid || props['aria-invalid'], required: field.required || props.required, disabled: !!field.disabled || props.disabled, ref: ref, className: `hig-input ${props.className ?? ''}` }); });
24
+ export const SearchInput = /* @__PURE__ */ forwardRef(function SearchInput({ trailing, onClear, clearLabel, ...props }, ref) {
25
+ const { messages } = useHIG();
26
+ const inner = useRef(null);
27
+ const off = !!useContext(Context).disabled || !!props.disabled;
28
+ const attach = useCallback((node) => { inner.current = node; const cleanup = typeof ref === 'function' ? ref(node) : undefined; if (ref && typeof ref !== 'function')
29
+ ref.current = node; return () => { inner.current = null; if (typeof cleanup === 'function')
30
+ cleanup();
31
+ else if (typeof ref === 'function')
32
+ ref(null);
33
+ else if (ref)
34
+ ref.current = null; }; }, [ref]);
35
+ const clear = onClear && props.value != null && String(props.value) !== '' ? _jsxs("button", { type: 'button', className: 'hig-search-clear', "aria-label": clearLabel ?? messages.clearSearch ?? en.clearSearch, disabled: off, onClick: () => { onClear(); inner.current?.focus(); }, children: [_jsx(X, { size: 16 }), _jsx(PressDecoration, { kind: 'icon-button', disabled: off })] }) : null;
36
+ const extra = trailing != null && trailing !== false;
37
+ const end = extra || clear ? _jsxs("span", { className: 'hig-search-trailing', children: [trailing, clear] }) : null;
38
+ // The end padding stays while the clear button comes and goes, so typed text never reflows.
39
+ return _jsxs("span", { className: 'hig-search-input', "data-trailing": extra || onClear ? '' : undefined, children: [_jsx(Search, { size: 20, className: 'hig-search-icon' }), _jsx(Input, { type: 'search', ...props, ref: onClear ? attach : ref }), end] });
40
+ });
@@ -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 the browser'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. Unknown values read as the dash, without affixes. */
23
+ export declare function figureReading(figure: Figure, locale: string, options?: Intl.NumberFormatOptions): string;
@@ -0,0 +1,12 @@
1
+ import { formatNumber } from '@bloxwap/hig/contracts';
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. Unknown values read as the dash, without affixes. */
8
+ export function figureReading(figure, locale, options) {
9
+ if (figure.value == null || !Number.isFinite(figure.value))
10
+ return '—';
11
+ return `${figure.prefix ?? ''}${figure.formattedValue || formatNumber(figure.value, locale, options)}${figure.suffix ?? ''}`;
12
+ }
@@ -22,6 +22,8 @@ interface GestureSheetCommonProps extends Omit<DialogProps, 'contentProps'> {
22
22
  handleProps?: GestureSheetHandleProps;
23
23
  handleRef?: React.Ref<HTMLDivElement>;
24
24
  overlayProps?: GestureSheetOverlayProps;
25
+ /** `id` of a heading inside the sheet that names it, such as a block's `headingId`: the sheet is then named by that heading (`aria-labelledby`) and its own `title` is kept for the backend but hidden from assistive technology, so the name is read once. */
26
+ labelledBy?: string;
25
27
  }
26
28
  export type GestureSheetProps = GestureSheetCommonProps & (
27
29
  /** Backend defaults are retained, including autoFocus=false and repositionInputs=true. */
@@ -37,5 +39,17 @@ export type GestureSheetProps = GestureSheetCommonProps & (
37
39
  maxDynamicContentSize?: number;
38
40
  });
39
41
  /** Optional web gesture backend. Install vaul separately; the core overlay entry never imports it. */
40
- export declare function GestureSheet({ open, onOpenChange, title, description, trigger, children, titleHidden, descriptionHidden, contentProps, contentRef, closeButton, closeLabel, backendProps, contentMode, handle, handleProps, handleRef, overlayProps, enableDynamicSizing, maxDynamicContentSize }: GestureSheetProps): React.JSX.Element;
42
+ export declare function GestureSheet({ open, onOpenChange, title, description, trigger, children, titleHidden, descriptionHidden, contentProps, contentRef, closeButton, closeLabel, backendProps, contentMode, handle, handleProps, handleRef, overlayProps, enableDynamicSizing, maxDynamicContentSize, labelledBy }: GestureSheetProps): React.JSX.Element;
43
+ export interface GestureSheetViewProps extends React.HTMLAttributes<HTMLDivElement> {
44
+ /** Names the view. A change swaps the content with the transition. */
45
+ viewKey: string | number;
46
+ }
47
+ /**
48
+ * One view of a sheet that shows several, such as the steps of a flow or the levels of a menu. When `viewKey` changes, the
49
+ * old view fades and shrinks out of the way without holding its space, the new one fades in at its own size, and a
50
+ * content-sized sheet (`enableDynamicSizing`) moves to the new height at the same time. Going deeper and going back look
51
+ * the same, as in Vaul. The first view appears with the sheet, and nothing moves under reduced motion. The outgoing view is
52
+ * inert and hidden from assistive technology while it leaves.
53
+ */
54
+ export declare function GestureSheetView({ viewKey, children, className, ...rest }: GestureSheetViewProps): React.JSX.Element;
41
55
  export {};
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useCallback, useEffect, useRef, useState } from 'react';
3
+ import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
4
4
  import { Drawer } from 'vaul';
5
5
  import * as en from '@bloxwap/hig/contracts/messages';
6
6
  import { useHIG, useThemeStyle } from './provider.js';
@@ -22,8 +22,11 @@ function useDynamicHeight(open, enabled, reducedMotion, panel, content) {
22
22
  return;
23
23
  let previous = null;
24
24
  const cancel = () => { const current = animation.current; animation.current = null; current?.cancel(); };
25
- const measure = () => {
26
- const next = content.getBoundingClientRect().height, from = animation.current ? card.getBoundingClientRect().height : previous;
25
+ const measure = (entries) => {
26
+ const next = entries?.[0]?.borderBoxSize?.[0]?.blockSize ?? content.getBoundingClientRect().height;
27
+ if (previous !== null && Math.abs(previous - next) < .5)
28
+ return;
29
+ const from = animation.current ? card.getBoundingClientRect().height : previous;
27
30
  previous = next;
28
31
  if (from === null || Math.abs(from - next) < .5)
29
32
  return;
@@ -32,13 +35,13 @@ function useDynamicHeight(open, enabled, reducedMotion, panel, content) {
32
35
  return;
33
36
  }
34
37
  cancel();
35
- const current = card.animate([{ height: `${from}px` }, { height: `${next}px` }], { duration: 200, easing: 'cubic-bezier(.32,.72,0,1)' });
38
+ const current = card.animate([{ height: `${from}px` }, { height: `${next}px` }], { duration: 270, easing: 'cubic-bezier(.26,.08,.25,1)' });
36
39
  animation.current = current;
37
40
  current.onfinish = current.oncancel = () => { if (animation.current === current)
38
41
  animation.current = null; };
39
42
  };
40
43
  const resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);
41
- resize?.observe(content);
44
+ resize?.observe(content, { box: 'border-box' });
42
45
  measure();
43
46
  const inline = typeof MutationObserver === 'undefined' ? null : new MutationObserver(() => { if (card.style.height)
44
47
  cancel(); });
@@ -62,7 +65,7 @@ const MOTION_PROPERTIES = ['transform', 'transition', 'transition-property', 'tr
62
65
  const BACKGROUND_PROPERTIES = [...MOTION_PROPERTIES, 'border-radius', 'overflow', 'transform-origin'];
63
66
  const BODY_POSITION = ['position', 'top', 'left', 'right', 'height'];
64
67
  /** Optional web gesture backend. Install vaul separately; the core overlay entry never imports it. */
65
- export function GestureSheet({ open, onOpenChange, title, description, trigger, children, titleHidden, descriptionHidden, contentProps, contentRef, closeButton, closeLabel, backendProps, contentMode = 'default', handle = true, handleProps, handleRef, overlayProps, enableDynamicSizing = false, maxDynamicContentSize }) {
68
+ export function GestureSheet({ open, onOpenChange, title, description, trigger, children, titleHidden, descriptionHidden, contentProps, contentRef, closeButton, closeLabel, backendProps, contentMode = 'default', handle = true, handleProps, handleRef, overlayProps, enableDynamicSizing = false, maxDynamicContentSize, labelledBy }) {
66
69
  if (enableDynamicSizing && Object.entries(backendProps ?? {}).some(([key, value]) => value !== undefined && DYNAMIC_BACKEND.has(key)))
67
70
  throw new Error('Dynamic GestureSheet does not accept Vaul snap-point props.');
68
71
  if (maxDynamicContentSize !== undefined && (!Number.isFinite(maxDynamicContentSize) || maxDynamicContentSize <= 0))
@@ -121,8 +124,50 @@ export function GestureSheet({ open, onOpenChange, title, description, trigger,
121
124
  }
122
125
  onOpenChange(next);
123
126
  };
124
- const body = _jsxs(_Fragment, { children: [handle && _jsx(Drawer.Handle, { ...grip, ref: handleRef, className: ['hig-gesture-handle', handleClass].filter(Boolean).join(' ') }), _jsx(Drawer.Title, { className: titleHidden ? 'hig-sr-only' : undefined, children: title }), description && _jsx(Drawer.Description, { className: descriptionHidden ? 'hig-sr-only' : undefined, children: description }), children, closeButton !== null && _jsx(Drawer.Close, { asChild: true, children: closeButton ?? _jsx(Button, { intent: 'secondary', suppressFeedback: true, children: closeLabel ?? messages.close ?? en.close }) })] });
127
+ const body = _jsxs(_Fragment, { children: [handle && _jsx(Drawer.Handle, { ...grip, ref: handleRef, className: ['hig-gesture-handle', handleClass].filter(Boolean).join(' ') }), _jsx(Drawer.Title, { className: titleHidden || labelledBy ? 'hig-sr-only' : undefined, "aria-hidden": labelledBy ? true : undefined, children: title }), description && _jsx(Drawer.Description, { className: descriptionHidden ? 'hig-sr-only' : undefined, children: description }), children, closeButton !== null && _jsx(Drawer.Close, { asChild: true, children: closeButton ?? _jsx(Button, { intent: 'secondary', suppressFeedback: true, children: closeLabel ?? messages.close ?? en.close }) })] });
125
128
  return _jsxs(Drawer.Root, { ...backend, open: open, onOpenChange: requestOpen, modal: true, onAnimationEnd: next => { if (next === currentOpen.current)
126
- onAnimationEnd?.(next); }, children: [trigger && _jsx(Drawer.Trigger, { asChild: true, children: trigger }), _jsxs(Drawer.Portal, { children: [_jsx(Drawer.Overlay, { ...overlay, ref: backdrop, className: ['hig-backdrop', 'hig-gesture-backdrop', overlayClass].filter(Boolean).join(' '), "data-hig-motion": reducedMotion ? 'reduced' : 'full' }), _jsx(Drawer.Content, { ...content, ...(!description ? { 'aria-describedby': undefined } : {}), ref: setPanel, className: ['hig-gesture-sheet', className].filter(Boolean).join(' '), role: 'dialog', dir: direction, lang: locale, style: { ...themeStyle, ...style, ...(dynamic && maxDynamicContentSize !== undefined && { maxHeight: maxDynamicContentSize }) }, onPointerDownCapture: event => { const restorePanel = snapshotStyles(panel.current, MOTION_PROPERTIES), restoreOverlay = snapshotStyles(backdrop.current, ['opacity', 'transition']), restoreBackground = backend.shouldScaleBackground ? snapshotStyles(document.querySelector('[data-vaul-drawer-wrapper]'), BACKGROUND_PROPERTIES) : () => { }; motion.current = () => { restorePanel(); restoreOverlay(); restoreBackground(); }; onPointerDownCapture?.(event); }, onInteractOutside: event => { if (event.detail.originalEvent.type === 'focusin')
129
+ onAnimationEnd?.(next); }, children: [trigger && _jsx(Drawer.Trigger, { asChild: true, children: trigger }), _jsxs(Drawer.Portal, { children: [_jsx(Drawer.Overlay, { ...overlay, ref: backdrop, className: ['hig-backdrop', 'hig-gesture-backdrop', overlayClass].filter(Boolean).join(' '), "data-hig-motion": reducedMotion ? 'reduced' : 'full' }), _jsx(Drawer.Content, { ...content, ...(!description ? { 'aria-describedby': undefined } : {}), ...(labelledBy ? { 'aria-labelledby': labelledBy } : {}), ref: setPanel, className: ['hig-gesture-sheet', className].filter(Boolean).join(' '), role: 'dialog', dir: direction, lang: locale, style: { ...themeStyle, ...style, ...(dynamic && maxDynamicContentSize !== undefined && { maxHeight: maxDynamicContentSize }) }, onPointerDownCapture: event => { const restorePanel = snapshotStyles(panel.current, MOTION_PROPERTIES), restoreOverlay = snapshotStyles(backdrop.current, ['opacity', 'transition']), restoreBackground = backend.shouldScaleBackground ? snapshotStyles(document.querySelector('[data-vaul-drawer-wrapper]'), BACKGROUND_PROPERTIES) : () => { }; motion.current = () => { restorePanel(); restoreOverlay(); restoreBackground(); }; onPointerDownCapture?.(event); }, onInteractOutside: event => { if (event.detail.originalEvent.type === 'focusin')
127
130
  onFocusOutside?.(event); onInteractOutside?.(event); }, "data-hig-content-mode": contentMode, "data-hig-motion": reducedMotion ? 'reduced' : 'full', "data-hig-dynamic": dynamic ? 'true' : undefined, children: dynamic ? _jsx("div", { ref: setAnatomy, className: 'hig-gesture-dynamic', "data-hig-content-mode": contentMode, children: body }) : body })] })] });
128
131
  }
132
+ // One curve for the height and both views, measured from Vaul's Dynamic Drawer: no spring and no overshoot, a short ease in and a long ease out. The old view leaves in 270ms and the new one arrives in 220ms.
133
+ const VIEW_SWAP = { duration: 270, easing: 'cubic-bezier(.26,.08,.25,1)' };
134
+ const useCommitEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
135
+ /**
136
+ * One view of a sheet that shows several, such as the steps of a flow or the levels of a menu. When `viewKey` changes, the
137
+ * old view fades and shrinks out of the way without holding its space, the new one fades in at its own size, and a
138
+ * content-sized sheet (`enableDynamicSizing`) moves to the new height at the same time. Going deeper and going back look
139
+ * the same, as in Vaul. The first view appears with the sheet, and nothing moves under reduced motion. The outgoing view is
140
+ * inert and hidden from assistive technology while it leaves.
141
+ */
142
+ export function GestureSheetView({ viewKey, children, className, ...rest }) {
143
+ const { reducedMotion } = useHIG();
144
+ const committed = useRef({ key: viewKey, node: children }), enter = useRef(null), exit = useRef(null), mounted = useRef(false);
145
+ const [shown, setShown] = useState(viewKey), [leaving, setLeaving] = useState(null);
146
+ // The children of the view that was last on screen are kept so it can be drawn once more while it leaves.
147
+ if (shown !== viewKey) {
148
+ setShown(viewKey);
149
+ setLeaving(reducedMotion || committed.current.key === viewKey ? null : committed.current);
150
+ }
151
+ useEffect(() => { committed.current = { key: viewKey, node: children }; });
152
+ useCommitEffect(() => {
153
+ if (!mounted.current) {
154
+ mounted.current = true;
155
+ return;
156
+ }
157
+ if (reducedMotion) {
158
+ setLeaving(null);
159
+ return;
160
+ }
161
+ const incoming = enter.current?.animate?.([{ opacity: 0, transform: 'scale(.96)' }, { opacity: 1, transform: 'scale(1)' }], { ...VIEW_SWAP, duration: 220 });
162
+ const out = exit.current?.animate?.([{ opacity: 1, transform: 'scale(1)' }, { opacity: 0, transform: 'scale(.96)' }], { ...VIEW_SWAP, fill: 'forwards' });
163
+ if (!out) {
164
+ setLeaving(null);
165
+ return () => incoming?.cancel();
166
+ }
167
+ const done = () => setLeaving(current => current && current.key !== viewKey ? null : current);
168
+ out.onfinish = done;
169
+ out.oncancel = done;
170
+ return () => { out.onfinish = null; out.oncancel = null; incoming?.cancel(); out.cancel(); };
171
+ }, [viewKey, reducedMotion]);
172
+ return _jsxs("div", { ...rest, className: ['hig-gesture-views', className].filter(Boolean).join(' '), children: [leaving && _jsx("div", { ref: exit, className: 'hig-gesture-view', "data-leaving": '', "aria-hidden": 'true', inert: true, children: leaving.node }, leaving.key), _jsx("div", { ref: enter, className: 'hig-gesture-view', children: children }, viewKey)] });
173
+ }
@@ -1,26 +1,59 @@
1
1
  import React from 'react';
2
+ /** A text action on the trailing edge of a `ListGroup` heading, such as “Cancel all”. */
3
+ export interface ListGroupAction {
4
+ /** Host text drawn as the action and naming it. */
5
+ label: string;
6
+ onSelect: () => void;
7
+ disabled?: boolean;
8
+ }
2
9
  export interface ListGroupProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
3
- /** Heading above the group, such as “Settings”. Omit it for an untitled group. */
4
- title?: string;
10
+ /** Heading above the group, such as “Settings”: host text or an element such as a live count. Omit it for an untitled group. */
11
+ title?: React.ReactNode;
12
+ /** Host content after the title, such as a count or a figure. It is read with the heading; the group itself stays named by the title. */
13
+ titleAccessory?: React.ReactNode;
14
+ /** A text action on the trailing edge of the heading. */
15
+ action?: ListGroupAction;
16
+ /** 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. */
17
+ intro?: React.ReactNode;
5
18
  /** `ListRow` elements. */
6
19
  children?: React.ReactNode;
7
20
  }
8
21
  /** A grouped list for menus and settings: an optional heading over rows that share one rounded container. */
9
- export declare function ListGroup({ title, children, className, ...rest }: ListGroupProps): React.JSX.Element;
10
- export interface ListRowProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
22
+ export declare function ListGroup({ title, titleAccessory, action, intro, children, className, ...rest }: ListGroupProps): React.JSX.Element;
23
+ export interface ListRowProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onSelect' | 'defaultChecked'> {
11
24
  label: string;
25
+ /** 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. */
26
+ description?: React.ReactNode;
27
+ /** Colours the label: `destructive` for an action that deletes or ends something, `muted` for one that is done or inactive. */
28
+ tone?: 'destructive' | 'muted';
12
29
  /** Artwork before the label, such as an icon. Decorative: the label names the row. */
13
30
  leading?: React.ReactNode;
14
- /** Short text on the trailing edge, such as `Off`, `English` or a balance. */
31
+ /** Short text on the trailing edge, such as `Off`, `English` or a balance. A string or number is drawn muted. */
15
32
  value?: React.ReactNode;
33
+ /** What a `value` that is not text reads as, such as the formatted amount of a live figure. The element is then hidden from assistive technology and this text is read in its place. */
34
+ valueLabel?: string;
35
+ /** Colours a string or number `value` instead of the muted default, keeping its layout and reading. */
36
+ valueTone?: 'positive' | 'warning' | 'negative' | 'muted';
16
37
  /** Anything richer on the trailing edge: icons, a `Badge`, or a control such as a `Switch`. */
17
38
  trailing?: React.ReactNode;
18
39
  /** Makes the whole row a button, usually one that opens another view, and shows the disclosure chevron. */
19
40
  onSelect?: () => void;
20
41
  /** Makes the whole row a link and shows the disclosure chevron. */
21
42
  href?: string;
22
- /** Dims the row and blocks `onSelect` and `href`. */
43
+ /** Dims the row and blocks `onSelect`, `href` and the switch. */
23
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 marks the row `aria-current`. 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 marked busy and presses are ignored, without dimming it. */
48
+ busy?: boolean;
49
+ /** Busy text appended to the accessible name while `busy`; defaults to HIGProvider `messages.busy`. `''` omits it (the busy state stays exposed). */
50
+ busyLabel?: string;
51
+ /** The glyph a row with `onSelect` or `href` 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, the switch on its trailing edge is named by `label`, and `onCheckedChange` receives the new state. Use with no `onSelect` or `href`. */
54
+ checked?: boolean;
55
+ defaultChecked?: boolean;
56
+ onCheckedChange?: (checked: boolean) => void;
24
57
  }
25
- /** One row of a `ListGroup`: the label leads; a value, icons, a badge or a control trail. With `onSelect` or `href` the whole row is one target and shows a disclosure chevron; without them the row is static, so a control in `trailing` is its only target. */
26
- export declare function ListRow({ label, leading, value, trailing, onSelect, href, disabled, className, ...rest }: ListRowProps): React.JSX.Element;
58
+ /** One row of a `ListGroup`: the label leads; a value, icons, a badge or a control trail. With `onSelect` or `href` the whole row is one target 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. The ref reaches the row's element. */
59
+ export declare const ListRow: React.ForwardRefExoticComponent<ListRowProps & React.RefAttributes<HTMLElement>>;
@@ -1,20 +1,56 @@
1
1
  "use client";
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import React, { Children, useId } from 'react';
3
+ import { ArrowUpRight } from '@bloxwap/icons/react/arrow-up-right';
4
+ import { Check } from '@bloxwap/icons/react/check';
5
+ import { ChevronRight } from '@bloxwap/icons/react/chevron-right';
6
+ import React, { Children, forwardRef, useId, useRef } from 'react';
7
+ import * as en from '@bloxwap/hig/contracts/messages';
8
+ import { PressDecoration, useControllable, useHIG } from './provider.js';
9
+ const shown = (node) => node != null && node !== false && node !== '';
4
10
  /** A grouped list for menus and settings: an optional heading over rows that share one rounded container. */
5
- export function ListGroup({ title, children, className, ...rest }) {
11
+ export function ListGroup({ title, titleAccessory, action, intro, children, className, ...rest }) {
6
12
  const id = useId();
7
- return _jsxs("section", { ...rest, className: `hig-list-group${className ? ` ${className}` : ''}`, "aria-labelledby": title ? id : undefined, children: [title && _jsx("h3", { id: id, className: 'hig-list-group-title', children: title }), _jsx("ul", { className: 'hig-list-group-rows', children: Children.toArray(children).map((child, index) => _jsx("li", { children: child }, React.isValidElement(child) && child.key != null ? child.key : index)) })] });
13
+ const titled = shown(title), accessory = shown(titleAccessory);
14
+ const heading = titled ? accessory
15
+ ? _jsxs("h3", { className: 'hig-list-group-title', "data-accessory": '', children: [_jsx("span", { id: id, children: title }), ' ', _jsx("span", { className: 'hig-list-group-title-accessory', children: titleAccessory })] })
16
+ : _jsx("h3", { id: id, className: 'hig-list-group-title', children: title }) : null;
17
+ const rows = Children.toArray(children);
18
+ return _jsxs("section", { ...rest, className: `hig-list-group${className ? ` ${className}` : ''}`, "aria-labelledby": titled ? id : undefined, children: [action ? _jsxs("div", { className: 'hig-list-group-header', children: [heading, _jsxs("button", { type: 'button', className: 'hig-list-group-action', disabled: action.disabled, onClick: action.onSelect, children: [action.label, _jsx(PressDecoration, { kind: 'button', disabled: !!action.disabled })] })] }) : heading, shown(intro) && _jsx("div", { className: 'hig-list-group-intro', children: intro }), (!shown(intro) || rows.length > 0) && _jsx("ul", { className: 'hig-list-group-rows', children: rows.map((child, index) => _jsx("li", { children: child }, React.isValidElement(child) && child.key != null ? child.key : index)) })] });
8
19
  }
9
- const chevron = _jsx("svg", { className: 'hig-list-row-chevron', "aria-hidden": 'true', focusable: 'false', viewBox: '0 0 20 20', width: '20', height: '20', fill: 'none', stroke: 'currentColor', strokeWidth: '1.8', strokeLinecap: 'round', strokeLinejoin: 'round', children: _jsx("path", { d: 'm7.5 4.5 5.5 5.5-5.5 5.5' }) });
10
- /** One row of a `ListGroup`: the label leads; a value, icons, a badge or a control trail. With `onSelect` or `href` the whole row is one target and shows a disclosure chevron; without them the row is static, so a control in `trailing` is its only target. */
11
- export function ListRow({ label, leading, value, trailing, onSelect, href, disabled, className, ...rest }) {
12
- const action = !disabled && (onSelect || href != null);
13
- const content = _jsxs(_Fragment, { children: [leading != null && _jsx("span", { className: 'hig-list-row-leading', "aria-hidden": 'true', children: leading }), _jsx("span", { className: 'hig-list-row-label', children: label }), value != null && _jsx("span", { className: 'hig-list-row-value', children: value }), trailing != null && _jsx("span", { className: 'hig-list-row-trailing', children: trailing }), (onSelect || href != null) && chevron] });
20
+ const chevron = _jsx(ChevronRight, { size: 20, className: 'hig-list-row-chevron' });
21
+ const external = _jsx(ArrowUpRight, { size: 20, className: 'hig-list-row-chevron', "data-glyph": 'external' });
22
+ const check = _jsx(Check, { size: 20, className: 'hig-list-row-check' });
23
+ /** One row of a `ListGroup`: the label leads; a value, icons, a badge or a control trail. With `onSelect` or `href` the whole row is one target 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. The ref reaches the row's element. */
24
+ export const ListRow = /* @__PURE__ */ forwardRef(function ListRow({ label, description, tone, leading, value, valueLabel, valueTone, trailing, onSelect, href, disabled, selected, busy, busyLabel, disclosure, checked, defaultChecked, onCheckedChange, className, ...rest }, ref) {
25
+ const { messages } = useHIG();
26
+ const descriptionId = useId();
27
+ const input = useRef(null);
28
+ const [on, setOn] = useControllable(checked, defaultChecked ?? false, onCheckedChange);
29
+ const pressable = onSelect != null || href != null;
30
+ const toggles = !pressable && (checked !== undefined || defaultChecked !== undefined || onCheckedChange != null);
31
+ const text = typeof value === 'string' || typeof value === 'number';
32
+ const busyText = busyLabel ?? messages.busy ?? en.busy;
33
+ const labelId = useId();
34
+ // A switch row's input is named by this visible label (aria-labelledby), so the name is drawn and read once.
35
+ const name = _jsx("span", { id: toggles ? labelId : undefined, className: 'hig-list-row-label', "data-tone": tone, children: label });
36
+ const glyphKind = disclosure ?? (selected !== undefined ? 'none' : 'chevron');
37
+ const glyph = busy && !toggles ? _jsx("span", { className: 'hig-button-spinner hig-list-row-spinner', "aria-hidden": 'true' }) : selected ? check : pressable ? (glyphKind === 'chevron' ? chevron : glyphKind === 'external' ? external : null) : null;
38
+ const swatch = toggles ? _jsx("label", { className: 'hig-choice hig-switch', children: _jsx("input", { ref: input, role: 'switch', type: 'checkbox', checked: on, disabled: disabled, "aria-busy": busy || undefined, "aria-labelledby": labelId, "aria-describedby": shown(description) ? descriptionId : undefined, onChange: event => { if (!busy)
39
+ setOn(event.target.checked); } }) }) : null;
40
+ const content = _jsxs(_Fragment, { children: [leading != null && _jsx("span", { className: 'hig-list-row-leading', "aria-hidden": 'true', children: leading }), shown(description) ? _jsxs("span", { className: 'hig-list-row-text', children: [name, _jsx("span", { id: descriptionId, className: 'hig-list-row-description', children: description })] }) : name, value != null && _jsx("span", { className: 'hig-list-row-value', "data-tone": text && valueTone && valueTone !== 'muted' ? valueTone : undefined, children: !text && valueLabel ? _jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": 'true', children: value }), _jsx("span", { className: 'hig-sr-only', children: valueLabel })] }) : value }), (trailing != null || swatch) && _jsxs("span", { className: 'hig-list-row-trailing', children: [trailing, swatch] }), glyph, busy && !toggles && busyText ? _jsxs("span", { role: 'status', className: 'hig-busy hig-sr-only', children: [" \u00B7 ", busyText] }) : null] });
14
41
  const classes = `hig-list-row${className ? ` ${className}` : ''}`;
15
- if (action && href != null)
16
- return _jsx("a", { ...rest, className: classes, href: href, onClick: onSelect, children: content });
42
+ const current = selected ? { 'aria-current': true } : {};
43
+ if (toggles) {
44
+ // A press anywhere outside the switch and the host's own controls toggles it; the input stays the one named control.
45
+ const toggle = (event) => { const target = event.target; if (disabled || busy || target.closest('.hig-switch') || target.closest('a[href],button,input,select,textarea,label'))
46
+ return; input.current?.click(); };
47
+ return _jsxs("div", { ...rest, ref: ref, className: classes, "data-switch": '', "aria-disabled": disabled || undefined, onClick: event => { rest.onClick?.(event); if (!event.defaultPrevented)
48
+ toggle(event); }, children: [content, _jsx(PressDecoration, { kind: 'switch', disabled: !!disabled || !!busy, input: input })] });
49
+ }
50
+ // A busy link stays the same element, so the focus the press left on it stays; it only stops navigating.
51
+ if (!disabled && href != null)
52
+ return _jsxs("a", { ...current, ...rest, ref: ref, className: classes, href: href, "aria-disabled": busy || undefined, "aria-busy": busy || undefined, onClick: busy ? event => event.preventDefault() : onSelect, children: [content, _jsx(PressDecoration, { kind: 'row', disabled: !!busy })] });
17
53
  if (onSelect)
18
- return _jsx("button", { type: 'button', ...rest, className: classes, disabled: disabled, onClick: onSelect, children: content });
19
- return _jsx("div", { ...rest, className: classes, "aria-disabled": disabled || undefined, children: content });
20
- }
54
+ return _jsxs("button", { type: 'button', ...current, ...rest, ref: ref, className: classes, disabled: disabled, "aria-busy": busy || undefined, onClick: busy ? undefined : onSelect, children: [content, _jsx(PressDecoration, { kind: 'row', disabled: !!disabled || !!busy })] });
55
+ return _jsx("div", { ...current, ...rest, ref: ref, className: classes, "aria-disabled": disabled || undefined, "aria-busy": busy || undefined, children: content });
56
+ });
@@ -1,5 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ChevronDown } from '@bloxwap/icons/react/chevron-down';
4
+ import { assertUniqueKeys, paginationValue } from '@bloxwap/hig/contracts';
3
5
  import { useEffect, useId, useLayoutEffect, useRef } from 'react';
4
6
  import { formatNumber } from '@bloxwap/hig/contracts';
5
7
  import * as en from '@bloxwap/hig/contracts/messages';
@@ -34,7 +36,12 @@ else if (!stop && panel.hasAttribute('tabindex'))
34
36
  export function Tabs({ label, items, value, defaultValue, onValueChange }) {
35
37
  const { direction } = useHIG();
36
38
  const id = useId();
37
- const [current, set] = useControllable(value, defaultValue ?? items.find(item => !item.disabled)?.value ?? '', onValueChange);
39
+ const [stored, set] = useControllable(value, defaultValue ?? items.find(item => !item.disabled)?.value ?? '', onValueChange);
40
+ assertUniqueKeys(items, item => item.value, 'Tabs');
41
+ const controlled = useRef(value !== undefined).current;
42
+ const current = items.some(item => item.value === stored && !item.disabled) ? stored : controlled ? '' : items.find(item => !item.disabled)?.value ?? '';
43
+ useEffect(() => { if (!controlled && stored !== current)
44
+ set(current); }, [controlled, stored, current]);
38
45
  const enabled = items.filter(item => !item.disabled);
39
46
  const tabStop = (enabled.find(item => item.value === current) ?? enabled[0])?.value;
40
47
  // APG: a panel is a tab stop only when its first content is not focusable; otherwise that control is the single stop after the tab list.
@@ -62,8 +69,9 @@ export function Tabs({ label, items, value, defaultValue, onValueChange }) {
62
69
  document.getElementById(`${id}-tab-${enabled[next].value}`)?.focus();
63
70
  } }, children: items.map(item => _jsx("button", { type: 'button', className: 'hig-button hig-tab', role: 'tab', id: `${id}-tab-${item.value}`, "aria-controls": `${id}-panel-${item.value}`, "aria-selected": current === item.value, tabIndex: tabStop === item.value ? 0 : -1, disabled: item.disabled, onClick: () => set(item.value), children: item.label }, item.value)) }), items.map(item => _jsx("div", { ref: current === item.value ? panel : undefined, hidden: current !== item.value, className: 'hig-tab-panel', role: 'tabpanel', id: `${id}-panel-${item.value}`, "aria-labelledby": `${id}-tab-${item.value}`, tabIndex: 0, children: item.content }, item.value))] });
64
71
  }
65
- export function Accordion({ title, children, open, onOpenChange }) { return _jsxs("details", { open: open, className: 'hig-surface hig-accordion', onToggle: e => onOpenChange?.(e.currentTarget.open), children: [_jsxs("summary", { className: 'hig-accordion-summary', children: [_jsx("span", { children: title }), _jsx("svg", { className: 'hig-accordion-chevron', "aria-hidden": 'true', focusable: 'false', viewBox: '0 0 20 20', children: _jsx("path", { d: 'm5 7.5 5 5 5-5' }) })] }), children] }); }
72
+ export function Accordion({ title, children, open, onOpenChange }) { const [current, set] = useControllable(open, false, onOpenChange, 'disclosure'); return _jsxs("details", { open: current, className: 'hig-surface hig-accordion', onToggle: e => { if (e.currentTarget.open !== current)
73
+ e.currentTarget.open = current; }, children: [_jsxs("summary", { className: 'hig-accordion-summary', onClick: e => { e.preventDefault(); set(!current); }, children: [_jsx("span", { children: title }), _jsx(ChevronDown, { size: 20, className: 'hig-accordion-chevron' })] }), children] }); }
66
74
  export function Breadcrumb({ items }) { const { messages } = useHIG(); return _jsx("nav", { "aria-label": messages.breadcrumb ?? en.breadcrumb, children: _jsx("ol", { role: 'list', className: 'hig-inline hig-breadcrumb', children: items.map((item, i) => _jsxs("li", { children: [i > 0 && _jsx("span", { "aria-hidden": 'true', className: 'hig-breadcrumb-separator', children: "/" }), item.href ? _jsx(Link, { href: item.href, "aria-current": i === items.length - 1 ? 'page' : undefined, children: item.label }) : _jsx("span", { "aria-current": i === items.length - 1 ? 'page' : undefined, children: item.label })] }, i)) }) }); }
67
75
  export function Navigation({ label, items }) { return _jsx("nav", { "aria-label": label, className: 'hig-stack hig-navigation', children: items.map(item => _jsx(Link, { href: item.href, "aria-current": item.active ? 'page' : undefined, children: item.label }, item.href)) }); }
68
- export function Pagination({ page, total, onPageChange }) { const { locale, messages } = useHIG(); return _jsxs("nav", { "aria-label": messages.pagination ?? en.pagination, className: 'hig-inline hig-pagination', children: [_jsx(Button, { intent: 'secondary', disabled: page <= 1, onClick: () => onPageChange(page - 1), children: messages.previous ?? en.previous }), _jsx("span", { children: (messages.pageOf ?? en.pageOf)(formatNumber(page, locale), formatNumber(total, locale)) }), _jsx(Button, { intent: 'secondary', disabled: page >= total, onClick: () => onPageChange(page + 1), children: messages.next ?? en.next })] }); }
76
+ export function Pagination({ page, total, onPageChange }) { ({ page, total } = paginationValue(page, total)); const { locale, messages } = useHIG(); return _jsxs("nav", { "aria-label": messages.pagination ?? en.pagination, className: 'hig-inline hig-pagination', children: [_jsx(Button, { intent: 'secondary', disabled: page <= 1, onClick: () => onPageChange(page - 1), children: messages.previous ?? en.previous }), _jsx("span", { children: (messages.pageOf ?? en.pageOf)(formatNumber(page, locale), formatNumber(total, locale)) }), _jsx(Button, { intent: 'secondary', disabled: page >= total, onClick: () => onPageChange(page + 1), children: messages.next ?? en.next })] }); }
69
77
  export function Search({ query, onQueryChange, results, loading, error }) { const { messages } = useHIG(); return _jsxs("section", { children: [_jsx(Field, { label: messages.search ?? en.search, children: _jsx(SearchInput, { value: query, onChange: e => onQueryChange(e.target.value) }) }), loading ? _jsx("p", { role: 'status', children: messages.searching ?? en.searching }) : error ? _jsx("p", { role: 'alert', children: error }) : results.length ? _jsx("ul", { children: results.map(r => _jsx("li", { children: _jsx(Button, { intent: 'ghost', onClick: r.onSelect, children: r.label }) }, r.id)) }) : _jsx("p", { role: 'status', children: messages.noResults ?? en.noResults })] }); }
@@ -8,10 +8,35 @@ export declare function Menu({ label, items }: {
8
8
  onSelect: (event: Event) => void;
9
9
  }[];
10
10
  }): React.JSX.Element;
11
- export declare function Popover({ label, children, closeLabel }: React.PropsWithChildren<{
12
- label: string; /** Close button text and accessible name; defaults to HIGProvider `messages.close`. */
11
+ export interface PopoverProps {
12
+ /** Text of the built-in trigger, a secondary Button. With `trigger`, it names the popover instead (`aria-label` on its content). */
13
+ label: string;
14
+ children?: React.ReactNode;
15
+ /** Close button text and accessible name; defaults to HIGProvider `messages.close`. */
13
16
  closeLabel?: string;
14
- }>): React.JSX.Element;
17
+ /** Leaves out the Close button, for a popover that holds only information or that the host closes itself. Escape and a press outside still close it. */
18
+ hideClose?: boolean;
19
+ /** Controls whether the popover is open. Omit it, with `defaultOpen`, to let the popover keep its own state. */
20
+ open?: boolean;
21
+ defaultOpen?: boolean;
22
+ /** Called with the next state when the trigger, Close, Escape, a press outside or (with `openOnHover`) the pointer opens or closes it. */
23
+ onOpenChange?: (open: boolean) => void;
24
+ /** The host's own trigger in place of the built-in Button: one element that accepts a ref and spreads its props onto a focusable element, such as a HIG `Button`, `IconButton` or a `<button>`. */
25
+ trigger?: React.ReactElement;
26
+ /** Also opens while a mouse pointer rests on the trigger, and closes shortly after it leaves both the trigger and the popover. Touch and pen keep press to open; keyboard focus is not moved by a hover. */
27
+ openOnHover?: boolean;
28
+ /** `data-testid` of the popover's content. */
29
+ testID?: string;
30
+ /** Tints the popover's surface from a token role: a 12% wash over its fill, a 40% stroke and a soft glow in the role's colour, such as `warning` for a gold badge's explanation. `data-tone` on the content. Without it the surface is neutral. */
31
+ tone?: PopoverTone;
32
+ /** Classes added to the popover's content after `hig-popover`, for a host surface treatment the tones do not cover. */
33
+ className?: string;
34
+ /** Inline style for the popover's content, after the theme's variables, so it can set `--hig-popover-tone` or a host border, background or shadow. */
35
+ style?: React.CSSProperties;
36
+ }
37
+ /** A token role that tints a `Popover`'s surface. */
38
+ export type PopoverTone = 'info' | 'positive' | 'warning' | 'negative';
39
+ export declare function Popover({ label, children, closeLabel, hideClose, open, defaultOpen, onOpenChange, trigger, openOnHover, testID, tone, className, style }: PopoverProps): React.JSX.Element;
15
40
  export declare function Tooltip({ content, children }: React.PropsWithChildren<{
16
41
  content: string;
17
42
  }>): React.JSX.Element;