@eifi1/ui-kit 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 (271) hide show
  1. package/README.md +69 -33
  2. package/dist/chart.d.ts +1 -0
  3. package/dist/components/account-settings.js +3 -2
  4. package/dist/components/account-settings.js.map +1 -1
  5. package/dist/components/amount-input.d.ts +3 -0
  6. package/dist/components/amount-input.js +6 -4
  7. package/dist/components/amount-input.js.map +1 -1
  8. package/dist/components/autocomplete.d.ts +36 -7
  9. package/dist/components/autocomplete.js +68 -22
  10. package/dist/components/autocomplete.js.map +1 -1
  11. package/dist/components/calculator.d.ts +3 -0
  12. package/dist/components/calculator.js +2 -1
  13. package/dist/components/calculator.js.map +1 -1
  14. package/dist/components/chart-zoom.js +2 -1
  15. package/dist/components/chart-zoom.js.map +1 -1
  16. package/dist/components/chart.d.ts +33 -2
  17. package/dist/components/chart.js +20 -8
  18. package/dist/components/chart.js.map +1 -1
  19. package/dist/components/checkbox.d.ts +9 -0
  20. package/dist/components/checkbox.js +7 -2
  21. package/dist/components/checkbox.js.map +1 -1
  22. package/dist/components/chip.d.ts +34 -14
  23. package/dist/components/chip.js +63 -28
  24. package/dist/components/chip.js.map +1 -1
  25. package/dist/components/choice-card.d.ts +18 -1
  26. package/dist/components/choice-card.js +21 -8
  27. package/dist/components/choice-card.js.map +1 -1
  28. package/dist/components/combobox-core.d.ts +61 -2
  29. package/dist/components/combobox-core.js +68 -17
  30. package/dist/components/combobox-core.js.map +1 -1
  31. package/dist/components/combobox.d.ts +11 -7
  32. package/dist/components/combobox.js +51 -28
  33. package/dist/components/combobox.js.map +1 -1
  34. package/dist/components/currency-select.js +3 -3
  35. package/dist/components/currency-select.js.map +1 -1
  36. package/dist/components/danger-confirm.d.ts +30 -6
  37. package/dist/components/danger-confirm.js +51 -32
  38. package/dist/components/danger-confirm.js.map +1 -1
  39. package/dist/components/data-table-filter-popover.d.ts +1 -1
  40. package/dist/components/data-table-filters.d.ts +1 -1
  41. package/dist/components/data-table-pagination.d.ts +6 -3
  42. package/dist/components/data-table-pagination.js +6 -5
  43. package/dist/components/data-table-pagination.js.map +1 -1
  44. package/dist/components/data-table.d.ts +1 -1
  45. package/dist/components/data-table.js +332 -248
  46. package/dist/components/data-table.js.map +1 -1
  47. package/dist/components/date-picker.js +17 -7
  48. package/dist/components/date-picker.js.map +1 -1
  49. package/dist/components/dialog-frame.d.ts +28 -3
  50. package/dist/components/dialog-frame.js +47 -11
  51. package/dist/components/dialog-frame.js.map +1 -1
  52. package/dist/components/disclosure.d.ts +22 -2
  53. package/dist/components/disclosure.js +41 -8
  54. package/dist/components/disclosure.js.map +1 -1
  55. package/dist/components/dropdown.d.ts +7 -3
  56. package/dist/components/dropdown.js +6 -2
  57. package/dist/components/dropdown.js.map +1 -1
  58. package/dist/components/entity-combobox.d.ts +17 -8
  59. package/dist/components/entity-combobox.js +7 -5
  60. package/dist/components/entity-combobox.js.map +1 -1
  61. package/dist/components/file-button.d.ts +36 -5
  62. package/dist/components/file-button.js +42 -3
  63. package/dist/components/file-button.js.map +1 -1
  64. package/dist/components/file-dropzone.d.ts +9 -5
  65. package/dist/components/file-dropzone.js +14 -19
  66. package/dist/components/file-dropzone.js.map +1 -1
  67. package/dist/components/grouped-picker.js +2 -2
  68. package/dist/components/grouped-picker.js.map +1 -1
  69. package/dist/components/hover-menu.d.ts +8 -3
  70. package/dist/components/hover-menu.js +88 -4
  71. package/dist/components/hover-menu.js.map +1 -1
  72. package/dist/components/icon-picker.d.ts +10 -1
  73. package/dist/components/icon-picker.js +5 -1
  74. package/dist/components/icon-picker.js.map +1 -1
  75. package/dist/components/measured-grid.d.ts +165 -0
  76. package/dist/components/measured-grid.js +559 -0
  77. package/dist/components/measured-grid.js.map +1 -0
  78. package/dist/components/mini-calendar.js +7 -8
  79. package/dist/components/mini-calendar.js.map +1 -1
  80. package/dist/components/month-picker.js +13 -9
  81. package/dist/components/month-picker.js.map +1 -1
  82. package/dist/components/multi-entity-combobox.js +2 -2
  83. package/dist/components/multi-entity-combobox.js.map +1 -1
  84. package/dist/components/multi-select.d.ts +9 -1
  85. package/dist/components/multi-select.js +22 -8
  86. package/dist/components/multi-select.js.map +1 -1
  87. package/dist/components/number-field.d.ts +3 -0
  88. package/dist/components/number-input.d.ts +3 -0
  89. package/dist/components/number-input.js +3 -3
  90. package/dist/components/number-input.js.map +1 -1
  91. package/dist/components/numpad-sheet.d.ts +3 -0
  92. package/dist/components/numpad-sheet.js +3 -3
  93. package/dist/components/numpad-sheet.js.map +1 -1
  94. package/dist/components/picker-sheet.js +1 -1
  95. package/dist/components/picker-sheet.js.map +1 -1
  96. package/dist/components/popover.js +11 -2
  97. package/dist/components/popover.js.map +1 -1
  98. package/dist/components/series-chart-ticks.d.ts +13 -0
  99. package/dist/components/series-chart-ticks.js +29 -0
  100. package/dist/components/series-chart-ticks.js.map +1 -0
  101. package/dist/components/series-chart.js +33 -27
  102. package/dist/components/series-chart.js.map +1 -1
  103. package/dist/components/swatch-picker.d.ts +10 -1
  104. package/dist/components/swatch-picker.js +2 -0
  105. package/dist/components/swatch-picker.js.map +1 -1
  106. package/dist/components/swipeable-row.d.ts +11 -2
  107. package/dist/components/swipeable-row.js +5 -3
  108. package/dist/components/swipeable-row.js.map +1 -1
  109. package/dist/components/switch.d.ts +9 -0
  110. package/dist/components/switch.js +7 -2
  111. package/dist/components/switch.js.map +1 -1
  112. package/dist/components/tile-radio.js +5 -7
  113. package/dist/components/tile-radio.js.map +1 -1
  114. package/dist/components/toggle-group.d.ts +13 -3
  115. package/dist/components/toggle-group.js +21 -1
  116. package/dist/components/toggle-group.js.map +1 -1
  117. package/dist/components/toggle-legend.js +1 -2
  118. package/dist/components/toggle-legend.js.map +1 -1
  119. package/dist/components/treemap.d.ts +6 -1
  120. package/dist/components/treemap.js +16 -6
  121. package/dist/components/treemap.js.map +1 -1
  122. package/dist/components/ui.d.ts +31 -7
  123. package/dist/components/ui.js +26 -18
  124. package/dist/components/ui.js.map +1 -1
  125. package/dist/components/use-anchor-dir.d.ts +15 -0
  126. package/dist/components/use-anchor-dir.js +14 -0
  127. package/dist/components/use-anchor-dir.js.map +1 -0
  128. package/dist/components/use-mobile-reveal.d.ts +8 -1
  129. package/dist/components/use-mobile-reveal.js +3 -2
  130. package/dist/components/use-mobile-reveal.js.map +1 -1
  131. package/dist/components/use-table-state.d.ts +4 -4
  132. package/dist/components/use-table-state.js +12 -5
  133. package/dist/components/use-table-state.js.map +1 -1
  134. package/dist/{data-table-filters-DM1auUfH.d.ts → data-table-filters-noy0Abvi.d.ts} +40 -7
  135. package/dist/data-table.d.ts +1 -1
  136. package/dist/data-table.js.map +1 -1
  137. package/dist/feedback/feedback-attachment.d.ts +22 -3
  138. package/dist/feedback/feedback-attachment.js +15 -7
  139. package/dist/feedback/feedback-attachment.js.map +1 -1
  140. package/dist/feedback/feedback-dialog.d.ts +3 -2
  141. package/dist/feedback/feedback-dialog.js.map +1 -1
  142. package/dist/feedback.d.ts +1 -1
  143. package/dist/hooks/use-windowed-rows.d.ts +29 -0
  144. package/dist/hooks/use-windowed-rows.js +31 -0
  145. package/dist/hooks/use-windowed-rows.js.map +1 -0
  146. package/dist/i18n/defaults.d.ts +3 -0
  147. package/dist/i18n/defaults.js +5 -1
  148. package/dist/i18n/defaults.js.map +1 -1
  149. package/dist/i18n/kit-labels.d.ts +5 -0
  150. package/dist/i18n/kit-labels.js.map +1 -1
  151. package/dist/i18n/locales/de-CH.d.ts +43 -0
  152. package/dist/i18n/locales/de-CH.js +21 -0
  153. package/dist/i18n/locales/de-CH.js.map +1 -0
  154. package/dist/i18n/locales/de.d.ts +43 -0
  155. package/dist/i18n/locales/de.js +344 -0
  156. package/dist/i18n/locales/de.js.map +1 -0
  157. package/dist/i18n/locales/es.d.ts +43 -0
  158. package/dist/i18n/locales/es.js +339 -0
  159. package/dist/i18n/locales/es.js.map +1 -0
  160. package/dist/i18n/locales/fr.d.ts +43 -0
  161. package/dist/i18n/locales/fr.js +344 -0
  162. package/dist/i18n/locales/fr.js.map +1 -0
  163. package/dist/i18n/locales/hu.d.ts +43 -0
  164. package/dist/i18n/locales/hu.js +343 -0
  165. package/dist/i18n/locales/hu.js.map +1 -0
  166. package/dist/i18n/locales/it.d.ts +43 -0
  167. package/dist/i18n/locales/it.js +342 -0
  168. package/dist/i18n/locales/it.js.map +1 -0
  169. package/dist/i18n/locales/zh.d.ts +43 -0
  170. package/dist/i18n/locales/zh.js +338 -0
  171. package/dist/i18n/locales/zh.js.map +1 -0
  172. package/dist/index.d.ts +6 -3
  173. package/dist/index.js +4 -1
  174. package/dist/index.js.map +1 -1
  175. package/dist/lib/direction.d.ts +24 -0
  176. package/dist/lib/direction.js +19 -0
  177. package/dist/lib/direction.js.map +1 -0
  178. package/dist/rhf/form.js.map +1 -1
  179. package/dist/search/command-palette.d.ts +5 -0
  180. package/dist/search/command-palette.js +80 -50
  181. package/dist/search/command-palette.js.map +1 -1
  182. package/dist/shell/app-shell.d.ts +13 -1
  183. package/dist/shell/app-shell.js +133 -84
  184. package/dist/shell/app-shell.js.map +1 -1
  185. package/dist/shell/topbar-action-menu.js +1 -1
  186. package/dist/shell/topbar-action-menu.js.map +1 -1
  187. package/dist/shell/topbar-controls.d.ts +7 -3
  188. package/dist/shell/topbar-controls.js +38 -31
  189. package/dist/shell/topbar-controls.js.map +1 -1
  190. package/dist/theme/chart-palette.d.ts +7 -1
  191. package/dist/theme/chart-palette.js +2 -1
  192. package/dist/theme/chart-palette.js.map +1 -1
  193. package/dist/tour/tour.d.ts +11 -5
  194. package/dist/tour/tour.js +124 -58
  195. package/dist/tour/tour.js.map +1 -1
  196. package/dist/wizard/use-wizard.js +30 -13
  197. package/dist/wizard/use-wizard.js.map +1 -1
  198. package/dist/wizard/wizard-summary.js +1 -1
  199. package/dist/wizard/wizard-summary.js.map +1 -1
  200. package/package.json +12 -2
  201. package/src/components/account-settings.tsx +6 -2
  202. package/src/components/amount-input.tsx +10 -8
  203. package/src/components/autocomplete.tsx +123 -33
  204. package/src/components/calculator.tsx +5 -1
  205. package/src/components/chart-zoom.tsx +8 -1
  206. package/src/components/chart.tsx +68 -7
  207. package/src/components/checkbox.tsx +16 -0
  208. package/src/components/chip.tsx +131 -49
  209. package/src/components/choice-card.tsx +77 -36
  210. package/src/components/combobox-core.tsx +147 -20
  211. package/src/components/combobox.tsx +100 -44
  212. package/src/components/currency-select.tsx +6 -6
  213. package/src/components/danger-confirm.tsx +90 -36
  214. package/src/components/data-table-pagination.tsx +32 -19
  215. package/src/components/data-table.tsx +198 -36
  216. package/src/components/date-picker.tsx +24 -7
  217. package/src/components/dialog-frame.tsx +97 -22
  218. package/src/components/disclosure.tsx +75 -13
  219. package/src/components/dropdown.tsx +17 -5
  220. package/src/components/entity-combobox.tsx +26 -13
  221. package/src/components/file-button.tsx +102 -6
  222. package/src/components/file-dropzone.tsx +44 -35
  223. package/src/components/grouped-picker.tsx +2 -2
  224. package/src/components/hover-menu.tsx +139 -10
  225. package/src/components/icon-picker.tsx +14 -1
  226. package/src/components/measured-grid.tsx +852 -0
  227. package/src/components/mini-calendar.tsx +11 -8
  228. package/src/components/month-picker.tsx +18 -11
  229. package/src/components/multi-entity-combobox.tsx +2 -2
  230. package/src/components/multi-select.tsx +34 -7
  231. package/src/components/number-input.tsx +4 -4
  232. package/src/components/numpad-sheet.tsx +5 -3
  233. package/src/components/picker-sheet.tsx +1 -1
  234. package/src/components/popover.tsx +18 -3
  235. package/src/components/series-chart-ticks.ts +52 -0
  236. package/src/components/series-chart.tsx +39 -31
  237. package/src/components/swatch-picker.tsx +11 -0
  238. package/src/components/swipeable-row.tsx +21 -6
  239. package/src/components/switch.tsx +16 -0
  240. package/src/components/tile-radio.tsx +5 -7
  241. package/src/components/toggle-group.tsx +39 -3
  242. package/src/components/toggle-legend.tsx +5 -2
  243. package/src/components/treemap.tsx +28 -5
  244. package/src/components/ui.tsx +74 -30
  245. package/src/components/use-anchor-dir.ts +20 -0
  246. package/src/components/use-mobile-reveal.ts +10 -2
  247. package/src/components/use-table-state.ts +44 -7
  248. package/src/data-table.ts +1 -0
  249. package/src/feedback/feedback-attachment.tsx +36 -9
  250. package/src/feedback/feedback-dialog.tsx +3 -2
  251. package/src/hooks/use-windowed-rows.ts +69 -0
  252. package/src/i18n/defaults.ts +4 -0
  253. package/src/i18n/kit-labels.tsx +4 -0
  254. package/src/i18n/locales/de-CH.ts +30 -0
  255. package/src/i18n/locales/de.ts +365 -0
  256. package/src/i18n/locales/es.ts +358 -0
  257. package/src/i18n/locales/fr.ts +371 -0
  258. package/src/i18n/locales/hu.ts +359 -0
  259. package/src/i18n/locales/it.ts +360 -0
  260. package/src/i18n/locales/zh.ts +348 -0
  261. package/src/index.ts +10 -1
  262. package/src/lib/direction.ts +37 -0
  263. package/src/rhf/form.tsx +21 -0
  264. package/src/search/command-palette.tsx +77 -19
  265. package/src/shell/app-shell.tsx +200 -129
  266. package/src/shell/topbar-action-menu.tsx +1 -1
  267. package/src/shell/topbar-controls.tsx +19 -8
  268. package/src/theme/chart-palette.ts +9 -2
  269. package/src/tour/tour.tsx +119 -18
  270. package/src/wizard/use-wizard.ts +55 -17
  271. package/src/wizard/wizard-summary.tsx +1 -1
package/README.md CHANGED
@@ -373,22 +373,24 @@ columns, strings and permissions (see the note at the top of `src/feedback/feedb
373
373
 
374
374
  <!-- BEGIN GENERATED: exports — node scripts/gen-export-inventory.mjs -->
375
375
 
376
- **324 names from 76 modules** — 212 values and 112 types. _Italic_ is a type-only export.
376
+ **594 names from 105 modules** — 331 values and 263 types. _Italic_ is a type-only export.
377
377
 
378
378
  Generated from `dist/index.d.ts` by `node scripts/gen-export-inventory.mjs`; the count
379
379
  is pinned by `src/__tests__/public-surface.test.ts`. Do not edit between the markers.
380
380
 
381
381
  | Entry point | Names |
382
382
  |---|---|
383
- | `@eifi1/ui-kit` | 324 |
384
- | `@eifi1/ui-kit/chart` | 15 |
385
- | `@eifi1/ui-kit/shell` | 16 |
386
- | `@eifi1/ui-kit/data-table` | 27 |
383
+ | `@eifi1/ui-kit` | 594 |
384
+ | `@eifi1/ui-kit/chart` | 73 |
385
+ | `@eifi1/ui-kit/shell` | 18 |
386
+ | `@eifi1/ui-kit/data-table` | 28 |
387
387
  | `@eifi1/ui-kit/wizard` | 20 |
388
- | `@eifi1/ui-kit/tour` | 6 |
389
- | `@eifi1/ui-kit/feedback` | 27 |
390
- | `@eifi1/ui-kit/search` | 4 |
388
+ | `@eifi1/ui-kit/tour` | 7 |
389
+ | `@eifi1/ui-kit/feedback` | 29 |
390
+ | `@eifi1/ui-kit/search` | 5 |
391
391
  | `@eifi1/ui-kit/dates` | 16 |
392
+ | `@eifi1/ui-kit/table-text` | 8 |
393
+ | `@eifi1/ui-kit/rhf` | 13 |
392
394
 
393
395
  Everything below is reachable from the main `@eifi1/ui-kit` barrel. The subpaths are a
394
396
  re-slicing of it, never a second API.
@@ -415,6 +417,7 @@ re-slicing of it, never a second API.
415
417
  | `hooks/use-overlay-history` | `useOverlayHistory` |
416
418
  | `hooks/use-close-transition` | `OVERLAY_EXIT_MS`, `useCloseTransition` |
417
419
  | `hooks/use-row-swipe` | `useRowSwipe`, _`RowSwipeOptions`_, _`RowSwipeReturn`_, _`SwipeStage`_ |
420
+ | `hooks/use-windowed-rows` | `useWindowedRows`, _`WindowedRows`_ |
418
421
 
419
422
  ### theme, palettes, colour
420
423
 
@@ -431,53 +434,79 @@ re-slicing of it, never a second API.
431
434
 
432
435
  | Module | Exports |
433
436
  |---|---|
434
- | `components/ui` | `Button`, `buttonClasses`, `Card`, `CardAction`, `CardContent`, `CardDescription`, `CardFooter`, `CardHeader`, `CardTitle`, `DEFAULT_PASSWORD_REVEAL_LABELS`, `EmptyState`, `FIELD_BASE`, `FIELD_DISPLAY`, `FIELD_FLOATING_PAD`, `FIELD_INVALID`, `FIELD_TRIGGER`, `FIELD_WRITABLE_LOOK`, `FieldChevron`, `FieldHint`, `FieldLabel`, `FLOATING_INPUT_CLASS`, `FLOATING_LABEL_CLASS`, `FLOATING_LABEL_STATIC`, `FloatingField`, `IconButton`, `Input`, `PHONE_QUERY`, `resolvePasswordRevealLabels`, `Select`, `Spinner`, `Tabs`, `Textarea`, _`ButtonVariant`_, _`PasswordRevealLabels`_, _`TabsProps`_ |
437
+ | `components/ui` | `Button`, `buttonClasses`, `Card`, `CardAction`, `CardContent`, `CardDescription`, `CardFooter`, `CardHeader`, `CardTitle`, `DEFAULT_PASSWORD_REVEAL_LABELS`, `DEFAULT_TABS_LABELS`, `EmptyState`, `FIELD_BASE`, `FIELD_DISPLAY`, `FIELD_FLOATING_PAD`, `FIELD_INVALID`, `FIELD_TRIGGER`, `FIELD_WRITABLE_LOOK`, `FieldChevron`, `FieldHint`, `FieldLabel`, `FLOATING_INPUT_CLASS`, `FLOATING_LABEL_CLASS`, `FLOATING_LABEL_STATIC`, `FloatingField`, `IconButton`, `Input`, `Label`, `PHONE_QUERY`, `resolvePasswordRevealLabels`, `Select`, `Spinner`, `Tabs`, `Textarea`, _`ButtonProps`_, _`ButtonVariant`_, _`CardActionProps`_, _`CardContentProps`_, _`CardDescriptionProps`_, _`CardFooterProps`_, _`CardHeaderProps`_, _`CardProps`_, _`CardTitleProps`_, _`EmptyStateProps`_, _`FieldChevronProps`_, _`FieldHintProps`_, _`FieldLabelProps`_, _`FloatingFieldProps`_, _`IconButtonProps`_, _`IconButtonSize`_, _`InputProps`_, _`LabelProps`_, _`PasswordRevealLabels`_, _`SelectProps`_, _`SpinnerProps`_, _`TabItem`_, _`TabsLabels`_, _`TabsProps`_, _`TextareaProps`_ |
435
438
  | `components/search-field` | `SearchField`, _`SearchFieldProps`_ |
436
- | `components/dropdown` | `DropdownPanel`, `DropdownSearchHeader`, `useDropdown`, `useDropdownSearch` |
437
- | `components/popover` | `Popover`, _`PopoverLabels`_ |
439
+ | `components/dropdown` | `DropdownPanel`, `DropdownSearchHeader`, `useDropdown`, `useDropdownSearch`, _`DropdownPanelProps`_, _`DropdownSearchHeaderProps`_ |
440
+ | `components/popover` | `DEFAULT_POPOVER_LABELS`, `Popover`, _`PopoverLabels`_, _`PopoverProps`_ |
438
441
  | `components/swipeable-row` | `SwipeableRow`, _`SwipeableRowProps`_, _`SwipeAction`_ |
439
442
  | `components/calculator` | `CalculatorButton`, _`CalculatorButtonLabels`_ |
440
443
  | `components/numpad-sheet` | `NumberPadSheet`, _`NumberPadSheetLabels`_ |
441
- | `components/number-input` | `NumberInput` |
442
- | `components/currency-select` | `CURRENCIES`, `CurrencyFlag`, `currencyName`, `CurrencySelect`, `getCurrency`, _`CurrencyOption`_ |
444
+ | `components/number-input` | `NumberInput`, `stepNumber` |
445
+ | `components/currency-select` | `CURRENCIES`, `CurrencyFlag`, `currencyName`, `CurrencySelect`, `getCurrency`, _`CurrencyFlagProps`_, _`CurrencyOption`_, _`CurrencySelectProps`_ |
443
446
  | `components/amount-input` | `AmountInput` |
444
- | `components/combobox` | `Combobox`, `InlineEntityCombobox` |
445
- | `components/picker-sheet` | `PickerSheet`, `SHEET_ROW_CLASS` |
447
+ | `components/combobox` | `Combobox`, `InlineEntityCombobox`, _`ComboboxProps`_, _`InlineEntityComboboxProps`_ |
448
+ | `components/picker-sheet` | `PickerSheet`, `SHEET_ROW_CLASS`, _`PickerSheetProps`_ |
446
449
  | `components/entity-combobox` | `EntityCombobox`, _`EntityComboboxProps`_ |
447
450
  | `components/multi-entity-combobox` | `MultiEntityCombobox`, _`MultiEntityComboboxProps`_ |
448
- | `components/multi-select` | `MultiSelect`, _`MultiSelectOption`_ |
449
- | `components/tooltip` | `placeTooltip`, `Tooltip`, _`TooltipPlacement`_, _`TooltipSize`_, _`TooltipViewport`_ |
451
+ | `components/multi-select` | `MultiSelect`, _`MultiSelectOption`_, _`MultiSelectProps`_ |
452
+ | `components/tooltip` | `placeTooltip`, `Tooltip`, _`TooltipPlacement`_, _`TooltipProps`_, _`TooltipSize`_, _`TooltipViewport`_ |
450
453
  | `components/user-avatar` | `avatarInitials`, `UserAvatar`, _`UserAvatarProps`_ |
451
454
  | `components/settings-fields` | `LanguageSetting`, `ThemeSetting`, _`LanguageSettingProps`_, _`ThemeSettingProps`_ |
452
- | `components/field-sync` | `DEFAULT_FIELD_SYNC_LABELS`, `FieldSyncIndicator`, `FieldSyncRow`, `resolveFieldSyncLabels`, `useFieldSync`, _`FieldSyncIndicatorProps`_, _`FieldSyncLabels`_, _`FieldSyncRowProps`_, _`FieldSyncState`_, _`UseFieldSyncOptions`_, _`UseFieldSyncReturn`_ |
455
+ | `components/field-sync` | `DEFAULT_FIELD_SYNC_LABELS`, `FIELD_SYNC_FRAME`, `FIELD_SYNC_SAVED_MS`, `FieldSyncIndicator`, `FieldSyncRow`, `resolveFieldSyncLabels`, `useFieldSync`, _`FieldSyncIndicatorProps`_, _`FieldSyncLabels`_, _`FieldSyncRowProps`_, _`FieldSyncState`_, _`UseFieldSyncOptions`_, _`UseFieldSyncReturn`_ |
456
+ | `components/month-picker` | `DEFAULT_MONTH_PICKER_LABELS`, `MonthPicker`, _`MonthPickerLabels`_, _`MonthPickerProps`_ |
457
+ | `components/checkbox` | `Checkbox`, _`CheckboxProps`_ |
458
+ | `components/switch` | `Switch`, _`SwitchProps`_, _`SwitchSize`_ |
459
+ | `components/slider` | `fromLogPosition`, `Slider`, `toLogPosition`, _`SliderMark`_, _`SliderProps`_ |
460
+ | `components/time-input` | `isTimeInRange`, `normalizeTime`, `TimeInput`, _`TimeInputProps`_ |
461
+ | `components/number-field` | `NumberField`, _`NumberFieldProps`_ |
462
+ | `components/sparkline` | `DEFAULT_SPARKLINE_LABELS`, `Sparkline`, `sparklineSummary`, _`SparklineLabels`_, _`SparklineProps`_, _`SparklineTone`_ |
463
+ | `components/stat-tile` | `DEFAULT_STAT_TILE_LABELS`, `StatTile`, `StatTileGrid`, _`StatTileDelta`_, _`StatTileGridProps`_, _`StatTileLabels`_, _`StatTileLinkProps`_, _`StatTileProps`_, _`StatTileSubValue`_, _`StatTileTone`_ |
464
+ | `components/signature-pad` | `DEFAULT_SIGNATURE_PAD_LABELS`, `SignaturePad`, `SignatureView`, _`SignatureDetail`_, _`SignaturePadHandle`_, _`SignaturePadLabels`_, _`SignaturePadProps`_, _`SignatureViewProps`_ |
465
+ | `components/password-strength` | `DEFAULT_PASSWORD_STRENGTH_LABELS`, `passwordByteLength`, `passwordRules`, `PasswordStrengthMeter`, `scorePassword`, _`PasswordRule`_, _`PasswordRuleId`_, _`PasswordScoreOptions`_, _`PasswordStrengthLabels`_, _`PasswordStrengthMeterProps`_, _`PasswordStrengthScore`_ |
466
+ | `components/page-contents` | `DEFAULT_PAGE_CONTENTS_LABELS`, `PageContents`, `PageContentsLayout`, `useScrollSpy`, _`PageContentsItem`_, _`PageContentsLabels`_, _`PageContentsLayoutProps`_, _`PageContentsProps`_, _`UseScrollSpyOptions`_ |
467
+ | `components/disclosure` | `Collapse`, `Disclosure`, _`CollapseProps`_, _`DisclosureProps`_ |
468
+ | `components/dialog-frame` | `DEFAULT_DIALOG_FRAME_LABELS`, `DialogFrame`, _`DialogFrameLabels`_, _`DialogFrameProps`_ |
469
+ | `components/danger-confirm` | `DangerConfirm`, `DEFAULT_DANGER_CONFIRM_LABELS`, _`DangerConfirmLabels`_, _`DangerConfirmProps`_ |
470
+ | `components/swatch-picker` | `DEFAULT_SWATCH_PICKER_LABELS`, `SwatchPicker`, _`SwatchOption`_, _`SwatchPickerLabels`_, _`SwatchPickerProps`_ |
471
+ | `components/icon-picker` | `DEFAULT_ICON_PICKER_LABELS`, `IconPicker`, _`IconOption`_, _`IconPickerLabels`_, _`IconPickerProps`_ |
472
+ | `components/choice-card` | `ChoiceCard`, `ChoiceCardGroup`, _`ChoiceCardGroupProps`_, _`ChoiceCardMultipleProps`_, _`ChoiceCardOption`_, _`ChoiceCardProps`_, _`ChoiceCardSingleProps`_, _`ChoiceCardType`_ |
473
+ | `components/autocomplete` | `Autocomplete`, _`AutocompleteProps`_ |
474
+ | `components/measured-grid` | `DEFAULT_MEASURED_GRID_LABELS`, `MeasuredGrid`, `useMeasuredRows`, _`MeasuredGridColumn`_, _`MeasuredGridLabels`_, _`MeasuredGridProps`_, _`MeasuredGridView`_, _`MeasuredRows`_, _`UseMeasuredRowsOptions`_ |
475
+ | `components/file-button` | `DEFAULT_FILE_PICKER_LABELS`, `FileButton`, `matchesAccept`, `useFilePicker`, _`FileButtonProps`_, _`FilePickerLabels`_, _`FileRejection`_, _`FileRejectionReason`_, _`FileScreenOptions`_, _`UseFilePickerOptions`_, _`UseFilePickerReturn`_ |
476
+ | `components/treemap` | `fitLabel`, `Treemap`, `TreemapCell`, _`TreemapCellProps`_, _`TreemapNode`_, _`TreemapProps`_ |
477
+ | `components/series-chart` | `AXIS_TICK_WIDTH`, `AXIS_TITLE_STRIP`, `axisBandWidth`, `mergeSeries`, `oneAxis`, `padBand`, `paddedDomain`, `SeriesChart`, `seriesKey`, `soleSeriesColor`, `StaticSeriesChart`, _`SeriesChartAxis`_, _`SeriesChartProps`_, _`SeriesChartSeries`_, _`SeriesChartSpan`_, _`SeriesChartX`_, _`SeriesSource`_ |
478
+ | `components/chart-zoom` | `DEFAULT_Y_AXIS`, `fitXToY`, `fitYToX`, `NO_ZOOM`, `selectionFromDrag`, `SharedXZoom`, `withChartZoom`, `ZOOM_MIN_DRAG`, `ZOOM_SQUARE_ENOUGH`, `zoomAfter`, `zoomAxesFor`, `zoomDomains`, _`ZoomAxes`_, _`ZoomBinding`_, _`ZoomDrag`_, _`ZoomFitSource`_, _`ZoomSelection`_, _`ZoomState`_, _`ZoomTarget`_ |
479
+ | `components/toggle-legend` | `LegendColumn`, `LegendGroup`, `STEP_DASH`, `STROKE_PATTERNS`, `strokeDash`, `toggleHidden`, `ToggleLegend`, _`LegendEntry`_, _`ToggleLegendProps`_ |
480
+ | `components/facing-pair` | `FACING_SIDES`, `facingAxes`, `facingBand`, `facingHeadingPad`, _`FacingSide`_ |
481
+ | `components/series-chart-labels` | `DEFAULT_SERIES_CHART_LABELS`, _`SeriesChartLabels`_ |
453
482
  | `components/account-settings` | `PasswordSetting`, `ProfileSetting`, `TwoFactorSetting`, _`PasswordSettingLabels`_, _`ProfileSettingLabels`_, _`TwoFactorSettingLabels`_ |
454
- | `components/alert-banner` | `AlertBanner`, `alertFrameClass`, `toneFrameClass`, _`AlertTone`_ |
455
- | `components/toggle-group` | `ToggleGroup` |
483
+ | `components/alert-banner` | `AlertBanner`, `alertFrameClass`, `toneFrameClass`, _`AlertBannerProps`_, _`AlertTone`_ |
484
+ | `components/toggle-group` | `ToggleGroup`, _`ToggleGroupBaseProps`_, _`ToggleGroupClearableProps`_, _`ToggleGroupProps`_, _`ToggleGroupRequiredProps`_, _`ToggleOption`_ |
456
485
  | `components/chip` | `Chip`, `ChipInput`, `DEFAULT_CHIP_INPUT_LABELS`, `resolveChipInputLabels`, _`ChipInputLabels`_, _`ChipInputProps`_, _`ChipProps`_, _`ChipSize`_, _`ChipTone`_ |
457
486
  | `components/wizard-stepper` | `WizardStepper` |
458
- | `components/hover-menu` | `HoverMenu` |
459
- | `components/modal` | `Modal`, `useBackdropClose`, _`ModalProps`_ |
460
- | `components/full-bleed-dialog` | `FullBleedDialog` |
461
- | `components/grouped-picker` | `GroupedPicker`, _`PickerGroup`_ |
462
- | `components/file-dropzone` | `FileDropzone` |
463
- | `components/mini-calendar` | `MiniCalendar`, _`MiniCalendarLabels`_, _`MiniCalendarProps`_ |
487
+ | `components/hover-menu` | `HoverMenu`, _`HoverMenuProps`_ |
488
+ | `components/modal` | `Modal`, `ModalCloseContext`, `useBackdropClose`, _`ModalProps`_ |
489
+ | `components/full-bleed-dialog` | `FullBleedDialog`, _`FullBleedDialogProps`_ |
490
+ | `components/grouped-picker` | `GroupedPicker`, _`GroupedPickerProps`_, _`PickerGroup`_ |
491
+ | `components/file-dropzone` | `FileDropzone`, _`FileDropzoneProps`_, _`FileDropzoneRejectionFeedback`_ |
492
+ | `components/mini-calendar` | `DEFAULT_MINI_CALENDAR_LABELS`, `MiniCalendar`, _`MiniCalendarLabels`_, _`MiniCalendarProps`_, _`WeekDay`_ |
464
493
  | `components/date-picker` | `DatePicker`, `DateRangePicker`, _`DatePickerProps`_, _`DateRangePickerPreset`_, _`DateRangePickerProps`_ |
465
494
  | `components/chart` | `ChartContainer`, `ChartLegend`, `ChartLegendContent`, `ChartTooltip`, `ChartTooltipContent`, `useChart`, _`ChartConfig`_, _`ChartSeriesConfig`_ |
466
495
  | `components/data-table-labels` | `DEFAULT_DATA_TABLE_LABELS`, `missingDataTableLabels`, `resolveDataTableLabels`, _`DataTableLabels`_ |
467
496
  | `components/data-table-sort` | `decodeSorts`, `encodeSorts`, `nextSorts`, `normalizeSorts`, _`SortDir`_, _`SortState`_ |
468
497
  | `components/data-table-filters` | `decodeFilterValue`, `decodeFilterValueOfType`, `defaultFilterState`, `encodeFilterValue`, `isFilterActive`, `resolveFilter`, `rowMatches`, _`ColumnFilter`_, _`FilterValue`_ |
469
- | `components/data-table` | `DataTable`, _`DataTableColumn`_, _`DataTableProps`_, _`FilterState`_, _`ServerPagination`_ |
498
+ | `components/data-table` | `DataTable`, _`DataTableColumn`_, _`DataTableProps`_, _`FilterState`_, _`MobileSwipeActions`_, _`ServerPagination`_ |
470
499
  | `components/data-table-pagination` | `PAGE_SIZE_OPTIONS`, `Pagination` |
471
500
  | `components/data-table-filter-popover` | `FilterPopover` |
472
- | `components/combobox-core` | _`ComboOption`_ |
501
+ | `components/combobox-core` | _`ComboClearValue`_, _`ComboOption`_ |
473
502
 
474
503
  ### shell
475
504
 
476
505
  | Module | Exports |
477
506
  |---|---|
478
507
  | `shell/topbar-controls` | `LanguageMenu`, `PaletteMenu`, `ThemeToggle`, `TOPBAR_MENU_ITEM_CLASS`, `TOPBAR_TRIGGER_CLASS`, _`LanguageOption`_ |
479
- | `shell/top-bar` | `TopBar` |
480
- | `shell/app-shell` | `AppShell`, _`AppShellNavItem`_, _`AppShellSubItem`_ |
508
+ | `shell/top-bar` | `TopBar`, _`TopBarProps`_ |
509
+ | `shell/app-shell` | `AppShell`, _`AppShellNavItem`_, _`AppShellProps`_, _`AppShellSubItem`_ |
481
510
  | `shell/option-switcher-menu` | `OptionSwitcherMenu`, _`OptionSwitcherOption`_ |
482
511
  | `shell/role-switcher` | `RoleSwitcher`, _`RoleSwitcherProps`_ |
483
512
  | `shell/topbar-action-menu` | `TopBarActionMenu`, _`TopBarMenuEntry`_ |
@@ -486,7 +515,7 @@ re-slicing of it, never a second API.
486
515
 
487
516
  | Module | Exports |
488
517
  |---|---|
489
- | `feedback/feedback-attachment` | `DEFAULT_ATTACHMENT_ACCEPT`, `DEFAULT_MAX_ATTACHMENT_BYTES`, `FeedbackAttachmentField`, `pastedName` |
518
+ | `feedback/feedback-attachment` | `DEFAULT_ATTACHMENT_ACCEPT`, `DEFAULT_FEEDBACK_ATTACHMENT_LABELS`, `DEFAULT_MAX_ATTACHMENT_BYTES`, `FeedbackAttachmentField`, `pastedName`, _`FeedbackAttachmentFieldLabels`_ |
490
519
  | `feedback/feedback-dialog` | `FeedbackDialog`, _`FeedbackAttachmentLabels`_, _`FeedbackCategoryOption`_, _`FeedbackDialogLabels`_, _`FeedbackSubmission`_ |
491
520
  | `feedback/feedback-inbox` | `FEEDBACK_CATEGORY_META`, `FEEDBACK_CATEGORY_ORDER`, `FEEDBACK_STATUS_META`, `FEEDBACK_STATUS_ORDER`, `FeedbackCategoryBadge`, `feedbackCategoryRank`, `FeedbackDetail`, `FeedbackDetailSection`, `FeedbackNoteEditor`, `FeedbackProse`, `FeedbackStatusBadge`, `FeedbackStatusTransitions`, `nextFeedbackStatus`, `selectableFeedbackStatuses`, `visibleFeedbackStatuses`, _`FeedbackCategory`_, _`FeedbackNoteAttachment`_, _`FeedbackStatus`_ |
492
521
 
@@ -506,13 +535,20 @@ re-slicing of it, never a second API.
506
535
 
507
536
  | Module | Exports |
508
537
  |---|---|
509
- | `tour/tour` | `TourProvider`, `useTour`, `useTourOptional`, _`TourLabels`_, _`TourPlacement`_, _`TourStep`_ |
538
+ | `tour/tour` | `DEFAULT_TOUR_LABELS`, `TourProvider`, `useTour`, `useTourOptional`, _`TourLabels`_, _`TourPlacement`_, _`TourStep`_ |
510
539
 
511
540
  ### search
512
541
 
513
542
  | Module | Exports |
514
543
  |---|---|
515
- | `search/command-palette` | `CommandPalette`, `useCommandKey`, _`CommandItem`_, _`CommandPaletteLabels`_ |
544
+ | `search/command-palette` | `CommandPalette`, `DEFAULT_COMMAND_PALETTE_LABELS`, `useCommandKey`, _`CommandItem`_, _`CommandPaletteLabels`_ |
545
+
546
+ ### i18n
547
+
548
+ | Module | Exports |
549
+ |---|---|
550
+ | `i18n/kit-labels` | `DEFAULT_APP_SHELL_LABELS`, `DEFAULT_CALCULATOR_LABELS`, `DEFAULT_COMBOBOX_LABELS`, `DEFAULT_COMMON_LABELS`, `DEFAULT_CURRENCY_LABELS`, `DEFAULT_DATE_PICKER_LABELS`, `DEFAULT_FILE_LABELS`, `DEFAULT_MULTI_SELECT_LABELS`, `DEFAULT_PICKER_SHEET_LABELS`, `DEFAULT_SWIPEABLE_ROW_LABELS`, `DEFAULT_TOP_BAR_LABELS`, `formatFileSize`, `missingKitLabels`, `UiKitProvider`, `useKitFileLabels`, `useKitLabelOverrides`, `useKitLabels`, `useKitLocale`, `useKitWeekStart`, _`AppShellLabels`_, _`CalculatorLabels`_, _`ComboboxLabels`_, _`CommonLabels`_, _`CurrencyLabels`_, _`DatePickerLabels`_, _`FileLabels`_, _`MultiSelectLabels`_, _`PickerSheetLabels`_, _`SwipeableRowLabels`_, _`TopBarLabels`_, _`UiKitLabelOverrides`_, _`UiKitLabels`_, _`UiKitProviderProps`_ |
551
+ | `i18n/defaults` | `DEFAULT_UI_KIT_LABELS` |
516
552
 
517
553
  <!-- END GENERATED: exports -->
518
554
 
package/dist/chart.d.ts CHANGED
@@ -8,3 +8,4 @@ export { FACING_SIDES, FacingSide, facingAxes, facingBand, facingHeadingPad } fr
8
8
  export { DEFAULT_SERIES_CHART_LABELS, SeriesChartLabels } from './components/series-chart-labels.js';
9
9
  import 'recharts';
10
10
  import 'react';
11
+ import './lib/direction.js';
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
3
+ import { useId, useState } from "react";
4
4
  import { Button, Card, FIELD_WRITABLE_LOOK, Input } from "./ui.js";
5
5
  import { UserAvatar } from "./user-avatar.js";
6
6
  import { DEFAULT_COMMON_LABELS, useKitLabels } from "../i18n/kit-labels.js";
@@ -16,6 +16,7 @@ function ProfileSetting({
16
16
  labels
17
17
  }) {
18
18
  const dirty = value.trim().length > 0 && value.trim() !== (name ?? "");
19
+ const inputId = useId();
19
20
  return /* @__PURE__ */ jsxs(Card, { className: "p-4 space-y-3", children: [
20
21
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
21
22
  /* @__PURE__ */ jsx(UserAvatar, { name, email, size: "lg" }),
@@ -33,7 +34,7 @@ function ProfileSetting({
33
34
  /* @__PURE__ */ jsx(
34
35
  Input,
35
36
  {
36
- id: "display-name",
37
+ id: inputId,
37
38
  label: labels.displayName,
38
39
  value,
39
40
  onChange: (e) => onChange(e.target.value),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/account-settings.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport { Button, Card, FIELD_WRITABLE_LOOK, Input } from \"./ui\";\nimport { UserAvatar } from \"./user-avatar\";\nimport { DEFAULT_COMMON_LABELS, useKitLabels } from \"../i18n/kit-labels\";\n\n/**\n * App-agnostic account-settings SECTIONS (feedback #333). The presentation lives\n * in @hb/ui; each app injects its own auth-API handlers + translated labels and\n * arranges these next to its own app-specific cards (appearance, budgets, …).\n * Every section is a self-contained <Card> owning its transient form state.\n */\n\nexport interface ProfileSettingLabels {\n title: string;\n email: string;\n role: string;\n memberSince: string;\n displayName: string;\n save: string;\n}\n\nexport function ProfileSetting({\n name,\n email,\n role,\n memberSince,\n value,\n onChange,\n onSave,\n saving,\n labels,\n}: {\n name?: string | null;\n email?: string | null;\n role?: ReactNode;\n memberSince?: ReactNode;\n value: string;\n onChange: (value: string) => void;\n onSave: () => void;\n saving?: boolean;\n labels: ProfileSettingLabels;\n}) {\n const dirty = value.trim().length > 0 && value.trim() !== (name ?? \"\");\n return (\n <Card className=\"p-4 space-y-3\">\n <div className=\"flex items-center gap-3\">\n <UserAvatar name={name} email={email} size=\"lg\" />\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium\">{labels.title}</div>\n <div className=\"truncate font-mono text-xs text-[var(--text-muted)]\">{email ?? \"—\"}</div>\n </div>\n </div>\n <div className=\"grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1 text-sm\">\n <span className=\"text-[var(--text-muted)]\">{labels.role}</span>\n <span>{role ?? \"—\"}</span>\n <span className=\"text-[var(--text-muted)]\">{labels.memberSince}</span>\n <span>{memberSince ?? \"—\"}</span>\n </div>\n <Input\n id=\"display-name\"\n label={labels.displayName}\n value={value}\n onChange={(e) => onChange(e.target.value)}\n maxLength={120}\n />\n <Button onClick={onSave} disabled={!dirty || saving}>\n {labels.save}\n </Button>\n </Card>\n );\n}\n\nexport interface PasswordSettingLabels {\n title: string;\n current: string;\n next: string;\n confirm: string;\n submit: string;\n tooShort: string;\n mismatch: string;\n}\n\nexport function PasswordSetting({\n onSubmit,\n pending,\n minLength = 8,\n labels,\n}: {\n /** Called with the validated (current, new) pair; return a promise to auto-clear on success. */\n onSubmit: (currentPassword: string, newPassword: string) => void | Promise<unknown>;\n pending?: boolean;\n minLength?: number;\n labels: PasswordSettingLabels;\n}) {\n const [current, setCurrent] = useState(\"\");\n const [next, setNext] = useState(\"\");\n const [confirm, setConfirm] = useState(\"\");\n const [error, setError] = useState<string | null>(null);\n\n const submit = async () => {\n if (next.length < minLength) {\n setError(labels.tooShort);\n return;\n }\n if (next !== confirm) {\n setError(labels.mismatch);\n return;\n }\n setError(null);\n try {\n await onSubmit(current, next);\n setCurrent(\"\");\n setNext(\"\");\n setConfirm(\"\");\n } catch {\n // The app surfaces the failure (e.g. a toast); keep the fields for a retry.\n }\n };\n\n return (\n <Card className=\"p-4 space-y-3\">\n <div className=\"text-sm font-medium\">{labels.title}</div>\n <Input type=\"password\" autoComplete=\"current-password\" label={labels.current} value={current} onChange={(e) => setCurrent(e.target.value)} />\n <Input type=\"password\" autoComplete=\"new-password\" label={labels.next} value={next} onChange={(e) => setNext(e.target.value)} />\n <Input type=\"password\" autoComplete=\"new-password\" label={labels.confirm} value={confirm} onChange={(e) => setConfirm(e.target.value)} />\n {error && <p className=\"text-xs text-[var(--danger)]\">{error}</p>}\n <Button onClick={() => void submit()} disabled={!current || !next || !confirm || pending}>\n {labels.submit}\n </Button>\n </Card>\n );\n}\n\nexport interface TwoFactorSettingLabels {\n status: string;\n enabledText: string;\n disabledText: string;\n enable: string;\n scanHint: string;\n codeLabel: string;\n verify: string;\n disableSection: string;\n password: string;\n disable: string;\n /**\n * Alt text for the setup QR image, which shipped as a hardcoded `alt=\"QR\"`.\n *\n * OPTIONAL, alone among these keys, and not because it matters less: this\n * interface is annotated at consumer call sites (`const LABELS:\n * TwoFactorSettingLabels = {…}`), so a new REQUIRED key is a compile error in\n * every app on the next `npm update` — the additive-API rule in the README. It\n * falls back to English here the way `AmountInput`'s label keys do. Make it\n * required in the next major, when the three apps can be updated with it.\n */\n qrAlt?: string;\n}\n\n/** `qrAlt`'s English fallback, kept beside the interface rather than inline so the\n * one English word in this section is findable by the same `DEFAULT_*` grep as\n * every other one. Module-private: the key goes required in the next major. */\nconst DEFAULT_QR_ALT = \"QR code\";\n\nexport function TwoFactorSetting({\n enabled,\n setup,\n onStartSetup,\n onEnable,\n onDisable,\n busy,\n labels,\n}: {\n enabled: boolean;\n /** QR + secret returned by the app's setup call; null before setup starts. */\n setup: { qrSvg: string; secret: string } | null;\n onStartSetup: () => void;\n onEnable: (code: string) => void;\n onDisable: (password: string, code: string) => void;\n busy?: boolean;\n labels: TwoFactorSettingLabels;\n}) {\n const [code, setCode] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n // Browsers autofill one-time-code fields with the saved username; keep the\n // field readOnly until focus to block that. It therefore has to keep the LOOK of\n // an editable field (FIELD_WRITABLE_LOOK): this is the one place where readOnly\n // does not mean \"you may not type here\", and without the opt-out the field would\n // sit there greyed until the moment it is focused.\n const [otpReadonly, setOtpReadonly] = useState(true);\n const onOtpFocus = () => setOtpReadonly(false);\n // Only for the \"Status: Enabled\" composition — the punctuation between a field's\n // name and its value is the language's (see `CommonLabels.fieldValue`).\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n\n return (\n <Card className=\"p-4 space-y-3\">\n <div className=\"text-sm\">\n {common.fieldValue(labels.status, enabled ? labels.enabledText : labels.disabledText)}\n </div>\n\n {!enabled && !setup && (\n <Button onClick={onStartSetup} disabled={busy}>\n {labels.enable}\n </Button>\n )}\n\n {setup && (\n <div className=\"space-y-2\">\n <div className=\"text-xs text-[var(--text-secondary)]\">{labels.scanHint}</div>\n {/* `bg-white`, NOT `--bg-surface`, and it must stay that way: a QR code is\n read by a camera looking for maximum contrast between the modules and\n their quiet zone. On the dark theme a surface-coloured backing makes it\n slow to acquire, and on a warm light preset it lowers the contrast ratio\n the spec is written against. This is the one place in the kit where a\n literal colour is the correct answer. */}\n <div className=\"inline-block rounded-md bg-white p-2\">\n <img\n alt={labels.qrAlt ?? DEFAULT_QR_ALT}\n src={`data:image/svg+xml;base64,${setup.qrSvg}`}\n className=\"h-48 w-48\"\n />\n </div>\n <div className=\"break-all font-mono text-xs\">{setup.secret}</div>\n <Input\n inputMode=\"numeric\"\n autoComplete=\"one-time-code\"\n readOnly={otpReadonly}\n inputClassName={FIELD_WRITABLE_LOOK}\n onFocus={onOtpFocus}\n maxLength={8}\n label={labels.codeLabel}\n value={code}\n onChange={(e) => setCode(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && code && !busy) {\n e.preventDefault();\n onEnable(code);\n }\n }}\n />\n <Button onClick={() => onEnable(code)} disabled={!code || busy}>\n {labels.verify}\n </Button>\n </div>\n )}\n\n {enabled && (\n <div className=\"space-y-3 border-t border-[var(--border)] pt-3\">\n <div className=\"text-sm font-medium\">{labels.disableSection}</div>\n <Input type=\"password\" autoComplete=\"current-password\" label={labels.password} value={password} onChange={(e) => setPassword(e.target.value)} />\n <Input\n inputMode=\"numeric\"\n autoComplete=\"one-time-code\"\n readOnly={otpReadonly}\n inputClassName={FIELD_WRITABLE_LOOK}\n onFocus={onOtpFocus}\n maxLength={8}\n label={labels.codeLabel}\n value={code}\n onChange={(e) => setCode(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && password && code && !busy) {\n e.preventDefault();\n onDisable(password, code);\n }\n }}\n />\n <Button variant=\"danger\" onClick={() => onDisable(password, code)} disabled={!password || !code || busy}>\n {labels.disable}\n </Button>\n </div>\n )}\n </Card>\n );\n}\n"],"mappings":";AA+CQ,cACA,YADA;AA/CR,SAAS,gBAAgB;AAEzB,SAAS,QAAQ,MAAM,qBAAqB,aAAa;AACzD,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB,oBAAoB;AAkB7C,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAUG;AACD,QAAM,QAAQ,MAAM,KAAK,EAAE,SAAS,KAAK,MAAM,KAAK,OAAO,QAAQ;AACnE,SACE,qBAAC,QAAK,WAAU,iBACd;AAAA,yBAAC,SAAI,WAAU,2BACb;AAAA,0BAAC,cAAW,MAAY,OAAc,MAAK,MAAK;AAAA,MAChD,qBAAC,SAAI,WAAU,WACb;AAAA,4BAAC,SAAI,WAAU,uBAAuB,iBAAO,OAAM;AAAA,QACnD,oBAAC,SAAI,WAAU,uDAAuD,mBAAS,UAAI;AAAA,SACrF;AAAA,OACF;AAAA,IACA,qBAAC,SAAI,WAAU,4DACb;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,MACF;AAAA,MACA,oBAAC,UAAO,SAAQ,UAAS,SAAS,MAAM,UAAU,UAAU,IAAI,GAAG,UAAU,CAAC,YAAY,CAAC,QAAQ,MAChG,iBAAO,SACV;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/account-settings.tsx"],"sourcesContent":["import { useId, useState } from \"react\";\nimport type { KeyboardEvent, ReactNode } from \"react\";\nimport { Button, Card, FIELD_WRITABLE_LOOK, Input } from \"./ui\";\nimport { UserAvatar } from \"./user-avatar\";\nimport { DEFAULT_COMMON_LABELS, useKitLabels } from \"../i18n/kit-labels\";\n\n/**\n * App-agnostic account-settings SECTIONS (feedback #333). The presentation lives\n * in @hb/ui; each app injects its own auth-API handlers + translated labels and\n * arranges these next to its own app-specific cards (appearance, budgets, …).\n * Every section is a self-contained <Card> owning its transient form state.\n */\n\nexport interface ProfileSettingLabels {\n title: string;\n email: string;\n role: string;\n memberSince: string;\n displayName: string;\n save: string;\n}\n\nexport function ProfileSetting({\n name,\n email,\n role,\n memberSince,\n value,\n onChange,\n onSave,\n saving,\n labels,\n}: {\n name?: string | null;\n email?: string | null;\n role?: ReactNode;\n memberSince?: ReactNode;\n value: string;\n onChange: (value: string) => void;\n onSave: () => void;\n saving?: boolean;\n labels: ProfileSettingLabels;\n}) {\n const dirty = value.trim().length > 0 && value.trim() !== (name ?? \"\");\n // Generated, not the literal \"display-name\" it was: two of these on one page (an\n // admin editing someone else's profile beside their own) shared an id, and the\n // second label pointed at the first field.\n const inputId = useId();\n return (\n <Card className=\"p-4 space-y-3\">\n <div className=\"flex items-center gap-3\">\n <UserAvatar name={name} email={email} size=\"lg\" />\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium\">{labels.title}</div>\n <div className=\"truncate font-mono text-xs text-[var(--text-muted)]\">{email ?? \"—\"}</div>\n </div>\n </div>\n <div className=\"grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1 text-sm\">\n <span className=\"text-[var(--text-muted)]\">{labels.role}</span>\n <span>{role ?? \"—\"}</span>\n <span className=\"text-[var(--text-muted)]\">{labels.memberSince}</span>\n <span>{memberSince ?? \"—\"}</span>\n </div>\n <Input\n id={inputId}\n label={labels.displayName}\n value={value}\n onChange={(e) => onChange(e.target.value)}\n maxLength={120}\n />\n <Button onClick={onSave} disabled={!dirty || saving}>\n {labels.save}\n </Button>\n </Card>\n );\n}\n\nexport interface PasswordSettingLabels {\n title: string;\n current: string;\n next: string;\n confirm: string;\n submit: string;\n tooShort: string;\n mismatch: string;\n}\n\nexport function PasswordSetting({\n onSubmit,\n pending,\n minLength = 8,\n labels,\n}: {\n /** Called with the validated (current, new) pair; return a promise to auto-clear on success. */\n onSubmit: (currentPassword: string, newPassword: string) => void | Promise<unknown>;\n pending?: boolean;\n minLength?: number;\n labels: PasswordSettingLabels;\n}) {\n const [current, setCurrent] = useState(\"\");\n const [next, setNext] = useState(\"\");\n const [confirm, setConfirm] = useState(\"\");\n const [error, setError] = useState<string | null>(null);\n\n const submit = async () => {\n if (next.length < minLength) {\n setError(labels.tooShort);\n return;\n }\n if (next !== confirm) {\n setError(labels.mismatch);\n return;\n }\n setError(null);\n try {\n await onSubmit(current, next);\n setCurrent(\"\");\n setNext(\"\");\n setConfirm(\"\");\n } catch {\n // The app surfaces the failure (e.g. a toast); keep the fields for a retry.\n }\n };\n\n return (\n <Card className=\"p-4 space-y-3\">\n <div className=\"text-sm font-medium\">{labels.title}</div>\n <Input type=\"password\" autoComplete=\"current-password\" label={labels.current} value={current} onChange={(e) => setCurrent(e.target.value)} />\n <Input type=\"password\" autoComplete=\"new-password\" label={labels.next} value={next} onChange={(e) => setNext(e.target.value)} />\n <Input type=\"password\" autoComplete=\"new-password\" label={labels.confirm} value={confirm} onChange={(e) => setConfirm(e.target.value)} />\n {error && <p className=\"text-xs text-[var(--danger)]\">{error}</p>}\n <Button onClick={() => void submit()} disabled={!current || !next || !confirm || pending}>\n {labels.submit}\n </Button>\n </Card>\n );\n}\n\nexport interface TwoFactorSettingLabels {\n status: string;\n enabledText: string;\n disabledText: string;\n enable: string;\n scanHint: string;\n codeLabel: string;\n verify: string;\n disableSection: string;\n password: string;\n disable: string;\n /**\n * Alt text for the setup QR image, which shipped as a hardcoded `alt=\"QR\"`.\n *\n * OPTIONAL, alone among these keys, and not because it matters less: this\n * interface is annotated at consumer call sites (`const LABELS:\n * TwoFactorSettingLabels = {…}`), so a new REQUIRED key is a compile error in\n * every app on the next `npm update` — the additive-API rule in the README. It\n * falls back to English here the way `AmountInput`'s label keys do. Make it\n * required in the next major, when the three apps can be updated with it.\n */\n qrAlt?: string;\n}\n\n/** `qrAlt`'s English fallback, kept beside the interface rather than inline so the\n * one English word in this section is findable by the same `DEFAULT_*` grep as\n * every other one. Module-private: the key goes required in the next major. */\nconst DEFAULT_QR_ALT = \"QR code\";\n\nexport function TwoFactorSetting({\n enabled,\n setup,\n onStartSetup,\n onEnable,\n onDisable,\n busy,\n labels,\n}: {\n enabled: boolean;\n /** QR + secret returned by the app's setup call; null before setup starts. */\n setup: { qrSvg: string; secret: string } | null;\n onStartSetup: () => void;\n onEnable: (code: string) => void;\n onDisable: (password: string, code: string) => void;\n busy?: boolean;\n labels: TwoFactorSettingLabels;\n}) {\n const [code, setCode] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n // Browsers autofill one-time-code fields with the saved username; keep the\n // field readOnly until focus to block that. It therefore has to keep the LOOK of\n // an editable field (FIELD_WRITABLE_LOOK): this is the one place where readOnly\n // does not mean \"you may not type here\", and without the opt-out the field would\n // sit there greyed until the moment it is focused.\n const [otpReadonly, setOtpReadonly] = useState(true);\n const onOtpFocus = () => setOtpReadonly(false);\n // Only for the \"Status: Enabled\" composition — the punctuation between a field's\n // name and its value is the language's (see `CommonLabels.fieldValue`).\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n\n return (\n <Card className=\"p-4 space-y-3\">\n <div className=\"text-sm\">\n {common.fieldValue(labels.status, enabled ? labels.enabledText : labels.disabledText)}\n </div>\n\n {!enabled && !setup && (\n <Button onClick={onStartSetup} disabled={busy}>\n {labels.enable}\n </Button>\n )}\n\n {setup && (\n <div className=\"space-y-2\">\n <div className=\"text-xs text-[var(--text-secondary)]\">{labels.scanHint}</div>\n {/* `bg-white`, NOT `--bg-surface`, and it must stay that way: a QR code is\n read by a camera looking for maximum contrast between the modules and\n their quiet zone. On the dark theme a surface-coloured backing makes it\n slow to acquire, and on a warm light preset it lowers the contrast ratio\n the spec is written against. This is the one place in the kit where a\n literal colour is the correct answer. */}\n <div className=\"inline-block rounded-md bg-white p-2\">\n <img\n alt={labels.qrAlt ?? DEFAULT_QR_ALT}\n src={`data:image/svg+xml;base64,${setup.qrSvg}`}\n className=\"h-48 w-48\"\n />\n </div>\n <div className=\"break-all font-mono text-xs\">{setup.secret}</div>\n <Input\n inputMode=\"numeric\"\n autoComplete=\"one-time-code\"\n readOnly={otpReadonly}\n inputClassName={FIELD_WRITABLE_LOOK}\n onFocus={onOtpFocus}\n maxLength={8}\n label={labels.codeLabel}\n value={code}\n onChange={(e) => setCode(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && code && !busy) {\n e.preventDefault();\n onEnable(code);\n }\n }}\n />\n <Button onClick={() => onEnable(code)} disabled={!code || busy}>\n {labels.verify}\n </Button>\n </div>\n )}\n\n {enabled && (\n <div className=\"space-y-3 border-t border-[var(--border)] pt-3\">\n <div className=\"text-sm font-medium\">{labels.disableSection}</div>\n <Input type=\"password\" autoComplete=\"current-password\" label={labels.password} value={password} onChange={(e) => setPassword(e.target.value)} />\n <Input\n inputMode=\"numeric\"\n autoComplete=\"one-time-code\"\n readOnly={otpReadonly}\n inputClassName={FIELD_WRITABLE_LOOK}\n onFocus={onOtpFocus}\n maxLength={8}\n label={labels.codeLabel}\n value={code}\n onChange={(e) => setCode(e.target.value)}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && password && code && !busy) {\n e.preventDefault();\n onDisable(password, code);\n }\n }}\n />\n <Button variant=\"danger\" onClick={() => onDisable(password, code)} disabled={!password || !code || busy}>\n {labels.disable}\n </Button>\n </div>\n )}\n </Card>\n );\n}\n"],"mappings":";AAmDQ,cACA,YADA;AAnDR,SAAS,OAAO,gBAAgB;AAEhC,SAAS,QAAQ,MAAM,qBAAqB,aAAa;AACzD,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB,oBAAoB;AAkB7C,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAUG;AACD,QAAM,QAAQ,MAAM,KAAK,EAAE,SAAS,KAAK,MAAM,KAAK,OAAO,QAAQ;AAInE,QAAM,UAAU,MAAM;AACtB,SACE,qBAAC,QAAK,WAAU,iBACd;AAAA,yBAAC,SAAI,WAAU,2BACb;AAAA,0BAAC,cAAW,MAAY,OAAc,MAAK,MAAK;AAAA,MAChD,qBAAC,SAAI,WAAU,WACb;AAAA,4BAAC,SAAI,WAAU,uBAAuB,iBAAO,OAAM;AAAA,QACnD,oBAAC,SAAI,WAAU,uDAAuD,mBAAS,UAAI;AAAA,SACrF;AAAA,OACF;AAAA,IACA,qBAAC,SAAI,WAAU,4DACb;AAAA,0BAAC,UAAK,WAAU,4BAA4B,iBAAO,MAAK;AAAA,MACxD,oBAAC,UAAM,kBAAQ,UAAI;AAAA,MACnB,oBAAC,UAAK,WAAU,4BAA4B,iBAAO,aAAY;AAAA,MAC/D,oBAAC,UAAM,yBAAe,UAAI;AAAA,OAC5B;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,IAAI;AAAA,QACJ,OAAO,OAAO;AAAA,QACd;AAAA,QACA,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,QACxC,WAAW;AAAA;AAAA,IACb;AAAA,IACA,oBAAC,UAAO,SAAS,QAAQ,UAAU,CAAC,SAAS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QAAQ,CAAC,MAAM;AACtC,gBAAE,eAAe;AACjB,uBAAS,IAAI;AAAA,YACf;AAAA,UACF;AAAA;AAAA,MACF;AAAA,MACA,oBAAC,UAAO,SAAS,MAAM,SAAS,IAAI,GAAG,UAAU,CAAC,QAAQ,MACvD,iBAAO,QACV;AAAA,OACF;AAAA,IAGD,WACC,qBAAC,SAAI,WAAU,kDACb;AAAA,0BAAC,SAAI,WAAU,uBAAuB,iBAAO,gBAAe;AAAA,MAC5D,oBAAC,SAAM,MAAK,YAAW,cAAa,oBAAmB,OAAO,OAAO,UAAU,OAAO,UAAU,UAAU,CAAC,MAAM,YAAY,EAAE,OAAO,KAAK,GAAG;AAAA,MAC9I;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,cAAa;AAAA,UACb,UAAU;AAAA,UACV,gBAAgB;AAAA,UAChB,SAAS;AAAA,UACT,WAAW;AAAA,UACX,OAAO,OAAO;AAAA,UACd,OAAO;AAAA,UACP,UAAU,CAAC,MAAM,QAAQ,EAAE,OAAO,KAAK;AAAA,UACvC,WAAW,CAAC,MAAuC;AACjD,gBAAI,EAAE,QAAQ,WAAW,YAAY,QAAQ,CAAC,MAAM;AAClD,gBAAE,eAAe;AACjB,wBAAU,UAAU,IAAI;AAAA,YAC1B;AAAA,UACF;AAAA;AAAA,MACF;AAAA,MACA,oBAAC,UAAO,SAAQ,UAAS,SAAS,MAAM,UAAU,UAAU,IAAI,GAAG,UAAU,CAAC,YAAY,CAAC,QAAQ,MAChG,iBAAO,SACV;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
@@ -27,6 +27,9 @@ import './icon-picker.js';
27
27
  import './dialog-frame.js';
28
28
  import './modal.js';
29
29
  import './file-button.js';
30
+ import './measured-grid.js';
31
+ import '../feedback/feedback-attachment.js';
32
+ import '../feedback/feedback-dialog.js';
30
33
 
31
34
  interface AmountInputProps {
32
35
  value: string;
@@ -131,11 +131,11 @@ const AmountInput = forwardRef(
131
131
  // chevron, ~58px) rather than the 5rem the boxed shape reserves. On a
132
132
  // 375px screen those 16px are the difference between a readable figure
133
133
  // and a clipped one (feedback #430 rework).
134
- asDisplay ? currency ? editable ? "pr-16" : "pr-12" : "pr-0" : showCalc ? currency ? editable ? "pr-24" : "pr-16" : "pr-10" : currency ? editable ? "pr-20" : "pr-14" : "pr-3",
134
+ asDisplay ? currency ? editable ? "pe-16" : "pe-12" : "pe-0" : showCalc ? currency ? editable ? "pe-24" : "pe-16" : "pe-10" : currency ? editable ? "pe-20" : "pe-14" : "pe-3",
135
135
  // Centred display shape: centre in what is LEFT of the currency chip.
136
136
  // `text-center` alone would centre the figure in the whole box, i.e.
137
137
  // partly underneath the chip; the padding above is what takes the chip
138
- // out of the centring, and nothing is added on the left because a
138
+ // out of the centring, and nothing is added at the start because a
139
139
  // mirrored reservation would spend the width twice (see `align`).
140
140
  asDisplay && align === "center" && "text-center",
141
141
  // Last, so it wins over the base class's own text colour.
@@ -155,7 +155,9 @@ const AmountInput = forwardRef(
155
155
  {
156
156
  className: cn(
157
157
  "absolute flex items-center gap-0.5",
158
- asDisplay ? "bottom-1 right-0" : "inset-y-1 right-1"
158
+ // Logical `end-*`: the chip and the calculator are the figure's trailing
159
+ // controls, so a right-to-left form carries them on the left.
160
+ asDisplay ? "bottom-1 end-0" : "inset-y-1 end-1"
159
161
  ),
160
162
  children: [
161
163
  showCalc && /* @__PURE__ */ jsx(
@@ -230,7 +232,7 @@ const AmountInput = forwardRef(
230
232
  setOpen(false);
231
233
  },
232
234
  className: cn(
233
- "flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-[var(--bg-hover)]",
235
+ "flex w-full items-center gap-2 px-3 py-1.5 text-sm text-start hover:bg-[var(--bg-hover)]",
234
236
  active && "bg-[var(--bg-active)]"
235
237
  ),
236
238
  children: [
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/amount-input.tsx"],"sourcesContent":["import { forwardRef, useCallback, useId, useMemo, useRef, useState } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport { CURRENCIES, CurrencyFlag, currencyName, getCurrency } from \"./currency-select\";\nimport { FIELD_BASE, FIELD_DISPLAY, FIELD_INVALID, FLOATING_INPUT_CLASS, FLOATING_LABEL_CLASS, PHONE_QUERY } from \"./ui\";\nimport { cn } from \"../lib/cn\";\nimport { useMediaQuery } from \"../hooks/use-media-query\";\nimport { CalculatorButton, type CalculatorButtonLabels } from \"./calculator\";\nimport { NumberPadSheet, type NumberPadSheetLabels } from \"./numpad-sheet\";\nimport { DropdownPanel, DropdownSearchHeader, useDropdownSearch } from \"./dropdown\";\nimport {\n DEFAULT_COMMON_LABELS,\n DEFAULT_CURRENCY_LABELS,\n useKitLabels,\n useKitLocale,\n type CurrencyLabels,\n} from \"../i18n/kit-labels\";\nimport {\n commitExpression,\n evaluateExpression,\n formatResult,\n isBareAmount,\n looksLikeExpression,\n sanitizeLive,\n splitLeadingSign,\n} from \"../lib/calc\";\n\ninterface AmountInputProps {\n value: string;\n onChange: (value: string) => void;\n currency?: string;\n onCurrencyChange?: (code: string) => void;\n placeholder?: string;\n label?: ReactNode;\n disabled?: boolean;\n /** Required and unanswered — {@link FIELD_INVALID}. See {@link Input}'s `invalid`. */\n invalid?: boolean;\n className?: string;\n id?: string;\n ariaLabel?: string;\n /** Every user-facing string this component and the two it composes own, so a\n * translating host can supply its own. Each key optional, and each a per-field\n * override of the kit-wide translation in `<UiKitProvider labels>`: `currency`\n * and `currencySearch` of its `currency` namespace, the rest of `calculator`.\n * `currency` names the picker chip, composed with the selected code through\n * `common.fieldValue`; the rest are pass-through. */\n labels?: {\n currency?: string;\n currencySearch?: string;\n /** Names the calculator TRIGGER this component renders. `calculator` below\n * names the controls inside the popover it opens. */\n calculatorTrigger?: string;\n pad?: NumberPadSheetLabels;\n calculator?: CalculatorButtonLabels;\n };\n /** Translated currency names for the chip's picker, keyed by ISO code. The same\n * sparse override `CurrencySelect` takes, and for the same reason: the names in\n * `CURRENCIES` are shipped data, so without this they are the one English word\n * left in a translated row. Not part of `labels` because it is keyed by DATA\n * rather than by a fixed set of slots, and an app passes the same map to both\n * pickers. */\n currencyNames?: Record<string, string>;\n /** Focus the field on mount — on mobile this also opens the numpad sheet, so a\n * new-transaction form can jump straight to amount entry (feedback #70). */\n autoFocus?: boolean;\n /**\n * Tint the typed figure by what it will DO (Keksdose feedback #167).\n *\n * The direction is chosen with a toggle beside the field rather than typed, so\n * the digits alone say nothing about which way the money goes — on the one screen\n * where getting that backwards is the expensive mistake. Colour says it\n * continuously, and it costs no layout. It stays the MAIN indication (live #201\n * rework: *\"The main indication shall still be the color\"*); {@link negative}\n * renders the sign as a second, quieter signal in front of the figure.\n *\n * Never the ONLY signal: the toggle it mirrors is right there, labelled, so this\n * is reinforcement rather than the sole carrier of the meaning.\n */\n tone?: \"neutral\" | \"outflow\" | \"inflow\";\n /**\n * The SIGN of the figure, owned by the caller's direction control (Keksdose live\n * #201 rework: *\"Outflow should be negative and inflow positive … the sign shall\n * be displayed but not necessarily be typed in\"*).\n *\n * `value` stays the MAGNITUDE. The minus is glued on at render time and stripped\n * off again before anything is reported back, so the caller never sees its own\n * prefix echoed and no code path can end up applying it twice. That is the whole\n * cure: there is exactly ONE place the sign lives, and it is not the text.\n *\n * Because it is rendered rather than stored it cannot be deleted (the next render\n * puts it back), a select-all-and-retype keeps the direction, and the caret needs\n * no minding.\n */\n negative?: boolean;\n /**\n * A sign the user TYPED, or a calculation that resolved to a signed number.\n *\n * SET, never flip. A \"-\" means *\"this is an outflow\"*, so typing it twice says the\n * same thing twice — which is exactly what the rework asks for (*\"Subtracting\n * values twice resulting in inflow -> outflow and back to inflow seems not\n * reasonable\"*). \"+\" says the other direction.\n *\n * Its presence is what ARMS the whole sign behaviour. A field with no direction\n * control — an account's starting balance, a loan payment, a holding's cost —\n * passes neither prop and keeps a text that is the whole truth, minus included.\n */\n onNegativeChange?: (negative: boolean) => void;\n /**\n * How the field presents itself ON A PHONE (Keksdose feedback #176).\n *\n * `\"field\"` (default) is the labelled, bordered input used everywhere else.\n *\n * `\"display\"` keeps every mechanic — the same `<input>`, the same numpad sheet,\n * the same currency picker, the same commit/blur contract — and only drops the\n * chrome: no border, no fill, no floating label, the figure set at display size.\n * On a form whose whole point is one number, a bordered `text-sm` box draws the\n * amount at the same weight as the memo beside it; this makes it the headline\n * instead. It stays fully editable — the underline and the caret are what say so.\n *\n * Phone-only by construction: it keys off the same breakpoint as the numpad, so\n * from `md` up the field is byte-for-byte the normal one and a desktop grid keeps\n * its column rhythm.\n */\n variant?: \"field\" | \"display\";\n /**\n * Where the figure sits in its row, for `variant=\"display\"` only (Keksdose\n * feedback #176 rework).\n *\n * `\"start\"` (default) keeps it flush left, in the reading column the fields\n * below it share — and it is what the entry forms use, because a figure that\n * starts at a known edge is legible at any width: when the value outgrows the\n * field, the digits that scroll out of sight are the trailing ones, not the\n * magnitude (Keksdose feedback #430 rework).\n *\n * `\"center\"` makes it a centred headline. It centres in the width that REMAINS\n * after the trailing currency control, not in the whole box: the control is\n * pinned to the right edge, so a plain `text-center` would centre the figure\n * under it and the last digits would sit behind the chip. This used to mirror\n * the control's reservation onto the left instead, which centred correctly but\n * spent twice the control's width on padding — fatal on a 375px screen, where\n * it left a 36px figure 16px to live in.\n */\n align?: \"start\" | \"center\";\n}\n\n// The consuming app's ONE money palette (`--money-expense` / `--money-income`),\n// not a bespoke rose/emerald pairing: a figure being typed has to wear the same\n// colour the same figure will wear once it is a row in the table behind the form\n// (Keksdose dev#434). The utilities are unlayered and theme-aware, so no `dark:`\n// variant is needed and they win over the field's own text colour regardless of\n// where `cn` puts them.\nconst TONE_CLASS: Record<\"neutral\" | \"outflow\" | \"inflow\", string> = {\n neutral: \"\",\n outflow: \"text-money-neg\",\n inflow: \"text-money-pos\",\n};\n\n// The shared chrome-less treatment at money size. `tabular-nums` so digits don't\n// reflow the figure as they are typed; FIELD_DISPLAY's own muted placeholder\n// colour is what keeps an EMPTY form from painting its zero in the direction tint\n// (`tone` is computed from 0, which reads as an inflow).\nconst DISPLAY_INPUT_CLASS = cn(\n FIELD_DISPLAY,\n \"text-4xl font-semibold leading-tight tracking-tight tabular-nums\",\n);\n\n/**\n * Is `text` the ANSWER to `previous`, or something typed OVER it?\n *\n * \"The old text was a sum and the new one is bare\" cannot tell those apart, and both\n * gestures are ordinary: select-all-and-retype after a typo, or backspacing \"-20+\"\n * back down to a fresh figure. Read as an answer, they move the direction chip — so\n * an outflow of 7 quietly booked +7.00 (live #201 rework).\n *\n * The question that does separate them is arithmetic, not shape: evaluate what the\n * text replaced and see whether this IS that number. \"-12+30\" → \"18\" still is, so a\n * sum that comes out positive still takes the chip with it; \"-20+50\" → \"7\" is not,\n * and \"-20+\" evaluates to nothing at all.\n */\nfunction isResultOf(previous: string, text: string): boolean {\n const n = evaluateExpression(previous);\n return n !== null && formatResult(n) === text.trim();\n}\n\nexport const AmountInput = forwardRef<HTMLInputElement, AmountInputProps>(\n ({ value, onChange, currency, onCurrencyChange, placeholder, label, disabled, invalid, className, id, ariaLabel, autoFocus, tone = \"neutral\", negative = false, onNegativeChange, variant = \"field\", align = \"start\", labels, currencyNames }, ref) => {\n const generatedId = useId();\n const fieldId = id ?? generatedId;\n const editable = !!onCurrencyChange;\n // On phones we suppress the OS keyboard (inputMode=\"none\" below) and show our\n // own calculator numpad, so the desktop popover trigger is hidden. The\n // right-padding keys off showCalc, so it tightens up automatically.\n const isMobile = useMediaQuery(PHONE_QUERY, false);\n const showCalc = !disabled && !isMobile;\n const [focused, setFocused] = useState(false);\n // On mobile, focusing the field opens the numpad bottom sheet in place of the\n // native keyboard (feedback #334) — a full calculator keypad, not just the old\n // operator bar. An internal ref lets the sheet's \"Done\" blur the input, which\n // commits + closes via the existing onBlur handler.\n const showNumpad = isMobile && !disabled && focused;\n // Gate the display treatment on the SAME `isMobile` the numpad uses rather than\n // on `max-md:` classes, so the two can never drift apart on the breakpoint —\n // and so the two shapes are separate class strings instead of one string\n // fighting itself through responsive overrides. `useMediaQuery` reads\n // synchronously on mount, so there is no field→figure flash.\n const asDisplay = variant === \"display\" && isMobile;\n const innerRef = useRef<HTMLInputElement>(null);\n const setRefs = useCallback(\n (el: HTMLInputElement | null) => {\n innerRef.current = el;\n if (typeof ref === \"function\") ref(el);\n else if (ref) ref.current = el;\n },\n [ref],\n );\n // The sign is DISPLAYED, not stored (live #201 rework). `value` is the\n // magnitude; the minus is glued on here and taken off again in handleText, so\n // the two can never disagree and the caller can never double-apply it. Only in\n // front of a bare amount: an expression being typed (\"12-30\") owns its own\n // minus and has to survive keystroke-for-keystroke.\n const signOwned = onNegativeChange !== undefined;\n const shown = signOwned && negative && isBareAmount(value) ? `-${value}` : value;\n // Every route into the field — typing, the numpad sheet, the desktop\n // calculator, the blur/Enter commit — funnels through here, so the split is\n // written once and the four entry paths cannot drift.\n //\n // `previous` is the text this one REPLACES, and it is what says whether a bare\n // figure arriving here is an answer or a magnitude. For the three paths that\n // edit the field's own text that is simply what the field was showing; the\n // desktop calculator keeps its expression in a popover the field never sees,\n // so it passes it in (see `CalculatorButton`'s `onChange`).\n const handleText = (raw: string, previous: string = shown) => {\n const text = sanitizeLive(raw);\n if (!signOwned) {\n onChange(text);\n return;\n }\n const { sign, rest } = splitLeadingSign(text);\n if (sign) {\n // SET, not flip: re-reporting the same sign on every keystroke is a no-op.\n onNegativeChange(sign === \"-\");\n } else if (looksLikeExpression(previous) && isBareAmount(text) && isResultOf(previous, text)) {\n // A calculation that just RESOLVED states its sign in both directions. The\n // figure it ran on is the SIGNED one the user could see — \"-12+30\" is +18 —\n // so a positive result has to move the chip too, or the field would answer\n // that sum with \"-18\" and contradict the arithmetic it just showed.\n //\n // Only when it really resolved, though: see {@link isResultOf}. A bare figure\n // arriving on top of an expression is far more often a replacement than an\n // answer, and reading it as an answer flips the direction of money.\n onNegativeChange(false);\n }\n onChange(sign ? rest : text);\n };\n const commit = () => handleText(commitExpression(shown));\n const { open, setOpen, wrapperRef, panelRef, query, setQuery, inputRef } = useDropdownSearch();\n // The chip the currency list hangs off (Keksdose dev#548). It is portalled now, so\n // the panel needs a real trigger rect rather than a relative parent — see\n // `DropdownPanel`'s note for what an `overflow` ancestor did to it before.\n const chipRef = useRef<HTMLButtonElement>(null);\n\n // The currency chip's strings are the `currency` namespace — the same two\n // `CurrencySelect` resolves, under this component's older key names. The\n // calculator and the numpad resolve `calculator` themselves; `labels.calculator`\n // and `labels.pad` are handed straight through to them as overrides.\n const currencyOverrides = useMemo(() => {\n const out: Partial<CurrencyLabels> = {};\n if (labels?.currency !== undefined) out.currency = labels.currency;\n if (labels?.currencySearch !== undefined) out.search = labels.currencySearch;\n return out;\n }, [labels?.currency, labels?.currencySearch]);\n const currencyText = useKitLabels(\"currency\", DEFAULT_CURRENCY_LABELS, currencyOverrides);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const locale = useKitLocale();\n\n const selected = getCurrency(currency);\n const filtered = useMemo(() => {\n const q = query.trim().toLocaleLowerCase(locale);\n if (!q) return CURRENCIES;\n return CURRENCIES.filter(\n (c) =>\n c.code.toLowerCase().includes(q) ||\n // The name the row SHOWS, so a translated list is searchable in the\n // language it is written in.\n currencyName(c, currencyNames, locale).toLocaleLowerCase(locale).includes(q) ||\n c.symbol.toLowerCase().includes(q),\n );\n }, [query, currencyNames, locale]);\n\n return (\n <div ref={wrapperRef} className={cn(\"w-full\", className)}>\n {/* Inner relative box holds the input + its absolutely-positioned\n trailing controls (calculator / currency), so those stay anchored to\n the INPUT even when the mobile math bar is rendered below (#334). */}\n <div className=\"relative w-full\">\n <input\n ref={setRefs}\n id={fieldId}\n aria-label={ariaLabel}\n type=\"text\"\n // eslint-disable-next-line jsx-a11y/no-autofocus -- opt-in per call site (feedback #70)\n autoFocus={autoFocus}\n // On mobile suppress the OS keyboard so our numpad sheet owns entry; the\n // field keeps focus/caret. Desktop keeps the native decimal keypad.\n inputMode={isMobile ? \"none\" : \"decimal\"}\n autoComplete=\"off\"\n disabled={disabled}\n // The floating-label pattern needs a blank placeholder for its\n // peer-placeholder-shown trick. The display shape has no floating label,\n // so it spends the placeholder on what an empty borderless form actually\n // needs: a zero to aim at, at full size. The caller supplies it because\n // only the app knows the locale's decimal separator.\n placeholder={asDisplay ? (placeholder ?? \"0\") : label !== undefined ? \" \" : placeholder}\n value={shown}\n onChange={(e) => handleText(e.target.value)}\n onFocus={() => setFocused(true)}\n onBlur={() => {\n commit();\n setFocused(false);\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") commit();\n }}\n className={cn(\n // With a label, use the floating-input padding (pt-4 pb-1) like every\n // other labelled field so the value sits BELOW the floated label rather\n // than vertically centred where it overlaps the resting label\n // (feedback #314). FLOATING_INPUT_CLASS already bundles the peer +\n // transparent-placeholder bits.\n asDisplay ? DISPLAY_INPUT_CLASS : label !== undefined ? FLOATING_INPUT_CLASS : FIELD_BASE,\n // Room for the trailing controls. showCalc is always false on a phone,\n // so the display shape only ever has to clear the currency chip — and\n // it clears it by the chip's actual width (a text-sm code plus a\n // chevron, ~58px) rather than the 5rem the boxed shape reserves. On a\n // 375px screen those 16px are the difference between a readable figure\n // and a clipped one (feedback #430 rework).\n asDisplay\n ? currency ? (editable ? \"pr-16\" : \"pr-12\") : \"pr-0\"\n : showCalc\n ? currency ? (editable ? \"pr-24\" : \"pr-16\") : \"pr-10\"\n : currency ? (editable ? \"pr-20\" : \"pr-14\") : \"pr-3\",\n // Centred display shape: centre in what is LEFT of the currency chip.\n // `text-center` alone would centre the figure in the whole box, i.e.\n // partly underneath the chip; the padding above is what takes the chip\n // out of the centring, and nothing is added on the left because a\n // mirrored reservation would spend the width twice (see `align`).\n asDisplay && align === \"center\" && \"text-center\",\n // Last, so it wins over the base class's own text colour.\n TONE_CLASS[tone],\n invalid && FIELD_INVALID,\n )}\n aria-invalid={invalid || undefined}\n />\n {label !== undefined && (\n // The display shape drops the label VISUALLY, not from the accessibility\n // tree: a 36px tinted figure at the top of a transaction form is legibly\n // the amount, but a screen reader still needs the name, and callers that\n // pass `label` without `ariaLabel` would otherwise be left with none.\n <label htmlFor={fieldId} className={asDisplay ? \"sr-only\" : FLOATING_LABEL_CLASS}>\n {label}\n </label>\n )}\n {/* Trailing controls share one flex track so the calculator icon and the\n currency suffix/picker sit side by side without overlapping. */}\n {/* The display shape has no box to inset from, so the controls align to the\n figure's own right edge and its baseline strip (`bottom-1`, matching the\n input's pb-1) instead of floating inside a field. */}\n <div\n className={cn(\n \"absolute flex items-center gap-0.5\",\n asDisplay ? \"bottom-1 right-0\" : \"inset-y-1 right-1\",\n )}\n >\n {showCalc && (\n <CalculatorButton\n value={shown}\n onChange={handleText}\n className=\"px-1.5\"\n ariaLabel={labels?.calculatorTrigger}\n labels={labels?.calculator}\n />\n )}\n {currency && !editable && (\n <span\n aria-hidden\n className={cn(\n \"pointer-events-none px-1 font-medium text-[var(--text-muted)]\",\n // A text-xs chip next to a 36px figure reads as a stray footnote.\n asDisplay ? \"text-sm\" : \"text-xs\",\n )}\n >\n {currency}\n </span>\n )}\n {currency && editable && (\n <button\n ref={chipRef}\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-label={\n // \"Currency: EUR\" through `common.fieldValue`, not a template literal:\n // the colon-and-space is punctuation a translation has to own.\n selected ? common.fieldValue(currencyText.currency, selected.code) : currencyText.currency\n }\n className={cn(\n \"flex items-center gap-1 rounded px-2 py-1 font-medium text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]\",\n asDisplay ? \"text-sm\" : \"text-xs\",\n )}\n >\n {currency}\n <ChevronDown className=\"size-3\" />\n </button>\n )}\n </div>\n {editable && open && (\n <DropdownPanel\n anchorRef={chipRef}\n panelRef={panelRef}\n empty={filtered.length === 0}\n header={\n <DropdownSearchHeader\n query={query}\n onQueryChange={setQuery}\n inputRef={inputRef}\n placeholder={currencyText.search}\n />\n }\n >\n {filtered.map((c) => {\n const active = c.code === selected?.code;\n return (\n <li key={c.code}>\n <button\n type=\"button\"\n onClick={() => {\n onCurrencyChange?.(c.code);\n setOpen(false);\n }}\n className={cn(\n \"flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-[var(--bg-hover)]\",\n active && \"bg-[var(--bg-active)]\",\n )}\n >\n <CurrencyFlag country={c.country} />\n <span className=\"font-mono text-[var(--text-muted)] w-8 shrink-0 text-xs\">\n {c.symbol}\n </span>\n <span className=\"font-medium text-[var(--text-primary)]\">{c.code}</span>\n <span className=\"text-[var(--text-muted)] truncate text-xs\">{currencyName(c, currencyNames, locale)}</span>\n </button>\n </li>\n );\n })}\n </DropdownPanel>\n )}\n </div>\n {showNumpad && (\n <NumberPadSheet\n value={shown}\n onChange={handleText}\n onDone={() => innerRef.current?.blur()}\n label={label}\n labels={labels?.pad}\n />\n )}\n </div>\n );\n },\n);\n\nAmountInput.displayName = \"AmountInput\";\n"],"mappings":";AAuSQ,cAoGI,YApGJ;AAvSR,SAAS,YAAY,aAAa,OAAO,SAAS,QAAQ,gBAAgB;AAC1E,SAAS,mBAAmB;AAE5B,SAAS,YAAY,cAAc,cAAc,mBAAmB;AACpE,SAAS,YAAY,eAAe,eAAe,sBAAsB,sBAAsB,mBAAmB;AAClH,SAAS,UAAU;AACnB,SAAS,qBAAqB;AAC9B,SAAS,wBAAqD;AAC9D,SAAS,sBAAiD;AAC1D,SAAS,eAAe,sBAAsB,yBAAyB;AACvE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA8HP,MAAM,aAA+D;AAAA,EACnE,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;AAMA,MAAM,sBAAsB;AAAA,EAC1B;AAAA,EACA;AACF;AAeA,SAAS,WAAW,UAAkB,MAAuB;AAC3D,QAAM,IAAI,mBAAmB,QAAQ;AACrC,SAAO,MAAM,QAAQ,aAAa,CAAC,MAAM,KAAK,KAAK;AACrD;AAEO,MAAM,cA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AAA,UACA,QAAQ,QAAQ;AAAA;AAAA,MAClB;AAAA,OAEJ;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/components/amount-input.tsx"],"sourcesContent":["import { forwardRef, useCallback, useId, useMemo, useRef, useState } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\nimport { CURRENCIES, CurrencyFlag, currencyName, getCurrency } from \"./currency-select\";\nimport { FIELD_BASE, FIELD_DISPLAY, FIELD_INVALID, FLOATING_INPUT_CLASS, FLOATING_LABEL_CLASS, PHONE_QUERY } from \"./ui\";\nimport { cn } from \"../lib/cn\";\nimport { useMediaQuery } from \"../hooks/use-media-query\";\nimport { CalculatorButton, type CalculatorButtonLabels } from \"./calculator\";\nimport { NumberPadSheet, type NumberPadSheetLabels } from \"./numpad-sheet\";\nimport { DropdownPanel, DropdownSearchHeader, useDropdownSearch } from \"./dropdown\";\nimport {\n DEFAULT_COMMON_LABELS,\n DEFAULT_CURRENCY_LABELS,\n useKitLabels,\n useKitLocale,\n type CurrencyLabels,\n} from \"../i18n/kit-labels\";\nimport {\n commitExpression,\n evaluateExpression,\n formatResult,\n isBareAmount,\n looksLikeExpression,\n sanitizeLive,\n splitLeadingSign,\n} from \"../lib/calc\";\n\ninterface AmountInputProps {\n value: string;\n onChange: (value: string) => void;\n currency?: string;\n onCurrencyChange?: (code: string) => void;\n placeholder?: string;\n label?: ReactNode;\n disabled?: boolean;\n /** Required and unanswered — {@link FIELD_INVALID}. See {@link Input}'s `invalid`. */\n invalid?: boolean;\n className?: string;\n id?: string;\n ariaLabel?: string;\n /** Every user-facing string this component and the two it composes own, so a\n * translating host can supply its own. Each key optional, and each a per-field\n * override of the kit-wide translation in `<UiKitProvider labels>`: `currency`\n * and `currencySearch` of its `currency` namespace, the rest of `calculator`.\n * `currency` names the picker chip, composed with the selected code through\n * `common.fieldValue`; the rest are pass-through. */\n labels?: {\n currency?: string;\n currencySearch?: string;\n /** Names the calculator TRIGGER this component renders. `calculator` below\n * names the controls inside the popover it opens. */\n calculatorTrigger?: string;\n pad?: NumberPadSheetLabels;\n calculator?: CalculatorButtonLabels;\n };\n /** Translated currency names for the chip's picker, keyed by ISO code. The same\n * sparse override `CurrencySelect` takes, and for the same reason: the names in\n * `CURRENCIES` are shipped data, so without this they are the one English word\n * left in a translated row. Not part of `labels` because it is keyed by DATA\n * rather than by a fixed set of slots, and an app passes the same map to both\n * pickers. */\n currencyNames?: Record<string, string>;\n /** Focus the field on mount — on mobile this also opens the numpad sheet, so a\n * new-transaction form can jump straight to amount entry (feedback #70). */\n autoFocus?: boolean;\n /**\n * Tint the typed figure by what it will DO (Keksdose feedback #167).\n *\n * The direction is chosen with a toggle beside the field rather than typed, so\n * the digits alone say nothing about which way the money goes — on the one screen\n * where getting that backwards is the expensive mistake. Colour says it\n * continuously, and it costs no layout. It stays the MAIN indication (live #201\n * rework: *\"The main indication shall still be the color\"*); {@link negative}\n * renders the sign as a second, quieter signal in front of the figure.\n *\n * Never the ONLY signal: the toggle it mirrors is right there, labelled, so this\n * is reinforcement rather than the sole carrier of the meaning.\n */\n tone?: \"neutral\" | \"outflow\" | \"inflow\";\n /**\n * The SIGN of the figure, owned by the caller's direction control (Keksdose live\n * #201 rework: *\"Outflow should be negative and inflow positive … the sign shall\n * be displayed but not necessarily be typed in\"*).\n *\n * `value` stays the MAGNITUDE. The minus is glued on at render time and stripped\n * off again before anything is reported back, so the caller never sees its own\n * prefix echoed and no code path can end up applying it twice. That is the whole\n * cure: there is exactly ONE place the sign lives, and it is not the text.\n *\n * Because it is rendered rather than stored it cannot be deleted (the next render\n * puts it back), a select-all-and-retype keeps the direction, and the caret needs\n * no minding.\n */\n negative?: boolean;\n /**\n * A sign the user TYPED, or a calculation that resolved to a signed number.\n *\n * SET, never flip. A \"-\" means *\"this is an outflow\"*, so typing it twice says the\n * same thing twice — which is exactly what the rework asks for (*\"Subtracting\n * values twice resulting in inflow -> outflow and back to inflow seems not\n * reasonable\"*). \"+\" says the other direction.\n *\n * Its presence is what ARMS the whole sign behaviour. A field with no direction\n * control — an account's starting balance, a loan payment, a holding's cost —\n * passes neither prop and keeps a text that is the whole truth, minus included.\n */\n onNegativeChange?: (negative: boolean) => void;\n /**\n * How the field presents itself ON A PHONE (Keksdose feedback #176).\n *\n * `\"field\"` (default) is the labelled, bordered input used everywhere else.\n *\n * `\"display\"` keeps every mechanic — the same `<input>`, the same numpad sheet,\n * the same currency picker, the same commit/blur contract — and only drops the\n * chrome: no border, no fill, no floating label, the figure set at display size.\n * On a form whose whole point is one number, a bordered `text-sm` box draws the\n * amount at the same weight as the memo beside it; this makes it the headline\n * instead. It stays fully editable — the underline and the caret are what say so.\n *\n * Phone-only by construction: it keys off the same breakpoint as the numpad, so\n * from `md` up the field is byte-for-byte the normal one and a desktop grid keeps\n * its column rhythm.\n */\n variant?: \"field\" | \"display\";\n /**\n * Where the figure sits in its row, for `variant=\"display\"` only (Keksdose\n * feedback #176 rework).\n *\n * `\"start\"` (default) keeps it flush left, in the reading column the fields\n * below it share — and it is what the entry forms use, because a figure that\n * starts at a known edge is legible at any width: when the value outgrows the\n * field, the digits that scroll out of sight are the trailing ones, not the\n * magnitude (Keksdose feedback #430 rework).\n *\n * `\"center\"` makes it a centred headline. It centres in the width that REMAINS\n * after the trailing currency control, not in the whole box: the control is\n * pinned to the right edge, so a plain `text-center` would centre the figure\n * under it and the last digits would sit behind the chip. This used to mirror\n * the control's reservation onto the left instead, which centred correctly but\n * spent twice the control's width on padding — fatal on a 375px screen, where\n * it left a 36px figure 16px to live in.\n */\n align?: \"start\" | \"center\";\n}\n\n// The consuming app's ONE money palette (`--money-expense` / `--money-income`),\n// not a bespoke rose/emerald pairing: a figure being typed has to wear the same\n// colour the same figure will wear once it is a row in the table behind the form\n// (Keksdose dev#434). The utilities are unlayered and theme-aware, so no `dark:`\n// variant is needed and they win over the field's own text colour regardless of\n// where `cn` puts them.\nconst TONE_CLASS: Record<\"neutral\" | \"outflow\" | \"inflow\", string> = {\n neutral: \"\",\n outflow: \"text-money-neg\",\n inflow: \"text-money-pos\",\n};\n\n// The shared chrome-less treatment at money size. `tabular-nums` so digits don't\n// reflow the figure as they are typed; FIELD_DISPLAY's own muted placeholder\n// colour is what keeps an EMPTY form from painting its zero in the direction tint\n// (`tone` is computed from 0, which reads as an inflow).\nconst DISPLAY_INPUT_CLASS = cn(\n FIELD_DISPLAY,\n \"text-4xl font-semibold leading-tight tracking-tight tabular-nums\",\n);\n\n/**\n * Is `text` the ANSWER to `previous`, or something typed OVER it?\n *\n * \"The old text was a sum and the new one is bare\" cannot tell those apart, and both\n * gestures are ordinary: select-all-and-retype after a typo, or backspacing \"-20+\"\n * back down to a fresh figure. Read as an answer, they move the direction chip — so\n * an outflow of 7 quietly booked +7.00 (live #201 rework).\n *\n * The question that does separate them is arithmetic, not shape: evaluate what the\n * text replaced and see whether this IS that number. \"-12+30\" → \"18\" still is, so a\n * sum that comes out positive still takes the chip with it; \"-20+50\" → \"7\" is not,\n * and \"-20+\" evaluates to nothing at all.\n */\nfunction isResultOf(previous: string, text: string): boolean {\n const n = evaluateExpression(previous);\n return n !== null && formatResult(n) === text.trim();\n}\n\nexport const AmountInput = forwardRef<HTMLInputElement, AmountInputProps>(\n ({ value, onChange, currency, onCurrencyChange, placeholder, label, disabled, invalid, className, id, ariaLabel, autoFocus, tone = \"neutral\", negative = false, onNegativeChange, variant = \"field\", align = \"start\", labels, currencyNames }, ref) => {\n const generatedId = useId();\n const fieldId = id ?? generatedId;\n const editable = !!onCurrencyChange;\n // On phones we suppress the OS keyboard (inputMode=\"none\" below) and show our\n // own calculator numpad, so the desktop popover trigger is hidden. The\n // end padding keys off showCalc, so it tightens up automatically.\n const isMobile = useMediaQuery(PHONE_QUERY, false);\n const showCalc = !disabled && !isMobile;\n const [focused, setFocused] = useState(false);\n // On mobile, focusing the field opens the numpad bottom sheet in place of the\n // native keyboard (feedback #334) — a full calculator keypad, not just the old\n // operator bar. An internal ref lets the sheet's \"Done\" blur the input, which\n // commits + closes via the existing onBlur handler.\n const showNumpad = isMobile && !disabled && focused;\n // Gate the display treatment on the SAME `isMobile` the numpad uses rather than\n // on `max-md:` classes, so the two can never drift apart on the breakpoint —\n // and so the two shapes are separate class strings instead of one string\n // fighting itself through responsive overrides. `useMediaQuery` reads\n // synchronously on mount, so there is no field→figure flash.\n const asDisplay = variant === \"display\" && isMobile;\n const innerRef = useRef<HTMLInputElement>(null);\n const setRefs = useCallback(\n (el: HTMLInputElement | null) => {\n innerRef.current = el;\n if (typeof ref === \"function\") ref(el);\n else if (ref) ref.current = el;\n },\n [ref],\n );\n // The sign is DISPLAYED, not stored (live #201 rework). `value` is the\n // magnitude; the minus is glued on here and taken off again in handleText, so\n // the two can never disagree and the caller can never double-apply it. Only in\n // front of a bare amount: an expression being typed (\"12-30\") owns its own\n // minus and has to survive keystroke-for-keystroke.\n const signOwned = onNegativeChange !== undefined;\n const shown = signOwned && negative && isBareAmount(value) ? `-${value}` : value;\n // Every route into the field — typing, the numpad sheet, the desktop\n // calculator, the blur/Enter commit — funnels through here, so the split is\n // written once and the four entry paths cannot drift.\n //\n // `previous` is the text this one REPLACES, and it is what says whether a bare\n // figure arriving here is an answer or a magnitude. For the three paths that\n // edit the field's own text that is simply what the field was showing; the\n // desktop calculator keeps its expression in a popover the field never sees,\n // so it passes it in (see `CalculatorButton`'s `onChange`).\n const handleText = (raw: string, previous: string = shown) => {\n const text = sanitizeLive(raw);\n if (!signOwned) {\n onChange(text);\n return;\n }\n const { sign, rest } = splitLeadingSign(text);\n if (sign) {\n // SET, not flip: re-reporting the same sign on every keystroke is a no-op.\n onNegativeChange(sign === \"-\");\n } else if (looksLikeExpression(previous) && isBareAmount(text) && isResultOf(previous, text)) {\n // A calculation that just RESOLVED states its sign in both directions. The\n // figure it ran on is the SIGNED one the user could see — \"-12+30\" is +18 —\n // so a positive result has to move the chip too, or the field would answer\n // that sum with \"-18\" and contradict the arithmetic it just showed.\n //\n // Only when it really resolved, though: see {@link isResultOf}. A bare figure\n // arriving on top of an expression is far more often a replacement than an\n // answer, and reading it as an answer flips the direction of money.\n onNegativeChange(false);\n }\n onChange(sign ? rest : text);\n };\n const commit = () => handleText(commitExpression(shown));\n const { open, setOpen, wrapperRef, panelRef, query, setQuery, inputRef } = useDropdownSearch();\n // The chip the currency list hangs off (Keksdose dev#548). It is portalled now, so\n // the panel needs a real trigger rect rather than a relative parent — see\n // `DropdownPanel`'s note for what an `overflow` ancestor did to it before.\n const chipRef = useRef<HTMLButtonElement>(null);\n\n // The currency chip's strings are the `currency` namespace — the same two\n // `CurrencySelect` resolves, under this component's older key names. The\n // calculator and the numpad resolve `calculator` themselves; `labels.calculator`\n // and `labels.pad` are handed straight through to them as overrides.\n const currencyOverrides = useMemo(() => {\n const out: Partial<CurrencyLabels> = {};\n if (labels?.currency !== undefined) out.currency = labels.currency;\n if (labels?.currencySearch !== undefined) out.search = labels.currencySearch;\n return out;\n }, [labels?.currency, labels?.currencySearch]);\n const currencyText = useKitLabels(\"currency\", DEFAULT_CURRENCY_LABELS, currencyOverrides);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const locale = useKitLocale();\n\n const selected = getCurrency(currency);\n const filtered = useMemo(() => {\n const q = query.trim().toLocaleLowerCase(locale);\n if (!q) return CURRENCIES;\n return CURRENCIES.filter(\n (c) =>\n c.code.toLowerCase().includes(q) ||\n // The name the row SHOWS, so a translated list is searchable in the\n // language it is written in.\n currencyName(c, currencyNames, locale).toLocaleLowerCase(locale).includes(q) ||\n c.symbol.toLowerCase().includes(q),\n );\n }, [query, currencyNames, locale]);\n\n return (\n <div ref={wrapperRef} className={cn(\"w-full\", className)}>\n {/* Inner relative box holds the input + its absolutely-positioned\n trailing controls (calculator / currency), so those stay anchored to\n the INPUT even when the mobile math bar is rendered below (#334). */}\n <div className=\"relative w-full\">\n <input\n ref={setRefs}\n id={fieldId}\n aria-label={ariaLabel}\n type=\"text\"\n // eslint-disable-next-line jsx-a11y/no-autofocus -- opt-in per call site (feedback #70)\n autoFocus={autoFocus}\n // On mobile suppress the OS keyboard so our numpad sheet owns entry; the\n // field keeps focus/caret. Desktop keeps the native decimal keypad.\n inputMode={isMobile ? \"none\" : \"decimal\"}\n autoComplete=\"off\"\n disabled={disabled}\n // The floating-label pattern needs a blank placeholder for its\n // peer-placeholder-shown trick. The display shape has no floating label,\n // so it spends the placeholder on what an empty borderless form actually\n // needs: a zero to aim at, at full size. The caller supplies it because\n // only the app knows the locale's decimal separator.\n placeholder={asDisplay ? (placeholder ?? \"0\") : label !== undefined ? \" \" : placeholder}\n value={shown}\n onChange={(e) => handleText(e.target.value)}\n onFocus={() => setFocused(true)}\n onBlur={() => {\n commit();\n setFocused(false);\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") commit();\n }}\n className={cn(\n // With a label, use the floating-input padding (pt-4 pb-1) like every\n // other labelled field so the value sits BELOW the floated label rather\n // than vertically centred where it overlaps the resting label\n // (feedback #314). FLOATING_INPUT_CLASS already bundles the peer +\n // transparent-placeholder bits.\n asDisplay ? DISPLAY_INPUT_CLASS : label !== undefined ? FLOATING_INPUT_CLASS : FIELD_BASE,\n // Room for the trailing controls. showCalc is always false on a phone,\n // so the display shape only ever has to clear the currency chip — and\n // it clears it by the chip's actual width (a text-sm code plus a\n // chevron, ~58px) rather than the 5rem the boxed shape reserves. On a\n // 375px screen those 16px are the difference between a readable figure\n // and a clipped one (feedback #430 rework).\n asDisplay\n ? currency ? (editable ? \"pe-16\" : \"pe-12\") : \"pe-0\"\n : showCalc\n ? currency ? (editable ? \"pe-24\" : \"pe-16\") : \"pe-10\"\n : currency ? (editable ? \"pe-20\" : \"pe-14\") : \"pe-3\",\n // Centred display shape: centre in what is LEFT of the currency chip.\n // `text-center` alone would centre the figure in the whole box, i.e.\n // partly underneath the chip; the padding above is what takes the chip\n // out of the centring, and nothing is added at the start because a\n // mirrored reservation would spend the width twice (see `align`).\n asDisplay && align === \"center\" && \"text-center\",\n // Last, so it wins over the base class's own text colour.\n TONE_CLASS[tone],\n invalid && FIELD_INVALID,\n )}\n aria-invalid={invalid || undefined}\n />\n {label !== undefined && (\n // The display shape drops the label VISUALLY, not from the accessibility\n // tree: a 36px tinted figure at the top of a transaction form is legibly\n // the amount, but a screen reader still needs the name, and callers that\n // pass `label` without `ariaLabel` would otherwise be left with none.\n <label htmlFor={fieldId} className={asDisplay ? \"sr-only\" : FLOATING_LABEL_CLASS}>\n {label}\n </label>\n )}\n {/* Trailing controls share one flex track so the calculator icon and the\n currency suffix/picker sit side by side without overlapping. */}\n {/* The display shape has no box to inset from, so the controls align to the\n figure's own end edge and its baseline strip (`bottom-1`, matching the\n input's pb-1) instead of floating inside a field. */}\n <div\n className={cn(\n \"absolute flex items-center gap-0.5\",\n // Logical `end-*`: the chip and the calculator are the figure's trailing\n // controls, so a right-to-left form carries them on the left.\n asDisplay ? \"bottom-1 end-0\" : \"inset-y-1 end-1\",\n )}\n >\n {showCalc && (\n <CalculatorButton\n value={shown}\n onChange={handleText}\n className=\"px-1.5\"\n ariaLabel={labels?.calculatorTrigger}\n labels={labels?.calculator}\n />\n )}\n {currency && !editable && (\n <span\n aria-hidden\n className={cn(\n \"pointer-events-none px-1 font-medium text-[var(--text-muted)]\",\n // A text-xs chip next to a 36px figure reads as a stray footnote.\n asDisplay ? \"text-sm\" : \"text-xs\",\n )}\n >\n {currency}\n </span>\n )}\n {currency && editable && (\n <button\n ref={chipRef}\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-label={\n // \"Currency: EUR\" through `common.fieldValue`, not a template literal:\n // the colon-and-space is punctuation a translation has to own.\n selected ? common.fieldValue(currencyText.currency, selected.code) : currencyText.currency\n }\n className={cn(\n \"flex items-center gap-1 rounded px-2 py-1 font-medium text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]\",\n asDisplay ? \"text-sm\" : \"text-xs\",\n )}\n >\n {currency}\n <ChevronDown className=\"size-3\" />\n </button>\n )}\n </div>\n {editable && open && (\n <DropdownPanel\n anchorRef={chipRef}\n panelRef={panelRef}\n empty={filtered.length === 0}\n header={\n <DropdownSearchHeader\n query={query}\n onQueryChange={setQuery}\n inputRef={inputRef}\n placeholder={currencyText.search}\n />\n }\n >\n {filtered.map((c) => {\n const active = c.code === selected?.code;\n return (\n <li key={c.code}>\n <button\n type=\"button\"\n onClick={() => {\n onCurrencyChange?.(c.code);\n setOpen(false);\n }}\n className={cn(\n \"flex w-full items-center gap-2 px-3 py-1.5 text-sm text-start hover:bg-[var(--bg-hover)]\",\n active && \"bg-[var(--bg-active)]\",\n )}\n >\n <CurrencyFlag country={c.country} />\n <span className=\"font-mono text-[var(--text-muted)] w-8 shrink-0 text-xs\">\n {c.symbol}\n </span>\n <span className=\"font-medium text-[var(--text-primary)]\">{c.code}</span>\n <span className=\"text-[var(--text-muted)] truncate text-xs\">{currencyName(c, currencyNames, locale)}</span>\n </button>\n </li>\n );\n })}\n </DropdownPanel>\n )}\n </div>\n {showNumpad && (\n <NumberPadSheet\n value={shown}\n onChange={handleText}\n onDone={() => innerRef.current?.blur()}\n label={label}\n labels={labels?.pad}\n />\n )}\n </div>\n );\n },\n);\n\nAmountInput.displayName = \"AmountInput\";\n"],"mappings":";AAuSQ,cAsGI,YAtGJ;AAvSR,SAAS,YAAY,aAAa,OAAO,SAAS,QAAQ,gBAAgB;AAC1E,SAAS,mBAAmB;AAE5B,SAAS,YAAY,cAAc,cAAc,mBAAmB;AACpE,SAAS,YAAY,eAAe,eAAe,sBAAsB,sBAAsB,mBAAmB;AAClH,SAAS,UAAU;AACnB,SAAS,qBAAqB;AAC9B,SAAS,wBAAqD;AAC9D,SAAS,sBAAiD;AAC1D,SAAS,eAAe,sBAAsB,yBAAyB;AACvE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA8HP,MAAM,aA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,UAAK,WAAU,6CAA6C,uBAAa,GAAG,eAAe,MAAM,GAAE;AAAA;AAAA;AAAA,cACtG,KAlBO,EAAE,IAmBX;AAAA,YAEJ,CAAC;AAAA;AAAA,QACL;AAAA,SAEF;AAAA,MACC,cACC;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,UACP,UAAU;AAAA,UACV,QAAQ,MAAM,SAAS,SAAS,KAAK;AAAA,UACrC;AAAA,UACA,QAAQ,QAAQ;AAAA;AAAA,MAClB;AAAA,OAEJ;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":[]}
@@ -8,14 +8,15 @@ import '../hooks/use-anchored-panel.js';
8
8
  * not the DOM's text-selection event — so the input's own spellings of those three
9
9
  * are omitted. Everything else reaches the `<input>`, the way it does on {@link Input}.
10
10
  */
11
- interface AutocompleteProps<V extends string | number = string> extends Omit<ComponentPropsWithoutRef<"input">, "value" | "defaultValue" | "onChange" | "onSelect" | "children" | "type"> {
11
+ interface AutocompleteProps<V extends string | number = string> extends Omit<ComponentPropsWithoutRef<"input">, "value" | "defaultValue" | "onChange" | "onSelect" | "children" | "type" | "size"> {
12
12
  /** What is in the field. Controlled, and never reset by the component: opening,
13
13
  * closing and a failed lookup all leave it exactly as typed. */
14
14
  value: string;
15
15
  /** Every keystroke — and, with `fillOnSelect`, the label of a taken suggestion. */
16
16
  onChange: (text: string) => void;
17
17
  /** Suggestions the caller already has (e.g. from its own query hook). Narrowed by
18
- * the text unless `filter={false}`. */
18
+ * the text unless `filter={false}`. An option with `disabled: true` is listed but
19
+ * cannot be taken — see {@link ComboOption.disabled}. */
19
20
  options?: ComboOption<V>[];
20
21
  /** Or: fetch them. Debounced (`debounceMs`), race-safe, only at `minChars` and up,
21
22
  * never while the field is idle; a rejection shows `loadErrorLabel` and empties
@@ -33,6 +34,30 @@ interface AutocompleteProps<V extends string | number = string> extends Omit<Com
33
34
  * inter-key interval is 150–250 ms, so the pickers' 150 fires on nearly every
34
35
  * letter, which a rate-limited geocoder cannot afford. */
35
36
  debounceMs?: number;
37
+ /**
38
+ * Whether the list MAY show — controlled. Omit (or pass `undefined`) and the field
39
+ * decides: open while focused, until Escape, Tab or a taken row. `false` keeps it
40
+ * shut whatever the user does, and stops `loadOptions` asking — keksdose's address
41
+ * search, with its confirm map up, where it used to pass `minChars={Infinity}`.
42
+ * `true` shows it even unfocused.
43
+ *
44
+ * Even open, the list only APPEARS when it has something to show (rows, or a
45
+ * status line); `aria-expanded` follows what appears, not this flag.
46
+ */
47
+ open?: boolean;
48
+ /** The field wants the list open or shut — focus, typing, ↓/↑ open it; blur,
49
+ * Escape, Tab and taking a row shut it. Called on every change, controlled or not. */
50
+ onOpenChange?: (open: boolean) => void;
51
+ /**
52
+ * `"sm"`: the 28px, 12px-type field of {@link Select}'s `size="sm"`, with the icon,
53
+ * spinner and list rows scaled to match — for a card or toolbar whose buttons are
54
+ * small. `"md"` (default) is the form field. Unlabelled only, as on `Select`: a
55
+ * floating label needs the tall box, so a labelled field ignores `"sm"`.
56
+ *
57
+ * A NUMBER is still the native `size` attribute (the width in characters), passed
58
+ * straight through.
59
+ */
60
+ size?: "sm" | "md" | number;
36
61
  /** A suggestion was taken (click, or Enter on the highlighted row). */
37
62
  onSelect?: (option: ComboOption<V>) => void;
38
63
  /**
@@ -42,11 +67,12 @@ interface AutocompleteProps<V extends string | number = string> extends Omit<Com
42
67
  * and the field is only the search that found it; the text then stays as typed.
43
68
  */
44
69
  fillOnSelect?: boolean;
45
- /** A floating label, as on {@link Combobox}. Names the field (`aria-labelledby`)
46
- * unless an `aria-label` is given. */
70
+ /** A floating label, as on {@link Combobox} — a real `<label for>` on the input.
71
+ * Names the field (`aria-labelledby`) unless an `aria-label` is given. */
47
72
  label?: ReactNode;
48
73
  /** Leading decoration inside the field (a pin, a magnifier). Decorative: the
49
- * label names the field. */
74
+ * label names the field. An `<svg>` child is sized by the field — 16px, or 14px
75
+ * at `size="sm"` — so a lucide icon needs no class of its own. */
50
76
  icon?: ReactNode;
51
77
  /** Required and unanswered — {@link FIELD_INVALID}. */
52
78
  invalid?: boolean;
@@ -85,9 +111,12 @@ interface AutocompleteProps<V extends string | number = string> extends Omit<Com
85
111
  *
86
112
  * Focus never leaves the `<input>`: `aria-activedescendant` names the highlighted
87
113
  * row, `aria-controls` the list, and a polite live region says what the list now
88
- * holds. Keyboard: ↓/↑ move (↓ opens), Enter takes the highlighted row (with none,
114
+ * holds. Keyboard: ↓/↑ move (↓ opens) over every row but a `disabled` one, Enter
115
+ * takes the highlighted row (with none,
89
116
  * Enter is left to the form), Escape closes, Tab closes and moves on; Home/End stay
90
- * with the caret. A caller's `onKeyDown` runs first and may `preventDefault()` to
117
+ * with the caret. An Escape that closes an open list is consumed and never reaches the
118
+ * caller; with the list closed it does. For every other key a caller's `onKeyDown`
119
+ * runs first and may `preventDefault()` to
91
120
  * keep a key for itself.
92
121
  *
93
122
  * The list is portalled and anchored under the field on every screen size: the