@eifi1/ui-kit 0.51.7 → 0.52.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.
- package/README.md +141 -23
- package/dist/account/account-parts.d.ts +10 -8
- package/dist/account/account-parts.js +1 -18
- package/dist/account/account-parts.js.map +1 -1
- package/dist/account/data-export-setting-labels.js +1 -1
- package/dist/account/data-export-setting-labels.js.map +1 -1
- package/dist/account/delete-account-setting-labels.js +1 -1
- package/dist/account/delete-account-setting-labels.js.map +1 -1
- package/dist/account/email-change-setting-labels.js +1 -1
- package/dist/account/email-change-setting-labels.js.map +1 -1
- package/dist/account/passkeys-setting.d.ts +9 -2
- package/dist/account/passkeys-setting.js +41 -29
- package/dist/account/passkeys-setting.js.map +1 -1
- package/dist/account/sessions-setting.d.ts +3 -2
- package/dist/account/sessions-setting.js +10 -8
- package/dist/account/sessions-setting.js.map +1 -1
- package/dist/admin/admin-action-confirm.js +1 -3
- package/dist/admin/admin-action-confirm.js.map +1 -1
- package/dist/admin/admin-parts.d.ts +6 -3
- package/dist/admin/admin-parts.js +6 -21
- package/dist/admin/admin-parts.js.map +1 -1
- package/dist/admin/mail-test-card-labels.js +1 -1
- package/dist/admin/mail-test-card-labels.js.map +1 -1
- package/dist/admin/plan-change-labels.d.ts +2 -2
- package/dist/admin/plan-change-labels.js +1 -17
- package/dist/admin/plan-change-labels.js.map +1 -1
- package/dist/admin/plan-change.d.ts +3 -42
- package/dist/admin/plan-change.js +1 -1
- package/dist/admin/plan-change.js.map +1 -1
- package/dist/admin/reviewer-scope-editor.js +3 -3
- package/dist/admin/reviewer-scope-editor.js.map +1 -1
- package/dist/auth/auth-errors-labels.d.ts +11 -0
- package/dist/auth/auth-errors-labels.js +13 -0
- package/dist/auth/auth-errors-labels.js.map +1 -0
- package/dist/auth/auth-errors.d.ts +7 -23
- package/dist/auth/auth-errors.js +2 -15
- package/dist/auth/auth-errors.js.map +1 -1
- package/dist/auth/complete-name-dialog.js +2 -1
- package/dist/auth/complete-name-dialog.js.map +1 -1
- package/dist/auth/forgot-password-form-labels.js +1 -1
- package/dist/auth/forgot-password-form-labels.js.map +1 -1
- package/dist/auth/forgot-password-form.js +7 -2
- package/dist/auth/forgot-password-form.js.map +1 -1
- package/dist/auth/register-form-labels.js +1 -1
- package/dist/auth/register-form-labels.js.map +1 -1
- package/dist/auth/reset-password-form-labels.js +1 -1
- package/dist/auth/reset-password-form-labels.js.map +1 -1
- package/dist/auth/reset-password-form.js +5 -1
- package/dist/auth/reset-password-form.js.map +1 -1
- package/dist/auth/sign-in-form-labels.js +1 -1
- package/dist/auth/sign-in-form-labels.js.map +1 -1
- package/dist/auth/status-parts.d.ts +0 -3
- package/dist/auth/status-parts.js +0 -4
- package/dist/auth/status-parts.js.map +1 -1
- package/dist/auth/verify-email-labels.js +1 -1
- package/dist/auth/verify-email-labels.js.map +1 -1
- package/dist/auth/verify-email.js +7 -2
- package/dist/auth/verify-email.js.map +1 -1
- package/dist/billing/cancel-subscription.d.ts +20 -8
- package/dist/billing/cancel-subscription.js +7 -5
- package/dist/billing/cancel-subscription.js.map +1 -1
- package/dist/billing/dialog-close.d.ts +29 -0
- package/dist/billing/dialog-close.js +8 -0
- package/dist/billing/dialog-close.js.map +1 -0
- package/dist/billing/plan-card.d.ts +14 -4
- package/dist/billing/plan-card.js +15 -8
- package/dist/billing/plan-card.js.map +1 -1
- package/dist/billing/plan-change-labels.d.ts +42 -0
- package/dist/billing/plan-change-labels.js +22 -0
- package/dist/billing/plan-change-labels.js.map +1 -0
- package/dist/billing/plan-switch.d.ts +19 -7
- package/dist/billing/plan-switch.js +8 -4
- package/dist/billing/plan-switch.js.map +1 -1
- package/dist/chart.d.ts +12 -0
- package/dist/chart.js +16 -1
- package/dist/chart.js.map +1 -1
- package/dist/components/account-chips.d.ts +5 -5
- package/dist/components/account-chips.js +11 -13
- package/dist/components/account-chips.js.map +1 -1
- package/dist/components/alert-banner.d.ts +16 -5
- package/dist/components/alert-banner.js +46 -1
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.d.ts +13 -0
- package/dist/components/amount-input.js +1 -0
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/autocomplete.js +57 -65
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/bulk-action-bar.d.ts +12 -2
- package/dist/components/bulk-action-bar.js +65 -21
- package/dist/components/bulk-action-bar.js.map +1 -1
- package/dist/components/button-look.d.ts +5 -5
- package/dist/components/button-look.js.map +1 -1
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js.map +1 -1
- package/dist/components/chart-edge.d.ts +16 -0
- package/dist/components/chart-edge.js +14 -1
- package/dist/components/chart-edge.js.map +1 -1
- package/dist/components/chart-figure.d.ts +13 -0
- package/dist/components/chart-figure.js +15 -0
- package/dist/components/chart-figure.js.map +1 -0
- package/dist/components/chart-zoom-core.js +1 -4
- package/dist/components/chart-zoom-core.js.map +1 -1
- package/dist/components/chart.d.ts +8 -1
- package/dist/components/chart.js +19 -10
- package/dist/components/chart.js.map +1 -1
- package/dist/components/combobox-core.d.ts +111 -2
- package/dist/components/combobox-core.js +148 -42
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.d.ts +1 -1
- package/dist/components/combobox.js +141 -130
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/copy-button.d.ts +6 -5
- package/dist/components/copy-button.js +5 -3
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/country-select.js +2 -2
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/data-table-column-settings.d.ts +1 -1
- package/dist/components/data-table-column-settings.js +33 -7
- package/dist/components/data-table-column-settings.js.map +1 -1
- package/dist/components/data-table-filters.d.ts +4 -2
- package/dist/components/data-table-filters.js +2 -2
- package/dist/components/data-table-filters.js.map +1 -1
- package/dist/components/data-table-fit.d.ts +6 -4
- package/dist/components/data-table-fit.js +4 -1
- package/dist/components/data-table-fit.js.map +1 -1
- package/dist/components/data-table-groups.d.ts +1 -1
- package/dist/components/data-table-groups.js.map +1 -1
- package/dist/components/data-table-head.d.ts +1 -1
- package/dist/components/data-table-head.js +15 -12
- package/dist/components/data-table-head.js.map +1 -1
- package/dist/components/data-table-mobile.d.ts +12 -7
- package/dist/components/data-table-mobile.js +43 -30
- package/dist/components/data-table-mobile.js.map +1 -1
- package/dist/components/data-table-pagination.js +11 -6
- package/dist/components/data-table-pagination.js.map +1 -1
- package/dist/components/data-table-resize.d.ts +1 -1
- package/dist/components/data-table-resize.js.map +1 -1
- package/dist/components/data-table-row-actions.d.ts +2 -2
- package/dist/components/data-table-row-actions.js.map +1 -1
- package/dist/components/data-table-row.d.ts +6 -2
- package/dist/components/data-table-row.js +17 -10
- package/dist/components/data-table-row.js.map +1 -1
- package/dist/components/data-table-selection.d.ts +1 -1
- package/dist/components/data-table-selection.js.map +1 -1
- package/dist/components/data-table-shared.d.ts +10 -2
- package/dist/components/data-table-shared.js +18 -0
- package/dist/components/data-table-shared.js.map +1 -1
- package/dist/components/data-table-sort.d.ts +21 -2
- package/dist/components/data-table-sort.js +24 -0
- package/dist/components/data-table-sort.js.map +1 -1
- package/dist/components/data-table-virtual.d.ts +1 -1
- package/dist/components/data-table-virtual.js +18 -6
- package/dist/components/data-table-virtual.js.map +1 -1
- package/dist/components/data-table.d.ts +13 -4
- package/dist/components/data-table.js +139 -36
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-field.d.ts +24 -2
- package/dist/components/date-field.js +33 -8
- package/dist/components/date-field.js.map +1 -1
- package/dist/components/date-picker.d.ts +15 -2
- package/dist/components/date-picker.js +55 -26
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.d.ts +47 -20
- package/dist/components/date-range-picker.js +23 -7
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/error-boundary.js +37 -30
- package/dist/components/error-boundary.js.map +1 -1
- package/dist/components/{ui-labels.d.ts → field-base-labels.d.ts} +0 -2
- package/dist/components/{ui-labels.js → field-base-labels.js} +2 -9
- package/dist/components/field-base-labels.js.map +1 -0
- package/dist/components/field-base.d.ts +4 -3
- package/dist/components/field-base.js +3 -3
- package/dist/components/field-base.js.map +1 -1
- package/dist/components/field-sync-labels.d.ts +1 -0
- package/dist/components/field-sync-labels.js.map +1 -1
- package/dist/components/field-sync.d.ts +23 -1
- package/dist/components/field-sync.js.map +1 -1
- package/dist/components/form-actions.js +11 -5
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/hover-menu.d.ts +3 -0
- package/dist/components/hover-menu.js +5 -3
- package/dist/components/hover-menu.js.map +1 -1
- package/dist/components/icon-button.js +14 -9
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/inline-confirm.d.ts +43 -0
- package/dist/components/inline-confirm.js +67 -0
- package/dist/components/inline-confirm.js.map +1 -0
- package/dist/components/inline-entity-combobox.d.ts +4 -3
- package/dist/components/inline-entity-combobox.js +148 -140
- package/dist/components/inline-entity-combobox.js.map +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/jump-calendar.js +28 -112
- package/dist/components/jump-calendar.js.map +1 -1
- package/dist/components/legal-page.d.ts +3 -1
- package/dist/components/legal-page.js +3 -2
- package/dist/components/legal-page.js.map +1 -1
- package/dist/components/legal.d.ts +4 -2
- package/dist/components/legal.js.map +1 -1
- package/dist/components/lightbox.d.ts +2 -2
- package/dist/components/lightbox.js +17 -6
- package/dist/components/lightbox.js.map +1 -1
- package/dist/components/list.d.ts +6 -2
- package/dist/components/list.js +3 -2
- package/dist/components/list.js.map +1 -1
- package/dist/components/measured-grid.d.ts +1 -1
- package/dist/components/measured-grid.js +2 -1
- package/dist/components/measured-grid.js.map +1 -1
- package/dist/components/mini-calendar.js +3 -5
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.js +3 -1
- package/dist/components/modal.js.map +1 -1
- package/dist/components/month-grid.d.ts +55 -0
- package/dist/components/month-grid.js +148 -0
- package/dist/components/month-grid.js.map +1 -0
- package/dist/components/month-picker.d.ts +36 -4
- package/dist/components/month-picker.js +123 -146
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-select.d.ts +2 -2
- package/dist/components/multi-select.js +11 -6
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/picker-sheet.js +2 -1
- package/dist/components/picker-sheet.js.map +1 -1
- package/dist/components/pie-chart-labels.d.ts +7 -0
- package/dist/components/pie-chart-labels.js +1 -0
- package/dist/components/pie-chart-labels.js.map +1 -1
- package/dist/components/pie-chart.d.ts +5 -3
- package/dist/components/pie-chart.js +7 -22
- package/dist/components/pie-chart.js.map +1 -1
- package/dist/components/popover.d.ts +3 -0
- package/dist/components/popover.js +7 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/row-actions.js +2 -1
- package/dist/components/row-actions.js.map +1 -1
- package/dist/components/section-nav.d.ts +7 -0
- package/dist/components/section-nav.js.map +1 -1
- package/dist/components/series-chart-axes.d.ts +3 -3
- package/dist/components/series-chart-axes.js.map +1 -1
- package/dist/components/series-chart-labels.d.ts +7 -4
- package/dist/components/series-chart-labels.js.map +1 -1
- package/dist/components/series-chart.d.ts +31 -7
- package/dist/components/series-chart.js +72 -29
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/share-card.js +3 -3
- package/dist/components/share-card.js.map +1 -1
- package/dist/components/sign-chip-labels.d.ts +1 -0
- package/dist/components/sign-chip-labels.js.map +1 -1
- package/dist/components/sign-chip.d.ts +10 -1
- package/dist/components/sign-chip.js.map +1 -1
- package/dist/components/tabs-labels.d.ts +2 -0
- package/dist/components/tabs-labels.js +11 -0
- package/dist/components/tabs-labels.js.map +1 -0
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tabs.js +1 -1
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/toggle-legend.d.ts +2 -2
- package/dist/components/toggle-legend.js +6 -6
- package/dist/components/toggle-legend.js.map +1 -1
- package/dist/components/translation-review-editor.d.ts +4 -2
- package/dist/components/translation-review-editor.js +2 -3
- package/dist/components/translation-review-editor.js.map +1 -1
- package/dist/components/translation-review.d.ts +2 -1
- package/dist/components/translation-review.js +2 -2
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/treemap-labels.d.ts +26 -0
- package/dist/components/treemap-labels.js +10 -0
- package/dist/components/treemap-labels.js.map +1 -0
- package/dist/components/treemap-layout.d.ts +62 -0
- package/dist/components/treemap-layout.js +126 -0
- package/dist/components/treemap-layout.js.map +1 -0
- package/dist/components/treemap.d.ts +140 -17
- package/dist/components/treemap.js +324 -97
- package/dist/components/treemap.js.map +1 -1
- package/dist/components/use-table-state.d.ts +5 -5
- package/dist/components/use-table-state.js +4 -1
- package/dist/components/use-table-state.js.map +1 -1
- package/dist/data-table.d.ts +6 -2
- package/dist/data-table.js +7 -2
- package/dist/data-table.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/eslint/role-utilities.d.ts +36 -7
- package/dist/eslint/role-utilities.js +42 -9
- package/dist/eslint/role-utilities.js.map +1 -1
- package/dist/feedback/feedback-dialog.d.ts +25 -16
- package/dist/feedback/feedback-dialog.js +6 -2
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-mutation.d.ts +30 -0
- package/dist/feedback/feedback-mutation.js +16 -0
- package/dist/feedback/feedback-mutation.js.map +1 -0
- package/dist/feedback/feedback-page-link.d.ts +53 -0
- package/dist/feedback/feedback-page-link.js +37 -0
- package/dist/feedback/feedback-page-link.js.map +1 -0
- package/dist/feedback/feedback-public-list.d.ts +12 -3
- package/dist/feedback/feedback-public-list.js +2 -1
- package/dist/feedback/feedback-public-list.js.map +1 -1
- package/dist/feedback/feedback-replies.d.ts +3 -1
- package/dist/feedback/feedback-replies.js +5 -4
- package/dist/feedback/feedback-replies.js.map +1 -1
- package/dist/feedback/feedback-row-detail-labels.js +5 -0
- package/dist/feedback/feedback-row-detail-labels.js.map +1 -1
- package/dist/feedback/feedback-row-detail.d.ts +64 -28
- package/dist/feedback/feedback-row-detail.js +30 -28
- package/dist/feedback/feedback-row-detail.js.map +1 -1
- package/dist/feedback/feedback-status-undo.d.ts +30 -11
- package/dist/feedback/feedback-status-undo.js +10 -15
- package/dist/feedback/feedback-status-undo.js.map +1 -1
- package/dist/feedback/feedback-submit-dialog.d.ts +1 -1
- package/dist/feedback/feedback-submit-dialog.js +1 -1
- package/dist/feedback/feedback-submit-dialog.js.map +1 -1
- package/dist/feedback/feedback-submit.js +9 -3
- package/dist/feedback/feedback-submit.js.map +1 -1
- package/dist/feedback/feedback-swipe.d.ts +1 -1
- package/dist/feedback/feedback-swipe.js.map +1 -1
- package/dist/feedback/feedback-table.d.ts +21 -9
- package/dist/feedback/feedback-table.js +45 -25
- package/dist/feedback/feedback-table.js.map +1 -1
- package/dist/feedback/feedback-thread-labels.d.ts +2 -2
- package/dist/feedback/feedback-thread-labels.js.map +1 -1
- package/dist/feedback/feedback-thread.d.ts +24 -23
- package/dist/feedback/feedback-thread.js +2 -1
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/feedback.d.ts +34 -0
- package/dist/feedback.js +42 -0
- package/dist/feedback.js.map +1 -1
- package/dist/hooks/use-focus-trap.d.ts +35 -0
- package/dist/hooks/use-focus-trap.js +6 -4
- package/dist/hooks/use-focus-trap.js.map +1 -1
- package/dist/hooks/use-hotkey.d.ts +5 -2
- package/dist/hooks/use-hotkey.js +5 -4
- package/dist/hooks/use-hotkey.js.map +1 -1
- package/dist/hooks/use-long-press.d.ts +7 -4
- package/dist/hooks/use-long-press.js +3 -0
- package/dist/hooks/use-long-press.js.map +1 -1
- package/dist/hooks/use-media-query.js +12 -4
- package/dist/hooks/use-media-query.js.map +1 -1
- package/dist/hooks/use-mounted.d.ts +22 -0
- package/dist/hooks/use-mounted.js +24 -0
- package/dist/hooks/use-mounted.js.map +1 -0
- package/dist/hooks/use-overlay-history.js +19 -3
- package/dist/hooks/use-overlay-history.js.map +1 -1
- package/dist/i18n/defaults.js +4 -5
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.js +7 -1
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +9 -2
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/en.js +20 -41
- package/dist/i18n/locales/en.js.map +3 -3
- package/dist/i18n/locales/es.js +7 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +20 -10
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +9 -1
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +7 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +8 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +5 -0
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +64 -17
- package/dist/index.js +77 -12
- package/dist/index.js.map +1 -1
- package/dist/landing/routing.d.ts +3 -1
- package/dist/landing/routing.js +4 -7
- package/dist/landing/routing.js.map +1 -1
- package/dist/lib/broadcast.d.ts +17 -0
- package/dist/lib/broadcast.js +30 -0
- package/dist/lib/broadcast.js.map +1 -0
- package/dist/lib/date-format.d.ts +37 -2
- package/dist/lib/date-format.js +34 -8
- package/dist/lib/date-format.js.map +1 -1
- package/dist/lib/day-format.d.ts +46 -0
- package/dist/lib/day-format.js +46 -0
- package/dist/lib/day-format.js.map +1 -0
- package/dist/lib/describe-failure.d.ts +14 -0
- package/dist/lib/describe-failure.js +9 -0
- package/dist/lib/describe-failure.js.map +1 -0
- package/dist/lib/direction.d.ts +16 -0
- package/dist/lib/direction.js +9 -1
- package/dist/lib/direction.js.map +1 -1
- package/dist/lib/focus-left.d.ts +63 -0
- package/dist/lib/focus-left.js +67 -0
- package/dist/lib/focus-left.js.map +1 -0
- package/dist/lib/format.js +5 -14
- package/dist/lib/format.js.map +1 -1
- package/dist/lib/http-status.d.ts +24 -0
- package/dist/lib/http-status.js +14 -0
- package/dist/lib/http-status.js.map +1 -0
- package/dist/lib/intl-cache.d.ts +14 -0
- package/dist/lib/intl-cache.js +15 -0
- package/dist/lib/intl-cache.js.map +1 -0
- package/dist/lib/isin.d.ts +10 -0
- package/dist/lib/isin.js.map +1 -1
- package/dist/lib/iso-day.d.ts +11 -0
- package/dist/lib/iso-day.js +8 -0
- package/dist/lib/iso-day.js.map +1 -0
- package/dist/lib/lazy-with-fallback.d.ts +31 -0
- package/dist/lib/lazy-with-fallback.js +40 -0
- package/dist/lib/lazy-with-fallback.js.map +1 -0
- package/dist/lib/path-pattern.d.ts +34 -0
- package/dist/lib/path-pattern.js +24 -0
- package/dist/lib/path-pattern.js.map +1 -0
- package/dist/lib/reduced-motion.d.ts +2 -1
- package/dist/lib/reduced-motion.js.map +1 -1
- package/dist/lib/round.d.ts +2 -1
- package/dist/lib/round.js +2 -1
- package/dist/lib/round.js.map +1 -1
- package/dist/lib/safe-storage.d.ts +24 -5
- package/dist/lib/safe-storage.js +27 -2
- package/dist/lib/safe-storage.js.map +1 -1
- package/dist/lib/session-refresh.js +1 -1
- package/dist/lib/session-refresh.js.map +1 -1
- package/dist/lib/share-format.d.ts +13 -0
- package/dist/lib/share-format.js +10 -0
- package/dist/lib/share-format.js.map +1 -0
- package/dist/lib/text-case.d.ts +17 -0
- package/dist/lib/text-case.js +8 -0
- package/dist/lib/text-case.js.map +1 -0
- package/dist/lib/text-match.d.ts +29 -0
- package/dist/lib/text-match.js +20 -2
- package/dist/lib/text-match.js.map +1 -1
- package/dist/lib/thenable.d.ts +13 -0
- package/dist/lib/thenable.js +8 -0
- package/dist/lib/thenable.js.map +1 -0
- package/dist/lib/translation-review.d.ts +7 -2
- package/dist/lib/translation-review.js +4 -4
- package/dist/lib/translation-review.js.map +1 -1
- package/dist/notifications/device-zone-report.js +1 -1
- package/dist/notifications/device-zone-report.js.map +1 -1
- package/dist/notifications/notification-bell.d.ts +2 -1
- package/dist/notifications/notification-bell.js +3 -3
- package/dist/notifications/notification-bell.js.map +1 -1
- package/dist/notifications/notification-inbox.d.ts +10 -6
- package/dist/notifications/notification-inbox.js +26 -48
- package/dist/notifications/notification-inbox.js.map +1 -1
- package/dist/notifications/notification-parts.d.ts +3 -2
- package/dist/notifications/notification-parts.js +1 -3
- package/dist/notifications/notification-parts.js.map +1 -1
- package/dist/notifications/notification-types-setting.js +1 -1
- package/dist/notifications/notification-types-setting.js.map +1 -1
- package/dist/notifications/notifications-labels.d.ts +6 -0
- package/dist/notifications/notifications-labels.js +1 -0
- package/dist/notifications/notifications-labels.js.map +1 -1
- package/dist/notifications/push-device-setting.js +1 -1
- package/dist/notifications/push-device-setting.js.map +1 -1
- package/dist/notifications/push-devices-setting.d.ts +2 -1
- package/dist/notifications/push-devices-setting.js +27 -49
- package/dist/notifications/push-devices-setting.js.map +1 -1
- package/dist/notifications/quiet-hours-setting.d.ts +10 -3
- package/dist/notifications/quiet-hours-setting.js +65 -26
- package/dist/notifications/quiet-hours-setting.js.map +1 -1
- package/dist/notifications/unsubscribe-panel.js +4 -7
- package/dist/notifications/unsubscribe-panel.js.map +1 -1
- package/dist/notifications/use-push-device.d.ts +39 -1
- package/dist/notifications/use-push-device.js +28 -7
- package/dist/notifications/use-push-device.js.map +1 -1
- package/dist/offline/query-persistence.d.ts +3 -1
- package/dist/offline/query-persistence.js +19 -2
- package/dist/offline/query-persistence.js.map +1 -1
- package/dist/rhf/fields.d.ts +11 -4
- package/dist/rhf/fields.js.map +1 -1
- package/dist/search/command-palette.js +1 -1
- package/dist/search/command-palette.js.map +1 -1
- package/dist/search/global-search.js +19 -9
- package/dist/search/global-search.js.map +1 -1
- package/dist/search/use-command-key.d.ts +12 -1
- package/dist/search/use-command-key.js +3 -12
- package/dist/search/use-command-key.js.map +1 -1
- package/dist/search.d.ts +7 -0
- package/dist/search.js +10 -0
- package/dist/search.js.map +1 -1
- package/dist/settings/use-settings-focus.js +1 -0
- package/dist/settings/use-settings-focus.js.map +1 -1
- package/dist/shell/account-menu-language.d.ts +21 -5
- package/dist/shell/account-menu-language.js +3 -1
- package/dist/shell/account-menu-language.js.map +1 -1
- package/dist/shell/account-menu-text-size.d.ts +26 -9
- package/dist/shell/account-menu-text-size.js +3 -2
- package/dist/shell/account-menu-text-size.js.map +1 -1
- package/dist/shell/dev-menu.js +5 -18
- package/dist/shell/dev-menu.js.map +1 -1
- package/dist/shell/role-switcher.d.ts +7 -0
- package/dist/shell/role-switcher.js.map +1 -1
- package/dist/shell/top-bar-actions.d.ts +1 -1
- package/dist/shell/top-bar-actions.js.map +1 -1
- package/dist/shell/top-bar-parts-labels.d.ts +0 -2
- package/dist/shell/top-bar-parts-labels.js +0 -1
- package/dist/shell/top-bar-parts-labels.js.map +1 -1
- package/dist/shell.d.ts +27 -8
- package/dist/shell.js +28 -7
- package/dist/shell.js.map +1 -1
- package/dist/sync/engine.d.ts +30 -4
- package/dist/sync/engine.js +172 -52
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync.d.ts +6 -2
- package/dist/sync.js +6 -1
- package/dist/sync.js.map +1 -1
- package/dist/testing/css-variables.js +3 -8
- package/dist/testing/css-variables.js.map +1 -1
- package/dist/theme/contrast.d.ts +2 -1
- package/dist/theme/contrast.js +3 -8
- package/dist/theme/contrast.js.map +1 -1
- package/dist/theme/palette-store.js +6 -6
- package/dist/theme/palette-store.js.map +1 -1
- package/dist/theme/text-size.js +3 -8
- package/dist/theme/text-size.js.map +1 -1
- package/dist/theme/theme-store.js +3 -6
- package/dist/theme/theme-store.js.map +1 -1
- package/dist/tour/tour-catalogue.d.ts +7 -4
- package/dist/tour/tour-catalogue.js +12 -10
- package/dist/tour/tour-catalogue.js.map +1 -1
- package/dist/tour/tour-dock.d.ts +0 -2
- package/dist/tour/tour-dock.js +0 -2
- package/dist/tour/tour-dock.js.map +1 -1
- package/dist/tour/tour-gates.d.ts +4 -0
- package/dist/tour/tour-gates.js +14 -0
- package/dist/tour/tour-gates.js.map +1 -1
- package/dist/tour/tour-overlay.d.ts +27 -0
- package/dist/tour/tour-overlay.js +741 -0
- package/dist/tour/tour-overlay.js.map +1 -0
- package/dist/tour/tour.d.ts +13 -3
- package/dist/tour/tour.js +59 -781
- package/dist/tour/tour.js.map +1 -1
- package/dist/tour/use-tour-progress.js +1 -1
- package/dist/tour/use-tour-progress.js.map +1 -1
- package/dist/wizard/stepper-nav.d.ts +5 -1
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard/types.d.ts +6 -2
- package/dist/wizard/types.js.map +1 -1
- package/dist/wizard/use-wizard.d.ts +3 -1
- package/dist/wizard/use-wizard.js.map +1 -1
- package/dist/wizard/validation.d.ts +3 -1
- package/dist/wizard/validation.js.map +1 -1
- package/package.json +10 -6
- package/src/account/account-parts.ts +5 -25
- package/src/account/data-export-setting-labels.ts +1 -1
- package/src/account/delete-account-setting-labels.ts +1 -1
- package/src/account/email-change-setting-labels.ts +1 -1
- package/src/account/passkeys-setting.tsx +60 -38
- package/src/account/sessions-setting.tsx +18 -12
- package/src/admin/admin-action-confirm.tsx +1 -5
- package/src/admin/admin-parts.ts +11 -25
- package/src/admin/mail-test-card-labels.ts +1 -1
- package/src/admin/plan-change-labels.ts +5 -23
- package/src/admin/plan-change.tsx +7 -44
- package/src/admin/reviewer-scope-editor.tsx +3 -3
- package/src/auth/auth-errors-labels.ts +23 -0
- package/src/auth/auth-errors.ts +11 -38
- package/src/auth/complete-name-dialog.tsx +4 -1
- package/src/auth/forgot-password-form-labels.ts +1 -1
- package/src/auth/forgot-password-form.tsx +11 -6
- package/src/auth/register-form-labels.ts +1 -1
- package/src/auth/reset-password-form-labels.ts +1 -1
- package/src/auth/reset-password-form.tsx +8 -4
- package/src/auth/sign-in-form-labels.ts +1 -1
- package/src/auth/status-parts.tsx +0 -6
- package/src/auth/verify-email-labels.ts +1 -1
- package/src/auth/verify-email.tsx +11 -6
- package/src/billing/cancel-subscription.tsx +26 -12
- package/src/billing/dialog-close.ts +34 -0
- package/src/billing/plan-card.tsx +36 -11
- package/src/billing/plan-change-labels.ts +66 -0
- package/src/billing/plan-switch.tsx +26 -12
- package/src/chart.ts +21 -3
- package/src/components/account-chips.tsx +20 -23
- package/src/components/alert-banner.tsx +82 -5
- package/src/components/amount-input.tsx +18 -7
- package/src/components/autocomplete.tsx +64 -70
- package/src/components/bulk-action-bar.tsx +70 -2
- package/src/components/button-look.ts +5 -5
- package/src/components/button.tsx +2 -2
- package/src/components/chart-edge.ts +34 -1
- package/src/components/chart-figure.tsx +35 -0
- package/src/components/chart-zoom-core.tsx +6 -5
- package/src/components/chart.tsx +26 -5
- package/src/components/combobox-core.tsx +293 -62
- package/src/components/combobox.tsx +183 -153
- package/src/components/copy-button.tsx +34 -23
- package/src/components/country-select.tsx +16 -11
- package/src/components/data-table-column-settings.tsx +52 -10
- package/src/components/data-table-filters.ts +6 -4
- package/src/components/data-table-fit.ts +19 -5
- package/src/components/data-table-groups.tsx +1 -1
- package/src/components/data-table-head.tsx +32 -22
- package/src/components/data-table-mobile.tsx +61 -26
- package/src/components/data-table-pagination.tsx +21 -6
- package/src/components/data-table-resize.ts +1 -1
- package/src/components/data-table-row-actions.tsx +3 -3
- package/src/components/data-table-row.tsx +25 -14
- package/src/components/data-table-selection.ts +1 -1
- package/src/components/data-table-shared.tsx +33 -1
- package/src/components/data-table-sort.ts +57 -2
- package/src/components/data-table-virtual.ts +32 -8
- package/src/components/data-table.tsx +239 -68
- package/src/components/date-field.tsx +65 -8
- package/src/components/date-picker.tsx +125 -48
- package/src/components/date-range-picker.tsx +82 -31
- package/src/components/error-boundary.tsx +53 -39
- package/src/components/field-base-labels.ts +20 -0
- package/src/components/field-base.tsx +13 -7
- package/src/components/field-sync-labels.ts +1 -0
- package/src/components/field-sync.tsx +23 -1
- package/src/components/form-actions.tsx +20 -5
- package/src/components/hover-menu.tsx +18 -8
- package/src/components/icon-button.tsx +14 -9
- package/src/components/inline-confirm.tsx +116 -0
- package/src/components/inline-entity-combobox.tsx +197 -153
- package/src/components/input.tsx +1 -1
- package/src/components/jump-calendar.tsx +30 -146
- package/src/components/legal-page.tsx +10 -7
- package/src/components/legal.tsx +4 -2
- package/src/components/lightbox.tsx +21 -8
- package/src/components/list.tsx +10 -4
- package/src/components/measured-grid.tsx +8 -4
- package/src/components/mini-calendar.tsx +6 -5
- package/src/components/modal.tsx +6 -1
- package/src/components/month-grid.tsx +229 -0
- package/src/components/month-picker.tsx +192 -200
- package/src/components/multi-select.tsx +21 -9
- package/src/components/picker-sheet.tsx +12 -9
- package/src/components/pie-chart-labels.ts +8 -0
- package/src/components/pie-chart.tsx +22 -28
- package/src/components/popover.tsx +18 -1
- package/src/components/row-actions.tsx +2 -1
- package/src/components/section-nav.tsx +7 -0
- package/src/components/series-chart-axes.ts +3 -3
- package/src/components/series-chart-labels.ts +7 -4
- package/src/components/series-chart.tsx +178 -69
- package/src/components/share-card.tsx +6 -6
- package/src/components/sign-chip-labels.ts +1 -0
- package/src/components/sign-chip.tsx +10 -1
- package/src/components/tabs-labels.ts +13 -0
- package/src/components/tabs.tsx +2 -2
- package/src/components/toggle-legend.tsx +16 -11
- package/src/components/translation-review-editor.tsx +6 -5
- package/src/components/translation-review.tsx +4 -3
- package/src/components/treemap-labels.ts +39 -0
- package/src/components/treemap-layout.ts +210 -0
- package/src/components/treemap.tsx +722 -133
- package/src/components/use-table-state.ts +12 -9
- package/src/data-table.ts +9 -2
- package/src/eslint/role-utilities.ts +97 -19
- package/src/feedback/feedback-dialog.tsx +30 -19
- package/src/feedback/feedback-mutation.ts +41 -0
- package/src/feedback/feedback-page-link.ts +90 -0
- package/src/feedback/feedback-public-list.tsx +17 -5
- package/src/feedback/feedback-replies.tsx +13 -6
- package/src/feedback/feedback-row-detail-labels.ts +5 -0
- package/src/feedback/feedback-row-detail.tsx +103 -67
- package/src/feedback/feedback-status-undo.ts +41 -27
- package/src/feedback/feedback-submit-dialog.tsx +2 -2
- package/src/feedback/feedback-submit.tsx +21 -7
- package/src/feedback/feedback-swipe.tsx +1 -1
- package/src/feedback/feedback-table.tsx +86 -38
- package/src/feedback/feedback-thread-labels.ts +2 -2
- package/src/feedback/feedback-thread.tsx +27 -25
- package/src/feedback.ts +42 -0
- package/src/hooks/use-focus-trap.ts +8 -24
- package/src/hooks/use-hotkey.ts +24 -7
- package/src/hooks/use-long-press.ts +16 -2
- package/src/hooks/use-media-query.ts +20 -4
- package/src/hooks/use-mounted.ts +39 -0
- package/src/hooks/use-overlay-history.ts +32 -3
- package/src/i18n/defaults.ts +4 -5
- package/src/i18n/german.ts +8 -2
- package/src/i18n/kit-labels.tsx +9 -2
- package/src/i18n/locales/es.ts +8 -2
- package/src/i18n/locales/fr.ts +21 -13
- package/src/i18n/locales/hu.ts +10 -2
- package/src/i18n/locales/it.ts +8 -2
- package/src/i18n/locales/zh.ts +9 -2
- package/src/i18n/review.ts +5 -0
- package/src/index.ts +103 -13
- package/src/landing/routing.tsx +14 -10
- package/src/lib/broadcast.ts +52 -0
- package/src/lib/date-format.ts +89 -13
- package/src/lib/day-format.ts +96 -0
- package/src/lib/describe-failure.ts +18 -0
- package/src/lib/direction.ts +39 -0
- package/src/lib/focus-left.ts +156 -0
- package/src/lib/format.ts +5 -17
- package/src/lib/http-status.ts +38 -0
- package/src/lib/intl-cache.ts +25 -0
- package/src/lib/isin.ts +10 -0
- package/src/lib/iso-day.ts +13 -0
- package/src/lib/lazy-with-fallback.ts +82 -0
- package/src/lib/path-pattern.ts +55 -0
- package/src/lib/reduced-motion.ts +2 -1
- package/src/lib/round.ts +7 -2
- package/src/lib/safe-storage.ts +48 -6
- package/src/lib/session-refresh.ts +1 -1
- package/src/lib/share-format.ts +18 -0
- package/src/lib/text-case.ts +19 -0
- package/src/lib/text-match.ts +57 -2
- package/src/lib/thenable.ts +19 -0
- package/src/lib/translation-review.ts +13 -5
- package/src/notifications/device-zone-report.ts +1 -1
- package/src/notifications/notification-bell.tsx +7 -4
- package/src/notifications/notification-inbox.tsx +40 -58
- package/src/notifications/notification-parts.tsx +3 -4
- package/src/notifications/notification-types-setting.tsx +1 -1
- package/src/notifications/notifications-labels.ts +7 -0
- package/src/notifications/push-device-setting.tsx +1 -1
- package/src/notifications/push-devices-setting.tsx +30 -55
- package/src/notifications/quiet-hours-setting.tsx +93 -31
- package/src/notifications/unsubscribe-panel.tsx +4 -7
- package/src/notifications/use-push-device.ts +76 -10
- package/src/offline/query-persistence.ts +35 -3
- package/src/rhf/fields.tsx +11 -4
- package/src/search/command-palette.tsx +2 -4
- package/src/search/global-search.tsx +36 -15
- package/src/search/use-command-key.ts +13 -12
- package/src/search.ts +9 -0
- package/src/settings/use-settings-focus.ts +3 -0
- package/src/shell/account-menu-language.tsx +27 -5
- package/src/shell/account-menu-text-size.tsx +32 -10
- package/src/shell/dev-menu.tsx +7 -21
- package/src/shell/role-switcher.tsx +7 -0
- package/src/shell/top-bar-actions.tsx +1 -1
- package/src/shell/top-bar-parts-labels.ts +0 -3
- package/src/shell.ts +40 -9
- package/src/sync/engine.ts +339 -61
- package/src/sync.ts +8 -1
- package/src/testing/css-variables.ts +8 -9
- package/src/theme/contrast.ts +8 -9
- package/src/theme/palette-store.ts +9 -9
- package/src/theme/text-size.ts +6 -8
- package/src/theme/theme-store.ts +7 -9
- package/src/tour/tour-catalogue.tsx +26 -15
- package/src/tour/tour-dock.ts +0 -2
- package/src/tour/tour-gates.ts +23 -0
- package/src/tour/tour-overlay.tsx +1170 -0
- package/src/tour/tour.tsx +108 -1202
- package/src/tour/use-tour-progress.ts +1 -1
- package/src/wizard/stepper-nav.tsx +3 -1
- package/src/wizard/types.ts +11 -2
- package/src/wizard/use-wizard.ts +2 -1
- package/src/wizard/validation.ts +8 -2
- package/tokens.css +2 -1
- package/dist/components/ui-labels.js.map +0 -1
- package/dist/shell/dev-switchers.d.ts +0 -6
- package/dist/shell/dev-switchers.js +0 -12
- package/dist/shell/dev-switchers.js.map +0 -1
- package/src/components/ui-labels.ts +0 -24
- package/src/shell/dev-switchers.tsx +0 -18
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useId, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
4
4
|
import { AlertTriangle, CheckCircle2, ChevronRight, Info, X } from "lucide-react";
|
|
5
5
|
import { cn } from "../lib/cn.js";
|
|
6
6
|
import { FOCUS_RING } from "./focus-ring.js";
|
|
7
7
|
import { DEFAULT_COMMON_LABELS, useKitLabels } from "../i18n/kit-labels.js";
|
|
8
|
+
import { focusFirst, focusIsLost, tabStopsAround, whenFocusLeftForNothing } from "../lib/focus-left.js";
|
|
8
9
|
const TONE_FRAME = {
|
|
9
10
|
danger: "border-2 border-danger-strong bg-danger-soft",
|
|
10
11
|
warning: "border-2 border-warning bg-warning-soft",
|
|
@@ -61,6 +62,7 @@ function AlertBanner({
|
|
|
61
62
|
action,
|
|
62
63
|
icon,
|
|
63
64
|
onDismiss,
|
|
65
|
+
dismissFocusRef,
|
|
64
66
|
dismissLabel,
|
|
65
67
|
clampMobile = false,
|
|
66
68
|
actionPlacement = "own-line",
|
|
@@ -93,6 +95,21 @@ function AlertBanner({
|
|
|
93
95
|
ro?.observe(el);
|
|
94
96
|
return () => ro?.disconnect();
|
|
95
97
|
}, [clamp, expanded, children]);
|
|
98
|
+
const dismissedFrom = useRef(null);
|
|
99
|
+
const dismissTarget = useRef(dismissFocusRef);
|
|
100
|
+
useLayoutEffect(() => {
|
|
101
|
+
dismissTarget.current = dismissFocusRef;
|
|
102
|
+
});
|
|
103
|
+
const unwatchFocus = useRef(null);
|
|
104
|
+
useEffect(
|
|
105
|
+
() => () => {
|
|
106
|
+
unwatchFocus.current?.();
|
|
107
|
+
const around = dismissedFrom.current;
|
|
108
|
+
if (!around || !focusIsLost()) return;
|
|
109
|
+
focusFirst([dismissTarget.current?.current, ...around]);
|
|
110
|
+
},
|
|
111
|
+
[]
|
|
112
|
+
);
|
|
96
113
|
const Glyph = TONE_GLYPH[tone];
|
|
97
114
|
const nudge = inlineRow || strip ? void 0 : sm ? "mt-px" : "mt-0.5";
|
|
98
115
|
const glyph = icon === null ? null : icon !== void 0 ? /* @__PURE__ */ jsx(
|
|
@@ -181,6 +198,34 @@ function AlertBanner({
|
|
|
181
198
|
onClick: (e) => {
|
|
182
199
|
e.preventDefault();
|
|
183
200
|
e.stopPropagation();
|
|
201
|
+
const frame2 = e.currentTarget.parentElement;
|
|
202
|
+
if (frame2 && e.currentTarget.ownerDocument.activeElement === e.currentTarget) {
|
|
203
|
+
const { after, before } = tabStopsAround(frame2);
|
|
204
|
+
dismissedFrom.current = [...after, ...before];
|
|
205
|
+
unwatchFocus.current?.();
|
|
206
|
+
const doc = frame2.ownerDocument;
|
|
207
|
+
const forget = () => {
|
|
208
|
+
dismissedFrom.current = null;
|
|
209
|
+
unwatch();
|
|
210
|
+
};
|
|
211
|
+
const onFocusIn = (event) => {
|
|
212
|
+
if (event.target instanceof Node && frame2.contains(event.target)) return;
|
|
213
|
+
forget();
|
|
214
|
+
};
|
|
215
|
+
const onFocusOut = (event) => {
|
|
216
|
+
whenFocusLeftForNothing(event, () => {
|
|
217
|
+
if (unwatchFocus.current === unwatch) forget();
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
const unwatch = () => {
|
|
221
|
+
doc.removeEventListener("focusin", onFocusIn, true);
|
|
222
|
+
frame2.removeEventListener("focusout", onFocusOut);
|
|
223
|
+
unwatchFocus.current = null;
|
|
224
|
+
};
|
|
225
|
+
doc.addEventListener("focusin", onFocusIn, true);
|
|
226
|
+
frame2.addEventListener("focusout", onFocusOut);
|
|
227
|
+
unwatchFocus.current = unwatch;
|
|
228
|
+
}
|
|
184
229
|
onDismiss();
|
|
185
230
|
},
|
|
186
231
|
className: cn(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/alert-banner.tsx"],"sourcesContent":["import { useId, useLayoutEffect, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, MouseEvent, ReactNode, Ref } from \"react\";\nimport { AlertTriangle, CheckCircle2, ChevronRight, Info, X } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { FOCUS_RING } from \"./focus-ring\";\nimport { DEFAULT_COMMON_LABELS, useKitLabels } from \"../i18n/kit-labels\";\n\n/** `info` (0.8.0) is the sky family, for news that is neither good nor bad: keksdose's\n * preview and beta-performance banners, which borrowed `warning` for want of it and\n * so told every user of the preview build that something was wrong. */\nexport type AlertTone = \"danger\" | \"warning\" | \"info\" | \"success\" | \"neutral\";\n\n/** `sm` (0.10.0): 12px type and a 14px glyph — the hint line under a field or a total\n * that keksdose spells `text-xs text-amber-700 dark:text-amber-400` by hand\n * (accounts-page's missing-rate note, import-map-step, guest-key-control's two\n * key states, goal-form). At body size those read as a second heading. */\nexport type AlertSize = \"sm\" | \"md\";\n\n/** Border + surface per tone, WITHOUT a radius or padding, so a caller that owns\n * its own box (a Card, say) can take the tone alone. Single source for both\n * {@link alertFrameClass} and {@link toneFrameClass}.\n *\n * The colored tones are 2px, not 1px, and that is load-bearing rather than\n * decorative. A 1px border is 1.25 device pixels on a 125%-scaled display — the\n * usual Windows setting — so whether it renders as a solid line or as two\n * half-lit pixels depends on where the box happens to land in device-pixel space.\n * The same card then shows a heavy left edge and a right edge that fades out,\n * which is what feedback #264, #277, #491 and #498 all reported. A 2px border is\n * 2.5 device pixels: it always covers at least two pixels fully, on both edges,\n * at any offset. Callers compensate the extra pixel in their own padding so\n * switching tones never shifts the layout. */\nconst TONE_FRAME: Record<AlertTone, string> = {\n danger: \"border-2 border-danger-strong bg-danger-soft\",\n warning: \"border-2 border-warning bg-warning-soft\",\n info: \"border-2 border-info bg-info-soft\",\n success: \"border-2 border-success bg-success-soft\",\n neutral: \"border border-subtle\",\n};\n\n/** `elevated`: the same frame on an OPAQUE surface. The dark tone washes are\n * translucent (a 20–25 % tint), which is right on a page and wrong on anything that\n * floats over one — keksdose's server-wake notice (#209) let the page's own text\n * show through the one message whose job is to be read when nothing else makes\n * sense. So the surface becomes `--bg-surface` and the tone's wash is layered on it\n * as a background IMAGE (a flat gradient), which keeps the exact tint in both themes\n * without a second, opaque copy of every `-bg` token. */\nconst TONE_ELEVATED: Record<AlertTone, string> = {\n danger: \"bg-[image:linear-gradient(var(--danger-bg),var(--danger-bg))]\",\n warning: \"bg-[image:linear-gradient(var(--warning-bg),var(--warning-bg))]\",\n info: \"bg-[image:linear-gradient(var(--info-bg),var(--info-bg))]\",\n success: \"bg-[image:linear-gradient(var(--success-bg),var(--success-bg))]\",\n neutral: \"\",\n};\nconst ELEVATED = \"bg-surface shadow-lg\";\n\n/** The tone's border + surface on their own — for a caller that already has a box\n * with its own radius and padding (e.g. a Card). Remember to shave 1px off that\n * padding for the colored tones, whose border is 2px wide. */\nexport function toneFrameClass(tone: AlertTone): string {\n return TONE_FRAME[tone];\n}\n\n/** Single source for the warning-callout frame (feedback #277): the tone's border\n * and surface plus this component's own radius and padding, the latter\n * compensating the 2px colored border so toggling tones never shifts layout.\n *\n * The compensation is `calc(<the neutral padding in rem> - 1px)`, not a px figure\n * (0.32, docs/text-size-harmonization.md §3.2): the padding grows with the text size,\n * the 1px it gives back to the border does not — an 11 px padding stopped matching `p-3`\n * at 125 %, and toggling the tone shifted the layout again. */\nexport function alertFrameClass(tone: AlertTone, size: AlertSize = \"md\"): string {\n const box =\n size === \"sm\"\n ? tone === \"neutral\"\n ? \"rounded-md px-2.5 py-1.5\"\n : \"rounded-md px-[calc(0.625rem-1px)] py-[calc(0.375rem-1px)]\"\n : tone === \"neutral\"\n ? \"rounded-md p-3\"\n : \"rounded-md p-[calc(0.75rem-1px)]\";\n return `${box} ${TONE_FRAME[tone]}`;\n}\n\n/** The `strip` frame: the tone's surface edge to edge, no radius, and only the BOTTOM\n * border, 1px — a strip is a band across the top of a page, and its one visible edge\n * is the line it draws under itself. kastlan's trial, past-due and tour banners. */\nfunction stripFrameClass(tone: AlertTone, size: AlertSize): string {\n return cn(TONE_FRAME[tone], \"rounded-none border-0 border-b\", size === \"sm\" ? \"px-4 py-1.5\" : \"px-4 py-2\");\n}\n\nconst TONE_TEXT: Record<AlertTone, string> = {\n danger: \"text-danger\",\n warning: \"text-warning\",\n info: \"text-info\",\n success: \"text-success\",\n neutral: \"text-secondary\",\n};\n\nconst TONE_ICON: Record<AlertTone, string> = {\n danger: \"text-danger\",\n warning: \"text-warning\",\n info: \"text-info\",\n success: \"text-success\",\n neutral: \"text-muted\",\n};\n\n/** Which glyph a tone draws when the caller names none. The triangle belongs to the\n * two tones that mean \"something is wrong\"; `info` and `neutral` get the ⓘ. That is\n * what makes `neutral` safe to offer at all: until 0.8.0 it was withheld because a\n * triangle with no colour is a warning that looks like a note — and a neutral note\n * that draws no triangle is simply a note (lenkbank's \"values are rounded\"). */\nconst TONE_GLYPH: Record<AlertTone, typeof AlertTriangle> = {\n danger: AlertTriangle,\n warning: AlertTriangle,\n info: Info,\n success: CheckCircle2,\n neutral: Info,\n};\n\ninterface AlertBannerBaseProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onClick\"> {\n /** Default `danger`. `info` for news, `neutral` for a plain note — see\n * {@link TONE_GLYPH} for why a neutral banner is now allowed. */\n tone?: AlertTone;\n /**\n * `box` (default): the framed callout. `inline`: the tone's colour, glyph and role\n * and NOTHING else — no border, no surface, no padding — so it fits inside a\n * toolbar row beside the controls it is about. Lenkbank's corner-motion toolbar\n * shows \"Radius below the minimum\" and \"Solving…\" there; a box would have doubled\n * the row's height every time either appeared.\n *\n * The inline variant is also a LIVE REGION by default — `role=\"alert\"` for\n * `danger`, `role=\"status\"` for the rest — because a message that appears in a\n * toolbar in answer to what the user just did is exactly the kind a screen reader\n * otherwise never hears. The box stays role-less as it always was: it is usually\n * page furniture present at load, and an alert that fires on every navigation is\n * noise. Either way a `role` you pass wins.\n *\n * `strip` (0.10.0): a band across the top of a page or a panel — edge to edge, no\n * radius, only a bottom border, content centred on one line, and usually an\n * {@link action}. kastlan's billing trial-banner and past-due-banner and its tours\n * tour-banner each built this by hand in amber or red Tailwind classes, with a\n * separate dark: spelling apiece. Role-less like the box: it is page furniture.\n */\n variant?: \"box\" | \"inline\" | \"strip\";\n /** See {@link AlertSize}. Default `md`. */\n size?: AlertSize;\n /**\n * `inline` only (0.11.0): lay the message out as a BLOCK — a full-width `flex` row,\n * the glyph on the text's FIRST line when it wraps — instead of the `inline-flex`,\n * centred line it is by default. keksdose writes `className=\"flex\"` on nearly every\n * inline banner it has (accounts-page:564, holdings-panel:631, import-map-step:66/314,\n * guest-key-control:84) to get a line of its own under a total or a field, and a\n * two-line hint there then centres its glyph between the lines.\n *\n * An option rather than the new default, because the inline-flex is load-bearing for\n * the callers the variant was made for: lenkbank's corner-motion toolbar\n * (corner-motion.tsx:178) sets it as a `shrink-0` item beside the controls, kastlan's\n * import page and keksdose's rules page place it in a run of content — a block would\n * take the whole row in the second kind, and top-align the first against a taller\n * control. Ignored by `box` and `strip`, which are blocks already.\n */\n block?: boolean;\n /**\n * `false` opts an inline banner out of its live region (no `role=\"alert\"` /\n * `role=\"status\"`), for a message that is static page content rather than the answer\n * to something the user just did: keksdose's CAMT review step (camt-review-step:214)\n * renders \"unresolved rows block the import\" as part of the step, and as\n * `role=\"alert\"` a screen reader interrupted with it on every mount. A `role` you pass\n * still wins. Default `true`; the box and the strip are role-less either way.\n */\n live?: boolean;\n /**\n * An opaque, raised surface (a shadow, and no translucency in dark mode) for a\n * notice that floats over the page — see {@link TONE_ELEVATED}. `box` and `strip`\n * only; an inline message has no surface to raise.\n */\n elevated?: boolean;\n /**\n * A trailing control — the \"Update payment method\" button on kastlan's trial and\n * past-due strips, the \"Exit\" on its tour strip. Sits at the end of the row,\n * vertically centred, and never shrinks. On a whole-row banner (`href`/`onClick`)\n * it is rendered BESIDE the row's own link or button, as the × is, because\n * interactive content may not nest.\n */\n action?: ReactNode;\n /** Replaces the tone's glyph — a `<Spinner label={null} />` for \"Solving…\", say.\n * `null` draws none. Always decorative; the text carries the message. */\n icon?: ReactNode;\n /** Renders an × at the end that calls this. The banner does not hide itself — the\n * caller removes it (and remembers that it did), as with every other kit control\n * whose state is app state. */\n onDismiss?: () => void;\n /** Accessible name of the ×. Default: `common.dismiss` from the\n * {@link UiKitProvider}, else \"Dismiss\". */\n dismissLabel?: string;\n /**\n * 0.48: on a phone (below the kit's text-size-aware `md`) hold the message to ONE line,\n * with a \"More\" / \"Less\" toggle after it (`aria-expanded`, `aria-controls` the message;\n * `common.showMore` / `common.showLess`). From `md` up nothing changes. The toggle only\n * shows while the line actually cuts the message off.\n *\n * keksdose dev#611 (UX-1.2): its beta notice took three to four lines (~100px) above\n * every phone screen, and the app built the clamp and the button around the banner's\n * children by hand. Ignored on a whole-row banner (`href` / `onClick`): a toggle cannot\n * sit inside the row's own link or button.\n *\n * 0.51 (kastlan K1): on a `strip` the clamped message claims 7rem instead of 12rem below\n * `md`, so the {@link action} stays on its line rather than taking one of its own.\n *\n * For a one-line MESSAGE (a sentence or two). Not for a body with a list or a control in\n * it: the clamp cuts the box to its first line, so a Disclosure's or a link's trigger\n * past it is clipped out of sight and still takes the keyboard's focus, and \"More\" gives\n * back the whole body at once. Shorten such a banner instead — one sentence, its action,\n * and the rest behind a Disclosure of its own (keksdose's agree-again notice, 0.51).\n */\n clampMobile?: boolean;\n /**\n * Where a box's {@link action} goes on a phone (below `sm`). 0.48.\n *\n * `own-line` (default): a line of its own under the message, lined up with it\n * (kastlan 53 — a long message beside a long button squeezed into a column).\n *\n * `flow`: on the message's line while the message (with its glyph) keeps 10rem, else at the END of the\n * next line — for a short message and a short action, which a line of their own each\n * would stack for nothing. keksdose dev #623: the budget card's \"5 underfunded\n * categories\" + \"Assign\" built this with descendant overrides on the kit's classes.\n * The basis is in rem, so it grows with the text size: at Large the action drops a\n * line sooner, by itself. The × stays at the top end either way; `clampMobile` works\n * alongside. From `sm` up nothing changes. Ignored by `strip` (which flows like this\n * already) and `inline`.\n */\n actionPlacement?: \"own-line\" | \"flow\";\n children: ReactNode;\n /**\n * The banner's frame — where the rest of the props go (0.34, API-2, refactor audit\n * 2026-10). Which element that is depends on the mode: the `<div>`; with `href` or\n * `onClick` the `<a>` or `<button>` that IS the row; with an × or an `action` beside\n * that row, the `<div>` holding the two. Hence `HTMLElement`.\n */\n ref?: Ref<HTMLElement>;\n}\n\n/**\n * The whole-row modes. keksdose's budget-summary card is a banner you tap to open\n * the budget; built from a `<div onClick>` it was a mouse-only target, and built as a\n * banner with a link inside it was a small target inside a big one that looked like\n * one. So `onClick` makes the banner itself ONE `<button>`, and `href` makes it one\n * `<a>`, with a trailing chevron that says so. Mutually exclusive, as on `Chip`.\n *\n * With `onDismiss` as well, the × cannot go inside the button (interactive content\n * may not nest), so the frame becomes a wrapper holding two siblings: the row's\n * button, stretched over the whole frame, and the × on top of it. It still looks and\n * clicks like one banner with an × in its corner, and the two are separate tab stops.\n */\nexport type AlertBannerProps = AlertBannerBaseProps &\n (\n | {\n /** Makes the whole banner one link. Mutually exclusive with `onClick`. */\n href?: string;\n onClick?: never;\n }\n | {\n href?: never;\n /** Makes the whole banner one button. Mutually exclusive with `href`. The\n * event's element is the `<button>`, not a `<div>`. */\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n }\n );\n\n/** Warning/danger/info callout box with the shared frame and an icon — or, with\n * `variant=\"inline\"`, the same message as a frameless line of toned text. */\nexport function AlertBanner({\n tone = \"danger\",\n variant = \"box\",\n size = \"md\",\n block = false,\n live = true,\n elevated = false,\n action,\n icon,\n onDismiss,\n dismissLabel,\n clampMobile = false,\n actionPlacement = \"own-line\",\n href,\n onClick,\n className,\n children,\n role,\n ref,\n ...rest\n}: AlertBannerProps) {\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS, { dismiss: dismissLabel });\n const inline = variant === \"inline\";\n const strip = variant === \"strip\";\n const sm = size === \"sm\";\n const interactive = href !== undefined || onClick !== undefined;\n // A block-laid inline banner behaves like a box for layout: a row that may wrap.\n const inlineRow = inline && !block;\n const resolvedRole = role ?? (inline && live ? (tone === \"danger\" ? \"alert\" : \"status\") : undefined);\n\n // `clampMobile`: the message's one-line clamp below `md`, and whether that line holds\n // it all (then there is nothing to show \"More\" of). Measured while collapsed — the\n // clamp is what makes `scrollHeight` exceed the box — and again whenever its box\n // changes size, which a rotation or crossing `md` does. With no layout (a test, the\n // server) the box is 0 tall, which reads as \"may not fit\": the toggle stays.\n const clamp = clampMobile && !interactive;\n const bodyId = useId();\n const bodyRef = useRef<HTMLDivElement>(null);\n const [expanded, setExpanded] = useState(false);\n const [fits, setFits] = useState(false);\n useLayoutEffect(() => {\n const el = bodyRef.current;\n if (!clamp || expanded || !el) return;\n const check = () => setFits(el.clientHeight > 0 && el.scrollHeight <= el.clientHeight + 1);\n check();\n const ro = typeof ResizeObserver === \"undefined\" ? null : new ResizeObserver(check);\n ro?.observe(el);\n return () => ro?.disconnect();\n }, [clamp, expanded, children]);\n\n const Glyph = TONE_GLYPH[tone];\n // Onto the first line of a box's text: 2px at 14px/20px, 1px at 12px/16px.\n const nudge = inlineRow || strip ? undefined : sm ? \"mt-px\" : \"mt-0.5\";\n const glyph =\n icon === null ? null : icon !== undefined ? (\n <span\n aria-hidden\n className={cn(\"flex shrink-0\", sm ? \"[&_svg]:size-3.5\" : \"[&_svg]:size-4\", nudge, TONE_ICON[tone])}\n >\n {icon}\n </span>\n ) : (\n <Glyph aria-hidden className={cn(sm ? \"size-3.5\" : \"size-4\", \"shrink-0\", nudge, TONE_ICON[tone])} />\n );\n\n // The row layout, shared by every shape below. A strip centres, and WRAPS: on a\n // phone a long message plus an action would otherwise squeeze the text into a narrow\n // column, so the action drops under it instead. A box may wrap its text, so it\n // top-aligns and nudges the glyph onto the first line.\n // A BOX with an action wraps too, below sm only (kastlan 53): the verify-email box\n // squeezed \"Please confirm your email address…\" into a ~100px column beside a\n // \"Resend verification email\" button. There the action takes a line of its own under\n // the message, and the × stays at the top end; from sm up the box is one row as before.\n const boxAction = !inline && !strip && action !== undefined && action !== null;\n // `flow` (0.48): glyph + message and the action in a row of their own that wraps\n // below sm; the × stays outside it, at the top end.\n const flow = boxAction && actionPlacement === \"flow\";\n const boxWraps = boxAction && !flow;\n const flowRow = cn(\"flex min-w-0 flex-1 items-center max-sm:flex-wrap\", sm ? \"gap-1.5\" : \"gap-2\");\n // The 10rem the message keeps beside the action before the action wraps.\n const flowBasis = flow ? \"max-sm:basis-40\" : undefined;\n const row = cn(\n inlineRow\n ? \"inline-flex items-center\"\n : strip\n ? \"flex flex-wrap items-center gap-y-1\"\n : cn(\"flex items-start\", boxWraps && \"max-sm:flex-wrap max-sm:gap-y-2\"),\n sm ? \"gap-1.5 text-xs\" : inline ? \"gap-1.5 text-sm\" : \"gap-2 text-sm\",\n );\n // The strip's message claims 12rem before anything shrinks. `flex-1` is a 0 basis,\n // which never makes a wrapping row wrap — the action and the × squeezed the message\n // into a three-word column on a phone instead. With a real basis the action drops to\n // a second line once message + action no longer fit, and the message keeps the width.\n const grow = strip ? \"flex-[1_1_12rem]\" : \"flex-1\";\n // …except a CLAMPED strip on a phone (0.51, kastlan K1 / prod #22, KX-5). There the\n // message is one line whatever its width (the rest is behind \"More\"), so the 12rem only\n // pushed the action under it: \"Erneut senden\" took a line of its own on a 390px phone,\n // and kastlan's banner stood 71px where one line is 43. The clamp needs its \"More\" and\n // the first words beside it, so below `md` the basis is 7rem (~4rem of text). Measured\n // in Chromium at 390 × 844, kastlan's `mx-4` strip (326px inside): one line, 43px, in\n // all seven catalogues, with Roboto and with the wider DejaVu Sans; French, the longest\n // \"Send again\", keeps 8px. At 360px French (and Spanish in DejaVu) still drop a line.\n // A rem basis like the 12rem, so at Large the action drops a line sooner, by itself.\n // From `md` up the clamp is off and the 12rem holds; without `clampMobile` nothing moves.\n const clampBasis = strip && clamp ? \"max-md:basis-28\" : undefined;\n // Inside a whole-row banner's button or link, which then carries `grow` itself.\n const nested = interactive && (onDismiss !== undefined || (action !== undefined && action !== null));\n const frame = inline\n ? \"\"\n : cn(\n strip ? stripFrameClass(tone, size) : alertFrameClass(tone, size),\n elevated && cn(ELEVATED, TONE_ELEVATED[tone]),\n );\n const focusRing = cn(FOCUS_RING, \"focus-visible:ring-offset-1 focus-visible:ring-offset-surface\");\n\n // The message's box: a `<div>` (0.51), so a banner may hold block content — keksdose's\n // agree-again notice has a list and a Disclosure in it, which inside the `<span>` this was\n // were block elements in phrasing content. A `<span>` still in a whole-row banner, whose\n // `<a>` / `<button>` takes phrasing content only.\n const Body = interactive ? \"span\" : \"div\";\n const contentBody = clamp ? (\n // Below `md` a row: the message, clamped, then the toggle on its baseline. From\n // `md` up a plain box with the message in it, as without the prop. (Never a whole-row\n // banner, so always a `<div>`.)\n <div\n className={cn(\n !inlineRow && grow,\n clampBasis,\n \"min-w-0 text-start max-md:flex max-md:items-baseline max-md:gap-2\",\n )}\n >\n {/* The clamp is deliberate: the rest is one tap away behind More, so the size sweep's\n truncation gate (scripts/screenshot-sizes.mjs) leaves it alone. */}\n <div\n id={bodyId}\n ref={bodyRef}\n data-truncate-ok=\"\"\n className={cn(\"max-md:min-w-0\", !expanded && \"max-md:line-clamp-1\")}\n >\n {children}\n </div>\n {(expanded || !fits) && (\n <button\n type=\"button\"\n aria-expanded={expanded}\n aria-controls={bodyId}\n onClick={() => setExpanded((v) => !v)}\n className={cn(\n \"relative z-10 shrink-0 rounded-sm font-medium underline underline-offset-2 md:hidden\",\n focusRing,\n )}\n >\n {expanded ? common.showLess : common.showMore}\n </button>\n )}\n </div>\n ) : (\n <Body className={cn(!inlineRow && (nested ? \"flex-1\" : grow), \"min-w-0 text-start\")}>{children}</Body>\n );\n const content = (\n <>\n {glyph}\n {contentBody}\n {interactive && (\n <ChevronRight\n aria-hidden\n className={cn(sm ? \"size-3.5\" : \"size-4\", \"shrink-0 opacity-70 rtl:-scale-x-100\", nudge)}\n />\n )}\n </>\n );\n\n const dismiss = onDismiss ? (\n <button\n type=\"button\"\n aria-label={common.dismiss}\n onClick={(e) => {\n // A dismiss inside a whole-row banner must not also follow the row.\n e.preventDefault();\n e.stopPropagation();\n onDismiss();\n }}\n className={cn(\n // Negative margins so the × does not make the box taller than its text; the\n // hover wash takes the tone's own hue, so it works on every tone.\n \"relative z-10 -my-0.5 -me-0.5 flex size-6 shrink-0 items-center justify-center rounded transition-colors hover:bg-current/10\",\n focusRing,\n )}\n >\n <X aria-hidden className=\"size-4\" />\n </button>\n ) : null;\n\n // `relative z-10` so it stays clickable over a whole-row banner's stretched target.\n // `max-w-full flex-wrap`: on a line of its own, two actions side by side ran 57 px\n // past a 360 px phone at Extra large (the demo strip's \"Request access\" and \"Sign in\",\n // 0.32.1); held to the line, they wrap there instead. Where they fit in one row,\n // nothing changes.\n const trailing =\n action !== undefined && action !== null ? (\n <div\n className={cn(\n \"relative z-10 flex max-w-full shrink-0 flex-wrap items-center gap-2\",\n !strip && !inlineRow && \"self-center\",\n (strip || flow) && \"ms-auto\",\n // Last, on a line of its own, lined up with the message (past the glyph).\n boxWraps && cn(\"max-sm:order-last max-sm:basis-full\", glyph && (sm ? \"max-sm:ps-5\" : \"max-sm:ps-6\")),\n )}\n >\n {action}\n </div>\n ) : null;\n\n if (!interactive) {\n return (\n <div\n // The tone as data (0.34, refactor audit 2026-10, TST-9): a stable hook for a\n // test or a caller's selector, where the frame classes are the kit's to change.\n data-tone={tone}\n // Arbitrary attributes first — a `data-tour` anchor, a test id, an\n // `aria-describedby` — then the layout and tone classes, which are merged\n // through `cn` rather than spread so a caller's `className` refines the box\n // instead of replacing it.\n {...rest}\n ref={ref as Ref<HTMLDivElement>}\n role={resolvedRole}\n className={cn(row, frame, TONE_TEXT[tone], className)}\n >\n {flow ? (\n <>\n <div className={flowRow} data-action-flow=\"\">\n {/* The glyph rides with the message, on its first line; the two are\n centred against the action as one, as the whole-row button is. */}\n <div className={cn(\"flex min-w-0 flex-1 items-start\", flowBasis, sm ? \"gap-1.5\" : \"gap-2\")}>\n {glyph}\n {contentBody}\n </div>\n {trailing}\n </div>\n </>\n ) : (\n <>\n {content}\n {trailing}\n </>\n )}\n {dismiss}\n </div>\n );\n }\n\n const hover = \"cursor-pointer transition-[filter] hover:brightness-[0.97] dark:hover:brightness-110\";\n // With a dismiss the frame is a wrapper and the row element is stretched over it;\n // without one the row element IS the frame.\n const split = dismiss !== null || trailing !== null;\n const actionClass = split\n ? cn(\n \"flex min-w-0 text-start\",\n grow,\n flowBasis,\n sm ? \"gap-1.5\" : \"gap-2\",\n inlineRow || strip ? \"items-center\" : \"items-start\",\n \"outline-none after:absolute after:inset-0 after:content-['']\",\n strip ? \"after:rounded-none\" : \"after:rounded-md\",\n \"focus-visible:after:ring-focus focus-visible:after:ring-brand\",\n )\n : cn(row, !inlineRow && \"w-full\", frame, TONE_TEXT[tone], hover, focusRing, className);\n // The div's attributes are the row element's: an `id`, a test id or an\n // `aria-describedby` belongs on the thing that takes focus. The live-region role is\n // NOT carried over — a button or a link that is also a `status` is neither.\n const actionRest = split ? {} : rest;\n // The `ref` goes with the rest: to the row element when it is the frame.\n const rowRef = split ? undefined : ref;\n\n const rowAction =\n href !== undefined ? (\n <a\n data-tone={split ? undefined : tone}\n {...(actionRest as ComponentPropsWithoutRef<\"a\">)}\n ref={rowRef as Ref<HTMLAnchorElement> | undefined}\n href={href}\n className={actionClass}\n >\n {content}\n </a>\n ) : (\n <button\n data-tone={split ? undefined : tone}\n {...(actionRest as ComponentPropsWithoutRef<\"button\">)}\n ref={rowRef as Ref<HTMLButtonElement> | undefined}\n type=\"button\"\n onClick={onClick}\n className={actionClass}\n >\n {content}\n </button>\n );\n\n if (!split) return rowAction;\n return (\n <div\n data-tone={tone}\n {...rest}\n ref={ref as Ref<HTMLDivElement>}\n role={resolvedRole}\n className={cn(\"relative\", row, frame, TONE_TEXT[tone], hover, className)}\n >\n {flow ? (\n // Not positioned: the row's stretched `after:` target must still cover the frame.\n <div className={flowRow} data-action-flow=\"\">\n {rowAction}\n {trailing}\n </div>\n ) : (\n <>\n {rowAction}\n {trailing}\n </>\n )}\n {dismiss}\n </div>\n );\n}\n"],"mappings":";AAqUM,SAyGF,UAzGE,KAqEF,YArEE;AArUN,SAAS,OAA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AAAA;AAAA,UACA;AAAA,WACH;AAAA,QAED;AAAA;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/alert-banner.tsx"],"sourcesContent":["import { useEffect, useId, useLayoutEffect, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, MouseEvent, ReactNode, Ref, RefObject } from \"react\";\nimport { AlertTriangle, CheckCircle2, ChevronRight, Info, X } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { FOCUS_RING } from \"./focus-ring\";\nimport { DEFAULT_COMMON_LABELS, useKitLabels } from \"../i18n/kit-labels\";\nimport { focusFirst, focusIsLost, tabStopsAround, whenFocusLeftForNothing } from \"../lib/focus-left\";\n\n/** `info` (0.8.0) is the sky family, for news that is neither good nor bad: keksdose's\n * preview and beta-performance banners, which borrowed `warning` for want of it and\n * so told every user of the preview build that something was wrong. */\nexport type AlertTone = \"danger\" | \"warning\" | \"info\" | \"success\" | \"neutral\";\n\n/** `sm` (0.10.0): 12px type and a 14px glyph — the hint line under a field or a total\n * that keksdose spells `text-xs text-amber-700 dark:text-amber-400` by hand\n * (accounts-page's missing-rate note, import-map-step, guest-key-control's two\n * key states, goal-form). At body size those read as a second heading. */\nexport type AlertSize = \"sm\" | \"md\";\n\n/** Border + surface per tone, WITHOUT a radius or padding, so a caller that owns\n * its own box (a Card, say) can take the tone alone. Single source for both\n * {@link alertFrameClass} and {@link toneFrameClass}.\n *\n * The colored tones are 2px, not 1px, and that is load-bearing rather than\n * decorative. A 1px border is 1.25 device pixels on a 125%-scaled display — the\n * usual Windows setting — so whether it renders as a solid line or as two\n * half-lit pixels depends on where the box happens to land in device-pixel space.\n * The same card then shows a heavy left edge and a right edge that fades out,\n * which is what feedback #264, #277, #491 and #498 all reported. A 2px border is\n * 2.5 device pixels: it always covers at least two pixels fully, on both edges,\n * at any offset. Callers compensate the extra pixel in their own padding so\n * switching tones never shifts the layout. */\nconst TONE_FRAME: Record<AlertTone, string> = {\n danger: \"border-2 border-danger-strong bg-danger-soft\",\n warning: \"border-2 border-warning bg-warning-soft\",\n info: \"border-2 border-info bg-info-soft\",\n success: \"border-2 border-success bg-success-soft\",\n neutral: \"border border-subtle\",\n};\n\n/** `elevated`: the same frame on an OPAQUE surface. The dark tone washes are\n * translucent (a 20–25 % tint), which is right on a page and wrong on anything that\n * floats over one — keksdose's server-wake notice (#209) let the page's own text\n * show through the one message whose job is to be read when nothing else makes\n * sense. So the surface becomes `--bg-surface` and the tone's wash is layered on it\n * as a background IMAGE (a flat gradient), which keeps the exact tint in both themes\n * without a second, opaque copy of every `-bg` token. */\nconst TONE_ELEVATED: Record<AlertTone, string> = {\n danger: \"bg-[image:linear-gradient(var(--danger-bg),var(--danger-bg))]\",\n warning: \"bg-[image:linear-gradient(var(--warning-bg),var(--warning-bg))]\",\n info: \"bg-[image:linear-gradient(var(--info-bg),var(--info-bg))]\",\n success: \"bg-[image:linear-gradient(var(--success-bg),var(--success-bg))]\",\n neutral: \"\",\n};\nconst ELEVATED = \"bg-surface shadow-lg\";\n\n/** The tone's border + surface on their own — for a caller that already has a box\n * with its own radius and padding (e.g. a Card). Remember to shave 1px off that\n * padding for the colored tones, whose border is 2px wide. */\nexport function toneFrameClass(tone: AlertTone): string {\n return TONE_FRAME[tone];\n}\n\n/** Single source for the warning-callout frame (feedback #277): the tone's border\n * and surface plus this component's own radius and padding, the latter\n * compensating the 2px colored border so toggling tones never shifts layout.\n *\n * The compensation is `calc(<the neutral padding in rem> - 1px)`, not a px figure\n * (0.32, docs/text-size-harmonization.md §3.2): the padding grows with the text size,\n * the 1px it gives back to the border does not — an 11 px padding stopped matching `p-3`\n * at 125 %, and toggling the tone shifted the layout again. */\nexport function alertFrameClass(tone: AlertTone, size: AlertSize = \"md\"): string {\n const box =\n size === \"sm\"\n ? tone === \"neutral\"\n ? \"rounded-md px-2.5 py-1.5\"\n : \"rounded-md px-[calc(0.625rem-1px)] py-[calc(0.375rem-1px)]\"\n : tone === \"neutral\"\n ? \"rounded-md p-3\"\n : \"rounded-md p-[calc(0.75rem-1px)]\";\n return `${box} ${TONE_FRAME[tone]}`;\n}\n\n/** The `strip` frame: the tone's surface edge to edge, no radius, and only the BOTTOM\n * border, 1px — a strip is a band across the top of a page, and its one visible edge\n * is the line it draws under itself. kastlan's trial, past-due and tour banners. */\nfunction stripFrameClass(tone: AlertTone, size: AlertSize): string {\n return cn(TONE_FRAME[tone], \"rounded-none border-0 border-b\", size === \"sm\" ? \"px-4 py-1.5\" : \"px-4 py-2\");\n}\n\nconst TONE_TEXT: Record<AlertTone, string> = {\n danger: \"text-danger\",\n warning: \"text-warning\",\n info: \"text-info\",\n success: \"text-success\",\n neutral: \"text-secondary\",\n};\n\nconst TONE_ICON: Record<AlertTone, string> = {\n danger: \"text-danger\",\n warning: \"text-warning\",\n info: \"text-info\",\n success: \"text-success\",\n neutral: \"text-muted\",\n};\n\n/** Which glyph a tone draws when the caller names none. The triangle belongs to the\n * two tones that mean \"something is wrong\"; `info` and `neutral` get the ⓘ. That is\n * what makes `neutral` safe to offer at all: until 0.8.0 it was withheld because a\n * triangle with no colour is a warning that looks like a note — and a neutral note\n * that draws no triangle is simply a note (lenkbank's \"values are rounded\"). */\nconst TONE_GLYPH: Record<AlertTone, typeof AlertTriangle> = {\n danger: AlertTriangle,\n warning: AlertTriangle,\n info: Info,\n success: CheckCircle2,\n neutral: Info,\n};\n\ninterface AlertBannerBaseProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"onClick\"> {\n /** Default `danger`. `info` for news, `neutral` for a plain note — see\n * {@link TONE_GLYPH} for why a neutral banner is now allowed. */\n tone?: AlertTone;\n /**\n * `box` (default): the framed callout. `inline`: the tone's colour, glyph and role\n * and NOTHING else — no border, no surface, no padding — so it fits inside a\n * toolbar row beside the controls it is about. Lenkbank's corner-motion toolbar\n * shows \"Radius below the minimum\" and \"Solving…\" there; a box would have doubled\n * the row's height every time either appeared.\n *\n * The inline variant is also a LIVE REGION by default — `role=\"alert\"` for\n * `danger`, `role=\"status\"` for the rest — because a message that appears in a\n * toolbar in answer to what the user just did is exactly the kind a screen reader\n * otherwise never hears. The box stays role-less as it always was: it is usually\n * page furniture present at load, and an alert that fires on every navigation is\n * noise. Either way a `role` you pass wins.\n *\n * `strip` (0.10.0): a band across the top of a page or a panel — edge to edge, no\n * radius, only a bottom border, content centred on one line, and usually an\n * {@link action}. kastlan's billing trial-banner and past-due-banner and its tours\n * tour-banner each built this by hand in amber or red Tailwind classes, with a\n * separate dark: spelling apiece. Role-less like the box: it is page furniture.\n */\n variant?: \"box\" | \"inline\" | \"strip\";\n /** See {@link AlertSize}. Default `md`. */\n size?: AlertSize;\n /**\n * `inline` only (0.11.0): lay the message out as a BLOCK — a full-width `flex` row,\n * the glyph on the text's FIRST line when it wraps — instead of the `inline-flex`,\n * centred line it is by default. keksdose writes `className=\"flex\"` on nearly every\n * inline banner it has (accounts-page:564, holdings-panel:631, import-map-step:66/314,\n * guest-key-control:84) to get a line of its own under a total or a field, and a\n * two-line hint there then centres its glyph between the lines.\n *\n * An option rather than the new default, because the inline-flex is load-bearing for\n * the callers the variant was made for: lenkbank's corner-motion toolbar\n * (corner-motion.tsx:178) sets it as a `shrink-0` item beside the controls, kastlan's\n * import page and keksdose's rules page place it in a run of content — a block would\n * take the whole row in the second kind, and top-align the first against a taller\n * control. Ignored by `box` and `strip`, which are blocks already.\n */\n block?: boolean;\n /**\n * `false` opts an inline banner out of its live region (no `role=\"alert\"` /\n * `role=\"status\"`), for a message that is static page content rather than the answer\n * to something the user just did: keksdose's CAMT review step (camt-review-step:214)\n * renders \"unresolved rows block the import\" as part of the step, and as\n * `role=\"alert\"` a screen reader interrupted with it on every mount. A `role` you pass\n * still wins. Default `true`; the box and the strip are role-less either way.\n */\n live?: boolean;\n /**\n * An opaque, raised surface (a shadow, and no translucency in dark mode) for a\n * notice that floats over the page — see {@link TONE_ELEVATED}. `box` and `strip`\n * only; an inline message has no surface to raise.\n */\n elevated?: boolean;\n /**\n * A trailing control — the \"Update payment method\" button on kastlan's trial and\n * past-due strips, the \"Exit\" on its tour strip. Sits at the end of the row,\n * vertically centred, and never shrinks. On a whole-row banner (`href`/`onClick`)\n * it is rendered BESIDE the row's own link or button, as the × is, because\n * interactive content may not nest.\n */\n action?: ReactNode;\n /** Replaces the tone's glyph — a `<Spinner label={null} />` for \"Solving…\", say.\n * `null` draws none. Always decorative; the text carries the message. */\n icon?: ReactNode;\n /**\n * Renders an × at the end that calls this. The banner does not hide itself — the\n * caller removes it (and remembers that it did), as with every other kit control\n * whose state is app state.\n *\n * The focus (0.52, refactor audit 2026-10-30, DSP-15): the × that held it goes with the\n * banner, and it fell to `<body>`. When the banner unmounts after its × was pressed and\n * the focus has nowhere else, it moves on to the next control after the banner — where\n * Tab from the × would have gone — or, at the end of the page, the one before it; to\n * {@link dismissFocusRef} when given. A banner the caller keeps keeps its ×'s focus.\n */\n onDismiss?: () => void;\n /** Where the focus goes once the × has removed the banner (DSP-15) — a heading, the\n * control the banner was about. Default: the next control after the banner. */\n dismissFocusRef?: RefObject<HTMLElement | null>;\n /** Accessible name of the ×. Default: `common.dismiss` from the\n * {@link UiKitProvider}, else \"Dismiss\". */\n dismissLabel?: string;\n /**\n * 0.48: on a phone (below the kit's text-size-aware `md`) hold the message to ONE line,\n * with a \"More\" / \"Less\" toggle after it (`aria-expanded`, `aria-controls` the message;\n * `common.showMore` / `common.showLess`). From `md` up nothing changes. The toggle only\n * shows while the line actually cuts the message off.\n *\n * keksdose dev#611 (UX-1.2): its beta notice took three to four lines (~100px) above\n * every phone screen, and the app built the clamp and the button around the banner's\n * children by hand. Ignored on a whole-row banner (`href` / `onClick`): a toggle cannot\n * sit inside the row's own link or button.\n *\n * 0.51 (kastlan K1): on a `strip` the clamped message claims 7rem instead of 12rem below\n * `md`, so the {@link action} stays on its line rather than taking one of its own.\n *\n * For a one-line MESSAGE (a sentence or two). Not for a body with a list or a control in\n * it: the clamp cuts the box to its first line, so a Disclosure's or a link's trigger\n * past it is clipped out of sight and still takes the keyboard's focus, and \"More\" gives\n * back the whole body at once. Shorten such a banner instead — one sentence, its action,\n * and the rest behind a Disclosure of its own (keksdose's agree-again notice, 0.51).\n */\n clampMobile?: boolean;\n /**\n * Where a box's {@link action} goes on a phone (below `sm`). 0.48.\n *\n * `own-line` (default): a line of its own under the message, lined up with it\n * (kastlan 53 — a long message beside a long button squeezed into a column).\n *\n * `flow`: on the message's line while the message (with its glyph) keeps 10rem, else at the END of the\n * next line — for a short message and a short action, which a line of their own each\n * would stack for nothing. keksdose dev #623: the budget card's \"5 underfunded\n * categories\" + \"Assign\" built this with descendant overrides on the kit's classes.\n * The basis is in rem, so it grows with the text size: at Large the action drops a\n * line sooner, by itself. The × stays at the top end either way; `clampMobile` works\n * alongside. From `sm` up nothing changes. Ignored by `strip` (which flows like this\n * already) and `inline`.\n */\n actionPlacement?: \"own-line\" | \"flow\";\n children: ReactNode;\n /**\n * The banner's frame — where the rest of the props go (0.34, API-2, refactor audit\n * 2026-10). Which element that is depends on the mode: the `<div>`; with `href` or\n * `onClick` the `<a>` or `<button>` that IS the row; with an × or an `action` beside\n * that row, the `<div>` holding the two. Hence `HTMLElement`.\n */\n ref?: Ref<HTMLElement>;\n}\n\n/**\n * The whole-row modes. keksdose's budget-summary card is a banner you tap to open\n * the budget; built from a `<div onClick>` it was a mouse-only target, and built as a\n * banner with a link inside it was a small target inside a big one that looked like\n * one. So `onClick` makes the banner itself ONE `<button>`, and `href` makes it one\n * `<a>`, with a trailing chevron that says so. Mutually exclusive, as on `Chip`.\n *\n * With `onDismiss` as well, the × cannot go inside the button (interactive content\n * may not nest), so the frame becomes a wrapper holding two siblings: the row's\n * button, stretched over the whole frame, and the × on top of it. It still looks and\n * clicks like one banner with an × in its corner, and the two are separate tab stops.\n */\nexport type AlertBannerProps = AlertBannerBaseProps &\n (\n | {\n /** Makes the whole banner one link. Mutually exclusive with `onClick`. */\n href?: string;\n onClick?: never;\n }\n | {\n href?: never;\n /** Makes the whole banner one button. Mutually exclusive with `href`. The\n * event's element is the `<button>`, not a `<div>`. */\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n }\n );\n\n/** Warning/danger/info callout box with the shared frame and an icon — or, with\n * `variant=\"inline\"`, the same message as a frameless line of toned text. */\nexport function AlertBanner({\n tone = \"danger\",\n variant = \"box\",\n size = \"md\",\n block = false,\n live = true,\n elevated = false,\n action,\n icon,\n onDismiss,\n dismissFocusRef,\n dismissLabel,\n clampMobile = false,\n actionPlacement = \"own-line\",\n href,\n onClick,\n className,\n children,\n role,\n ref,\n ...rest\n}: AlertBannerProps) {\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS, { dismiss: dismissLabel });\n const inline = variant === \"inline\";\n const strip = variant === \"strip\";\n const sm = size === \"sm\";\n const interactive = href !== undefined || onClick !== undefined;\n // A block-laid inline banner behaves like a box for layout: a row that may wrap.\n const inlineRow = inline && !block;\n const resolvedRole = role ?? (inline && live ? (tone === \"danger\" ? \"alert\" : \"status\") : undefined);\n\n // `clampMobile`: the message's one-line clamp below `md`, and whether that line holds\n // it all (then there is nothing to show \"More\" of). Measured while collapsed — the\n // clamp is what makes `scrollHeight` exceed the box — and again whenever its box\n // changes size, which a rotation or crossing `md` does. With no layout (a test, the\n // server) the box is 0 tall, which reads as \"may not fit\": the toggle stays.\n const clamp = clampMobile && !interactive;\n const bodyId = useId();\n const bodyRef = useRef<HTMLDivElement>(null);\n const [expanded, setExpanded] = useState(false);\n const [fits, setFits] = useState(false);\n useLayoutEffect(() => {\n const el = bodyRef.current;\n if (!clamp || expanded || !el) return;\n const check = () => setFits(el.clientHeight > 0 && el.scrollHeight <= el.clientHeight + 1);\n check();\n const ro = typeof ResizeObserver === \"undefined\" ? null : new ResizeObserver(check);\n ro?.observe(el);\n return () => ro?.disconnect();\n }, [clamp, expanded, children]);\n\n // The ×'s focus, once the caller has removed the banner (DSP-15). Where it can go is read\n // at the press, while the banner still has a place in the page to measure from; whether\n // it must is decided at the unmount, in the cleanup of a passive effect — after React has\n // taken the banner's DOM away, when a focus that fell with it is on <body>.\n const dismissedFrom = useRef<HTMLElement[] | null>(null);\n const dismissTarget = useRef(dismissFocusRef);\n useLayoutEffect(() => {\n dismissTarget.current = dismissFocusRef;\n });\n // The note lives until the focus lands outside the banner (0.52 code review,\n // alert-banner.tsx). A caller that keeps the banner — an async dismiss that failed, a\n // snooze — left it standing, and the banner's unmount long after, a route change with\n // the focus on <body>, sent the focus to a stop noted at the press, over the app's own\n // handling of a new page. A `focusin` on the document, not a `focusout` on the banner:\n // a browser that blurs a removed node would drop the note at the very removal it is for.\n // The one `focusout` heard is a move to nothing — a click on the page — and only once a\n // microtask has shown the × still in place (`whenFocusLeftForNothing`). A focus that\n // stays on the × keeps the note, however late the removal: that is DSP-15's own case,\n // an async dismiss whose request resolves.\n const unwatchFocus = useRef<(() => void) | null>(null);\n useEffect(\n () => () => {\n unwatchFocus.current?.();\n const around = dismissedFrom.current;\n if (!around || !focusIsLost()) return;\n focusFirst([dismissTarget.current?.current, ...around]);\n },\n [],\n );\n\n const Glyph = TONE_GLYPH[tone];\n // Onto the first line of a box's text: 2px at 14px/20px, 1px at 12px/16px.\n const nudge = inlineRow || strip ? undefined : sm ? \"mt-px\" : \"mt-0.5\";\n const glyph =\n icon === null ? null : icon !== undefined ? (\n <span\n aria-hidden\n className={cn(\"flex shrink-0\", sm ? \"[&_svg]:size-3.5\" : \"[&_svg]:size-4\", nudge, TONE_ICON[tone])}\n >\n {icon}\n </span>\n ) : (\n <Glyph aria-hidden className={cn(sm ? \"size-3.5\" : \"size-4\", \"shrink-0\", nudge, TONE_ICON[tone])} />\n );\n\n // The row layout, shared by every shape below. A strip centres, and WRAPS: on a\n // phone a long message plus an action would otherwise squeeze the text into a narrow\n // column, so the action drops under it instead. A box may wrap its text, so it\n // top-aligns and nudges the glyph onto the first line.\n // A BOX with an action wraps too, below sm only (kastlan 53): the verify-email box\n // squeezed \"Please confirm your email address…\" into a ~100px column beside a\n // \"Resend verification email\" button. There the action takes a line of its own under\n // the message, and the × stays at the top end; from sm up the box is one row as before.\n const boxAction = !inline && !strip && action !== undefined && action !== null;\n // `flow` (0.48): glyph + message and the action in a row of their own that wraps\n // below sm; the × stays outside it, at the top end.\n const flow = boxAction && actionPlacement === \"flow\";\n const boxWraps = boxAction && !flow;\n const flowRow = cn(\"flex min-w-0 flex-1 items-center max-sm:flex-wrap\", sm ? \"gap-1.5\" : \"gap-2\");\n // The 10rem the message keeps beside the action before the action wraps.\n const flowBasis = flow ? \"max-sm:basis-40\" : undefined;\n const row = cn(\n inlineRow\n ? \"inline-flex items-center\"\n : strip\n ? \"flex flex-wrap items-center gap-y-1\"\n : cn(\"flex items-start\", boxWraps && \"max-sm:flex-wrap max-sm:gap-y-2\"),\n sm ? \"gap-1.5 text-xs\" : inline ? \"gap-1.5 text-sm\" : \"gap-2 text-sm\",\n );\n // The strip's message claims 12rem before anything shrinks. `flex-1` is a 0 basis,\n // which never makes a wrapping row wrap — the action and the × squeezed the message\n // into a three-word column on a phone instead. With a real basis the action drops to\n // a second line once message + action no longer fit, and the message keeps the width.\n const grow = strip ? \"flex-[1_1_12rem]\" : \"flex-1\";\n // …except a CLAMPED strip on a phone (0.51, kastlan K1 / prod #22, KX-5). There the\n // message is one line whatever its width (the rest is behind \"More\"), so the 12rem only\n // pushed the action under it: \"Erneut senden\" took a line of its own on a 390px phone,\n // and kastlan's banner stood 71px where one line is 43. The clamp needs its \"More\" and\n // the first words beside it, so below `md` the basis is 7rem (~4rem of text). Measured\n // in Chromium at 390 × 844, kastlan's `mx-4` strip (326px inside): one line, 43px, in\n // all seven catalogues, with Roboto and with the wider DejaVu Sans; French, the longest\n // \"Send again\", keeps 8px. At 360px French (and Spanish in DejaVu) still drop a line.\n // A rem basis like the 12rem, so at Large the action drops a line sooner, by itself.\n // From `md` up the clamp is off and the 12rem holds; without `clampMobile` nothing moves.\n const clampBasis = strip && clamp ? \"max-md:basis-28\" : undefined;\n // Inside a whole-row banner's button or link, which then carries `grow` itself.\n const nested = interactive && (onDismiss !== undefined || (action !== undefined && action !== null));\n const frame = inline\n ? \"\"\n : cn(\n strip ? stripFrameClass(tone, size) : alertFrameClass(tone, size),\n elevated && cn(ELEVATED, TONE_ELEVATED[tone]),\n );\n const focusRing = cn(FOCUS_RING, \"focus-visible:ring-offset-1 focus-visible:ring-offset-surface\");\n\n // The message's box: a `<div>` (0.51), so a banner may hold block content — keksdose's\n // agree-again notice has a list and a Disclosure in it, which inside the `<span>` this was\n // were block elements in phrasing content. A `<span>` still in a whole-row banner, whose\n // `<a>` / `<button>` takes phrasing content only.\n const Body = interactive ? \"span\" : \"div\";\n const contentBody = clamp ? (\n // Below `md` a row: the message, clamped, then the toggle on its baseline. From\n // `md` up a plain box with the message in it, as without the prop. (Never a whole-row\n // banner, so always a `<div>`.)\n <div\n className={cn(\n !inlineRow && grow,\n clampBasis,\n \"min-w-0 text-start max-md:flex max-md:items-baseline max-md:gap-2\",\n )}\n >\n {/* The clamp is deliberate: the rest is one tap away behind More, so the size sweep's\n truncation gate (scripts/screenshot-sizes.mjs) leaves it alone. */}\n <div\n id={bodyId}\n ref={bodyRef}\n data-truncate-ok=\"\"\n className={cn(\"max-md:min-w-0\", !expanded && \"max-md:line-clamp-1\")}\n >\n {children}\n </div>\n {(expanded || !fits) && (\n <button\n type=\"button\"\n aria-expanded={expanded}\n aria-controls={bodyId}\n onClick={() => setExpanded((v) => !v)}\n className={cn(\n \"relative z-10 shrink-0 rounded-sm font-medium underline underline-offset-2 md:hidden\",\n focusRing,\n )}\n >\n {expanded ? common.showLess : common.showMore}\n </button>\n )}\n </div>\n ) : (\n <Body className={cn(!inlineRow && (nested ? \"flex-1\" : grow), \"min-w-0 text-start\")}>{children}</Body>\n );\n const content = (\n <>\n {glyph}\n {contentBody}\n {interactive && (\n <ChevronRight\n aria-hidden\n className={cn(sm ? \"size-3.5\" : \"size-4\", \"shrink-0 opacity-70 rtl:-scale-x-100\", nudge)}\n />\n )}\n </>\n );\n\n const dismiss = onDismiss ? (\n <button\n type=\"button\"\n aria-label={common.dismiss}\n onClick={(e) => {\n // A dismiss inside a whole-row banner must not also follow the row.\n e.preventDefault();\n e.stopPropagation();\n const frame = e.currentTarget.parentElement;\n // Only a × that holds the focus has one to lose (0.52 code review, alert-banner.tsx):\n // Safari focuses no button on a click, nor on an iOS tap, and with the focus on\n // <body> already the removal sent it on — a ring, on a form field the on-screen\n // keyboard, on a page the user was reading with the pointer.\n if (frame && e.currentTarget.ownerDocument.activeElement === e.currentTarget) {\n const { after, before } = tabStopsAround(frame);\n dismissedFrom.current = [...after, ...before];\n unwatchFocus.current?.();\n const doc = frame.ownerDocument;\n const forget = () => {\n dismissedFrom.current = null;\n unwatch();\n };\n const onFocusIn = (event: FocusEvent) => {\n if (event.target instanceof Node && frame.contains(event.target)) return;\n forget();\n };\n // Focus that left for nothing — a click on the page — took no `focusin` with it\n // (0.52 code review): the user moved on all the same.\n const onFocusOut = (event: FocusEvent) => {\n whenFocusLeftForNothing(event, () => {\n if (unwatchFocus.current === unwatch) forget();\n });\n };\n const unwatch = () => {\n doc.removeEventListener(\"focusin\", onFocusIn, true);\n frame.removeEventListener(\"focusout\", onFocusOut);\n unwatchFocus.current = null;\n };\n doc.addEventListener(\"focusin\", onFocusIn, true);\n frame.addEventListener(\"focusout\", onFocusOut);\n unwatchFocus.current = unwatch;\n }\n onDismiss();\n }}\n className={cn(\n // Negative margins so the × does not make the box taller than its text; the\n // hover wash takes the tone's own hue, so it works on every tone.\n \"relative z-10 -my-0.5 -me-0.5 flex size-6 shrink-0 items-center justify-center rounded transition-colors hover:bg-current/10\",\n focusRing,\n )}\n >\n <X aria-hidden className=\"size-4\" />\n </button>\n ) : null;\n\n // `relative z-10` so it stays clickable over a whole-row banner's stretched target.\n // `max-w-full flex-wrap`: on a line of its own, two actions side by side ran 57 px\n // past a 360 px phone at Extra large (the demo strip's \"Request access\" and \"Sign in\",\n // 0.32.1); held to the line, they wrap there instead. Where they fit in one row,\n // nothing changes.\n const trailing =\n action !== undefined && action !== null ? (\n <div\n className={cn(\n \"relative z-10 flex max-w-full shrink-0 flex-wrap items-center gap-2\",\n !strip && !inlineRow && \"self-center\",\n (strip || flow) && \"ms-auto\",\n // Last, on a line of its own, lined up with the message (past the glyph).\n boxWraps && cn(\"max-sm:order-last max-sm:basis-full\", glyph && (sm ? \"max-sm:ps-5\" : \"max-sm:ps-6\")),\n )}\n >\n {action}\n </div>\n ) : null;\n\n if (!interactive) {\n return (\n <div\n // The tone as data (0.34, refactor audit 2026-10, TST-9): a stable hook for a\n // test or a caller's selector, where the frame classes are the kit's to change.\n data-tone={tone}\n // Arbitrary attributes first — a `data-tour` anchor, a test id, an\n // `aria-describedby` — then the layout and tone classes, which are merged\n // through `cn` rather than spread so a caller's `className` refines the box\n // instead of replacing it.\n {...rest}\n ref={ref as Ref<HTMLDivElement>}\n role={resolvedRole}\n className={cn(row, frame, TONE_TEXT[tone], className)}\n >\n {flow ? (\n <>\n <div className={flowRow} data-action-flow=\"\">\n {/* The glyph rides with the message, on its first line; the two are\n centred against the action as one, as the whole-row button is. */}\n <div className={cn(\"flex min-w-0 flex-1 items-start\", flowBasis, sm ? \"gap-1.5\" : \"gap-2\")}>\n {glyph}\n {contentBody}\n </div>\n {trailing}\n </div>\n </>\n ) : (\n <>\n {content}\n {trailing}\n </>\n )}\n {dismiss}\n </div>\n );\n }\n\n const hover = \"cursor-pointer transition-[filter] hover:brightness-[0.97] dark:hover:brightness-110\";\n // With a dismiss the frame is a wrapper and the row element is stretched over it;\n // without one the row element IS the frame.\n const split = dismiss !== null || trailing !== null;\n const actionClass = split\n ? cn(\n \"flex min-w-0 text-start\",\n grow,\n flowBasis,\n sm ? \"gap-1.5\" : \"gap-2\",\n inlineRow || strip ? \"items-center\" : \"items-start\",\n \"outline-none after:absolute after:inset-0 after:content-['']\",\n strip ? \"after:rounded-none\" : \"after:rounded-md\",\n \"focus-visible:after:ring-focus focus-visible:after:ring-brand\",\n )\n : cn(row, !inlineRow && \"w-full\", frame, TONE_TEXT[tone], hover, focusRing, className);\n // The div's attributes are the row element's: an `id`, a test id or an\n // `aria-describedby` belongs on the thing that takes focus. The live-region role is\n // NOT carried over — a button or a link that is also a `status` is neither.\n const actionRest = split ? {} : rest;\n // The `ref` goes with the rest: to the row element when it is the frame.\n const rowRef = split ? undefined : ref;\n\n const rowAction =\n href !== undefined ? (\n <a\n data-tone={split ? undefined : tone}\n {...(actionRest as ComponentPropsWithoutRef<\"a\">)}\n ref={rowRef as Ref<HTMLAnchorElement> | undefined}\n href={href}\n className={actionClass}\n >\n {content}\n </a>\n ) : (\n <button\n data-tone={split ? undefined : tone}\n {...(actionRest as ComponentPropsWithoutRef<\"button\">)}\n ref={rowRef as Ref<HTMLButtonElement> | undefined}\n type=\"button\"\n onClick={onClick}\n className={actionClass}\n >\n {content}\n </button>\n );\n\n if (!split) return rowAction;\n return (\n <div\n data-tone={tone}\n {...rest}\n ref={ref as Ref<HTMLDivElement>}\n role={resolvedRole}\n className={cn(\"relative\", row, frame, TONE_TEXT[tone], hover, className)}\n >\n {flow ? (\n // Not positioned: the row's stretched `after:` target must still cover the frame.\n <div className={flowRow} data-action-flow=\"\">\n {rowAction}\n {trailing}\n </div>\n ) : (\n <>\n {rowAction}\n {trailing}\n </>\n )}\n {dismiss}\n </div>\n );\n}\n"],"mappings":";AAgXM,SAyGF,UAzGE,KAqEF,YArEE;AAhXN,SAAS,WAAW,OAAO,iBAAiB,QAAQ,gBAAgB;AAEpE,SAAS,eAAe,cAAc,cAAc,MAAM,SAAS;AACnE,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB,oBAAoB;AACpD,SAAS,YAAY,aAAa,gBAAgB,+BAA+B;AA0BjF,MAAM,aAAwC;AAAA,EAC5C,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AACX;AASA,MAAM,gBAA2C;AAAA,EAC/C,QAAQ;AAAA,EACR,SAAS;AAAA,E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B;AAAA,IACtC;AAAA,IACA,QAAQ,uBAAuB;AAAA,IAC/B;AAAA,EACF,IACA,GAAG,KAAK,CAAC,aAAa,UAAU,OAAO,UAAU,IAAI,GAAG,OAAO,WAAW,SAAS;AAIvF,QAAM,aAAa,QAAQ,CAAC,IAAI;AAEhC,QAAM,SAAS,QAAQ,SAAY;AAEnC,QAAM,YACJ,SAAS,SACP;AAAA,IAAC;AAAA;AAAA,MACC,aAAW,QAAQ,SAAY;AAAA,MAC9B,GAAI;AAAA,MACL,KAAK;AAAA,MACL;AAAA,MACA,WAAW;AAAA,MAEV;AAAA;AAAA,EACH,IAEA;AAAA,IAAC;AAAA;AAAA,MACC,aAAW,QAAQ,SAAY;AAAA,MAC9B,GAAI;AAAA,MACL,KAAK;AAAA,MACL,MAAK;AAAA,MACL;AAAA,MACA,WAAW;AAAA,MAEV;AAAA;AAAA,EACH;AAGJ,MAAI,CAAC,MAAO,QAAO;AACnB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAW;AAAA,MACV,GAAG;AAAA,MACJ;AAAA,MACA,MAAM;AAAA,MACN,WAAW,GAAG,YAAY,KAAK,OAAO,UAAU,IAAI,GAAG,OAAO,SAAS;AAAA,MAEtE;AAAA;AAAA;AAAA,UAEC,qBAAC,SAAI,WAAW,SAAS,oBAAiB,IACvC;AAAA;AAAA,YACA;AAAA,aACH;AAAA,YAEA,iCACG;AAAA;AAAA,UACA;AAAA,WACH;AAAA,QAED;AAAA;AAAA;AAAA,EACH;AAEJ;","names":["frame"]}
|
|
@@ -281,4 +281,17 @@ export interface AmountInputProps extends FieldHelpProps, DataAttributes {
|
|
|
281
281
|
* was `forwardRef`. */
|
|
282
282
|
ref?: Ref<HTMLInputElement>;
|
|
283
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* The figure's colour per {@link AmountInputProps.tone} — public as `AMOUNT_TONE_CLASS`,
|
|
286
|
+
* for a table cell or a test that must paint the same figure the same way (keksdose's
|
|
287
|
+
* receipt lines, dev#556).
|
|
288
|
+
*
|
|
289
|
+
* The consuming app's ONE money palette (`--money-expense` / `--money-income`), not a
|
|
290
|
+
* bespoke rose/emerald pairing: a figure being typed has to wear the same colour the same
|
|
291
|
+
* figure will wear once it is a row in the table behind the form (Keksdose dev#434). The
|
|
292
|
+
* utilities are unlayered and theme-aware, so no `dark:` variant is needed and they win
|
|
293
|
+
* over the field's own text colour regardless of where `cn` puts them.
|
|
294
|
+
*/
|
|
295
|
+
declare const TONE_CLASS: Readonly<Record<NonNullable<AmountInputProps["tone"]>, string>>;
|
|
296
|
+
export { TONE_CLASS as AMOUNT_TONE_CLASS };
|
|
284
297
|
export declare function AmountInput(props: AmountInputProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/amount-input.tsx"],"sourcesContent":["import { useId, useMemo, useRef } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport type { ReactNode, Ref } from \"react\";\nimport { CurrencyOptionList, getCurrency } from \"./currency-option-list\";\nimport { useComboboxCore } from \"./combobox-core\";\nimport { FIELD_BASE, FIELD_DISPLAY, FIELD_INVALID, FLOATING_INPUT_CLASS, FloatingField } from \"./field-base\";\nimport { cn } from \"../lib/cn\";\nimport { currencyMinorDigits } from \"../lib/format\";\nimport { roundHalfAway } from \"../lib/round\";\nimport { CalculatorButton, type CalculatorButtonLabels } from \"./calculator\";\nimport { NumberPadSheet, type NumberPadSheetLabels } from \"./numpad-sheet\";\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\";\nimport {\n FieldCaption,\n LockedReason,\n mergeRefs,\n type DisabledReasonDisplay,\n type FieldHelpProps,\n type LockReason,\n} from \"./field-parts\";\nimport { useEndWidth, useNumericField } from \"./numeric-field\";\nimport type { CommitScope } from \"./write-lock\";\nimport { dataAttributes, type DataAttributes } from \"../lib/data-attributes\";\n\n/** {@link AmountInput}'s props — exported since 0.34 (refactor audit 2026-10, API-9): a\n * wrapper typed itself off `ComponentProps<typeof AmountInput>` until then. */\nexport interface AmountInputProps extends FieldHelpProps, DataAttributes {\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 /**\n * What is wrong with the amount, in the caller's own words — {@link Input}'s `error`\n * (keksdose K4: \"exceeds the outstanding balance\" was a loose `<p>` beside the field\n * that nothing pointed at). Rendered under the field, after a text `hint`; merged into\n * `aria-describedby` after the caller's ids and the hint's; implies `invalid`, so the\n * field paints as well as announces. `null`, `false` and `\"\"` are no message.\n * {@link MoneyField} takes it too.\n */\n error?: ReactNode;\n /**\n * Show the desktop calculator trigger (default `true`). `false` for an amount in an\n * ephemeral close-on-blur editor — a budget's assigned cell, a VAT cell (keksdose K6)\n * — where a click on the icon blurs the field and tears the editor down before the\n * popover can open. Typing a calculation (\"200+50\", then Enter) still evaluates, and\n * a phone keeps its numpad, exactly as {@link NumberInput}'s `calculator={false}`.\n */\n calculator?: boolean;\n /** The field's WRAPPER — width, a margin, a flex share. The `<input>` is\n * `inputClassName`'s. */\n className?: string;\n /**\n * Classes for the `<input>` itself — {@link NumberInput}'s and {@link Input}'s prop of\n * the same name, merged the same way: after everything the field sets for LOOKS — the\n * base classes, the plain end padding, the display shape's centring and the `tone`\n * colour — so it can restyle the figure (`text-end` for a money column whose decimal\n * points line up, `font-medium`, a tighter `py-1` or a symmetric `px-2` in a table\n * cell, `text-transparent` while a figure is being re-fetched), and before what the\n * field needs to WORK: the end padding the calculator and the currency chip reserve,\n * and the invalid border. Neither of those can be taken away by accident — a caller's\n * `px-2` keeps its start edge and the digits still stop short of the chip, and a\n * borderless cell's `border-transparent` still turns red when the value is wrong.\n *\n * keksdose G7: the invoice's VAT cell right-aligns its figure, and with only\n * `className` (the wrapper) it reached the element through `[&_input]:text-end` — a\n * descendant selector that depends on the field's inner markup, which the kit is free\n * to change, and that a reader of the call site has to decode. {@link MoneyField}\n * passes it through, and `RhfMoneyField` takes it too.\n *\n * keksdose 0.24: until then it sat BEFORE the plain end padding (`pe-3`) and the tone,\n * so the budget's assigned cell could not make its padding symmetric (`px-2` came out\n * `px-2 pe-3`) and the holdings price could not hide an outflow-toned figure while\n * re-fetching — both were back on `[&_input]:` selectors on the wrapper.\n */\n inputClassName?: string;\n id?: string;\n /** Names the field when it has no visible `label` (a table cell, the display shape). */\n \"aria-label\"?: string;\n /**\n * Set on the `<input>`, with `id` above. Declared so `Field`'s render-prop spread —\n * `{(ids) => <AmountInput {...ids} … />}` — is typed and reaches the input: the\n * hint and error are described, a required amount is announced as required, and\n * `aria-invalid` paints {@link FIELD_INVALID} the way `invalid` does.\n */\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean | \"true\" | \"false\";\n \"aria-required\"?: boolean | \"true\" | \"false\";\n /**\n * BCP 47 tag for this field — {@link NumberInput}'s `locale` (0.34, DUP-10): the decimal\n * mark the field SHOWS and reads typing in (\"1,5\" for fr-CH, \"1.5\" for de-CH, as `Intl`\n * decides), and the language of the currency picker's search. Default the\n * `<UiKitProvider locale>`, else the runtime's. `value` and `onChange` stay\n * dot-decimal.\n */\n locale?: string;\n /** {@link NumberInput}'s `hint`, the same rule: a {@link FieldHint} \"?\" rides the\n * label's own line, beside the label (not at the far end, where the calculator and\n * the currency chip live); plain TEXT (a string or a number) is a caption UNDER\n * the field, attached through `aria-describedby` after the caller's own. A phone's\n * `variant=\"display\"` has no visible label, so a FieldHint is dropped there; a\n * caption still shows.\n *\n * Since 0.34 a FieldHint is that caption at Large and on a touch screen, as on\n * NumberInput since 0.32 (`useInlineHint`, docs/text-size-harmonization.md §4: a fact\n * a finger cannot hover open is printed). A `HelpPopover` — help, not a fact (§10.23)\n * — stays on the label line at every size. */\n hint?: ReactNode;\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 /** Offer only these ISO codes in the chip's list, in this order — `CurrencySelect`'s\n * `options`, since the chip renders CurrencySelect's list (round 0.34 Wave 2, DUP-4).\n * Default every currency the kit knows. */\n currencyOptions?: 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 * Since 0.15.5 it is drawn on its own too, for a read-only or disabled signed figure\n * (an \"Items total\" of −5.18): no `onNegativeChange` needed just to show the minus.\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 * Decimals the committed amount is rounded to (kastlan 0.12: \"12.345\" and a\n * calculator's \"100/3\" reached a `Numeric(10,2)` column unrounded and failed with a\n * 422). Default: the currency's minor unit, from `Intl` (CHF and EUR 2, JPY 0). With\n * no `currency`, nothing is rounded unless this is set. Rounding is half away from\n * zero (12.345 → 12.35, -12.345 → -12.35) and happens when the figure settles: on\n * blur, on Enter, and on every result the calculator writes back. Keystrokes are left\n * alone, so \"12.3\" can still become \"12.34\".\n *\n * ⚠️ **A unit price or a rate needs `digits`.** The default is right for an amount of\n * money and silently wrong for a price per unit: a fund's NAV of 123.4567 or fuel at\n * 1.789 €/l is stored as 123.46 / 1.79, and no test fails (keksdose G2, a\n * `Numeric(18,6)` holding price and a `Numeric(18,4)` unit price). Pass the column's\n * scale: `digits={4}`, `digits={6}`.\n *\n * **Set `digits` for any sub-currency scale** — not only a price: any field whose\n * column holds more decimals than the currency's minor unit. A split line stored at\n * the ledger's 4dp (`Numeric(18,4)`) and loaded as 12.3456 is SHOWN as 12.35, and\n * committed as 12.35 as soon as the user tabs through it (blur settles) — so the form\n * no longer equals what the server holds: the lines stop summing to the 4dp total,\n * and Save is held (keksdose live #240). With a `currency`, every commit rounds to that currency's\n * minor unit unless `digits` says otherwise: pass the column's scale (`digits={4}`).\n */\n digits?: number;\n /** The smallest amount the field settles on. A lower figure is raised to it when it\n * settles, like `digits`. Compared with the signed figure. */\n min?: number;\n /** The largest amount the field settles on (a deposit release capped at the\n * balance). A higher figure is lowered to it when it settles. */\n max?: number;\n /**\n * The SETTLED figure, dot-decimal, sign included — fired on blur, on Enter, on the\n * numpad's \"=\" and once per calculator session (its \"=\" or Enter in its display, or\n * the pad closing on a result not committed yet), never on a keystroke (\"1200+\" is\n * not a figure yet). `onChange` still reports every keystroke and every result the\n * calculator writes back; this is for a host that stores a number and must not see\n * drafts (kastlan 52; see {@link MoneyField}, which is built on it).\n *\n * Refactor audit 2026-10-30, INP-1: every calculator keystroke that resolved used to\n * commit, so \"100+50\" committed 105 on its way to 150 — keksdose saved both, and its\n * threshold field, `disabled` while it saves, lost the calculator to the first.\n */\n onCommit?: (value: string) => void;\n /**\n * Why the amount cannot be changed — {@link NumberInput}'s `disabledReason` (0.34,\n * round 0.34 C2), for an amount that SAVES itself: a budget row's assigned cell, a\n * price committed on blur. `disabled` takes the field out of the tab order, so the\n * reason never reached a keyboard.\n *\n * With a reason the field stays in the tab order and shows its figure, `readOnly` (the\n * settled grey FIELD_BASE gives a `[readonly]` field) and `aria-disabled`. Nothing\n * changes the amount: the calculator and the phone's numpad are not offered, the\n * currency chip is a read-out rather than a picker, and neither blur nor Enter\n * settles — so `onChange`, `onCommit`, `onNegativeChange` and `onCurrencyChange` are\n * never called. Enter is swallowed, so the field does not submit the form around it.\n * The reason is a line under the field at Large and on a touch screen, else in the kit\n * {@link Tooltip} (`disabledReasonDisplay`), and on the input's `aria-describedby`,\n * between the caption and the error. Wins over `disabled`. {@link MoneyField} and\n * `RhfMoneyField` take it too.\n */\n disabledReason?: ReactNode;\n /**\n * Where the reason shows — {@link Button}'s `disabledReasonDisplay`: by default a line\n * under the field at Large and on a touch screen, the tooltip otherwise (§4 \"No fact\n * only in a tooltip\"; DUP-3, refactor audit 2026-10).\n */\n disabledReasonDisplay?: DisabledReasonDisplay;\n /**\n * This amount COMMITS — {@link Button}'s `commit`, NumberInput's: under a locked\n * {@link WriteLockProvider} it is locked the `disabledReason` way with the lock's reason\n * (which wins over its own). An amount that only reaches the server through its form's\n * Save leaves this off and stays editable under the lock; the Save takes `commit`. No\n * provider, or an unlocked one: no effect.\n */\n commit?: CommitScope;\n /** The `<input>`. A React 19 ref prop since 0.34 (MOD-4, refactor audit 2026-10); it\n * was `forwardRef`. */\n ref?: Ref<HTMLInputElement>;\n}\n\n/**\n * A settled figure, rounded to `digits` (half away from zero) and clamped to\n * `min`/`max`. Only a plain number is touched. A half-typed draft or an expression\n * comes back as it was. Rounding is `lib/round.ts`'s, shared with `roundToCurrency`\n * (BUG-11: this copy blanked \"0.0000001\" and a 22-digit figure on blur).\n */\nfunction settleAmount(text: string, digits: number | undefined, min?: number, max?: number): string {\n const t = text.trim();\n if (!/^-?\\d*\\.?\\d*$/.test(t) || !/\\d/.test(t)) return text;\n let n = Number(t);\n if (!Number.isFinite(n)) return text;\n if (digits !== undefined) n = roundHalfAway(n, digits);\n if (min !== undefined && n < min) n = min;\n if (max !== undefined && n > max) n = max;\n const out = formatResult(n);\n // Unchanged figures keep their own spelling (\"12.50\" stays \"12.50\").\n return Number(out) === Number(t) ? text : out;\n}\n\n// The locale's decimal mark and the grouping parse (kastlan 40, keksdose G1) live in\n// `lib/decimal-marks.ts`, read through the engine NumberInput and this field share\n// (`numeric-field.ts`, DUP-10).\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(FIELD_DISPLAY, \"text-4xl font-semibold leading-tight tracking-tight tabular-nums\");\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, settle: (text: string) => string): boolean {\n const n = evaluateExpression(previous);\n // Compared settled, since the field rounds what the calculator hands it.\n return n !== null && settle(formatResult(n)) === text.trim();\n}\n\nexport function AmountInput(props: AmountInputProps) {\n const {\n ref,\n value,\n onChange,\n currency,\n onCurrencyChange,\n placeholder,\n label,\n className,\n inputClassName,\n id,\n \"aria-label\": ariaLabel,\n \"aria-required\": ariaRequired,\n autoFocus,\n tone = \"neutral\",\n negative = false,\n onNegativeChange,\n align = \"start\",\n labels,\n currencyNames,\n currencyOptions,\n digits: digitsProp,\n min,\n max,\n onCommit,\n disabledReasonDisplay,\n } = props;\n const generatedId = useId();\n const fieldId = id ?? generatedId;\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 // The sign is DRAWN whenever `negative` says so, handler or not (keksdose live #366):\n // a read-only or disabled total (\"−5.18\") used to need a dummy `onNegativeChange`\n // just to show its minus. Without the handler there is nothing to toggle — a typed\n // minus simply stays in the text, as in any field without a direction control.\n const shown = negative && isBareAmount(value) ? `-${value}` : value;\n // What the user SEES is `shown` with the locale's decimal mark (kastlan 40: a\n // fr-CH user typed \"1,5\" and watched it turn into \"1.5\" under their fingers). Display only — `value`, `onChange`, the sign split and the settle all\n // stay dot-decimal, because that string is the contract: RhfMoneyField's\n // `parseAmount`, every app's `Number(value)` and the calculator's evaluator read\n // it. The way back is free: {@link sanitizeLive} already folds a typed \",\" into\n // \".\", so a comma typed, pasted or tapped on the numpad lands as a dot.\n //\n // One character for one character, and no digit grouping: the caret stays where\n // the typist put it, and \"1.000\" cannot be read back as a thousand in one locale\n // and as one in the other. de-CH and it-CH are \".\" — CLDR says so, and this\n // follows `Intl` rather than a guess about a country. The field's own `locale`,\n // else the provider's (0.34, DUP-10).\n const locale = useKitLocale(props.locale);\n // Decimals the figure settles to: `digits`, else the currency's minor unit.\n const digits = digitsProp ?? currencyMinorDigits(currency);\n const settle = (text: string) => settleAmount(text, digits, min, max);\n // The engine NumberInput shares (DUP-10): the lock (focusable, `readOnly`, nothing\n // changes or settles — see `disabledReason`), the hint — a FieldHint is its words at\n // Large and on touch, §4 — the error, the description's order, the typist's draft\n // in the locale's mark, the calculator and the numpad. On a phone the OS keyboard\n // is suppressed for the numpad sheet (feedback #334), and the display shape keys off\n // the SAME phone layout, so the two can never drift apart on the breakpoint.\n //\n // A value the HOST set (not one typed here) is shown at the currency's minor unit\n // while the field is not being edited: an FX estimate of 93.4213 showed four\n // decimals (keksdose live #356). Display only — `value` is the host's, untouched.\n const numeric = useNumericField(props, {\n settle,\n display: (focused) => (focused ? shown : settleAmount(shown, digits)),\n });\n const { lock, locked, off, isMobile, asDisplay, showCalc, showNumpad, setFocused, mark, draft, setDraft, derived } =\n numeric;\n const invalid = numeric.isInvalid;\n // A locked or disabled chip is a read-out: picking a currency is a change too.\n const editable = !!onCurrencyChange && !locked && !off;\n // Room for the trailing controls — the calculator and the currency chip — once\n // measured, as NumberInput reserves its own (keksdose live #367, DUP-10): their\n // width, the track's `end-1` inset in the boxed shape, and NumberInput's 4px gap.\n // Before that (the first paint, and wherever there is no layout) the classes below\n // stand in. showCalc is always false on a phone, so the display shape only has to\n // clear the chip, by its own width rather than the boxed shape's room (feedback #430\n // rework: on a 375px screen 16px decide between a readable figure and a clipped one).\n const hasEnd = showCalc || Boolean(currency);\n const [endRef, endWidth] = useEndWidth(hasEnd);\n const trailingRoom = asDisplay\n ? currency\n ? editable\n ? \"pe-16\"\n : \"pe-12\"\n : undefined\n : showCalc\n ? currency\n ? editable\n ? \"pe-24\"\n : \"pe-16\"\n : \"pe-10\"\n : currency\n ? editable\n ? \"pe-20\"\n : \"pe-14\"\n : undefined;\n const innerRef = useRef<HTMLInputElement>(null);\n const setRefs = useMemo(() => mergeRefs(innerRef, ref), [ref]);\n // While the typist is typing, the field shows THEIR text (\"1.234,5\" stays exactly\n // that), not the value re-spelt: re-spelling turned a grouping \".\" into a \",\" under\n // their fingers, after which no rule could tell the two apart (keksdose G1). The\n // draft only while it says what the field holds AND holds nothing the live\n // sanitising would drop — a letter, a second decimal point (see `showsTyped`); a\n // value set from outside, a calculator result or a commit shows the derived spelling.\n const display =\n draft === null\n ? derived\n : (numeric.typedFor(shown) ??\n // The caller owns the sign: the typed \"12\" is shown as the \"-12\" it is.\n (signOwned && negative && shown.startsWith(\"-\") && numeric.typedFor(shown.slice(1)) !== null\n ? `-${draft}`\n : derived));\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, settle)) {\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 = () => {\n setDraft(null);\n const settled = settle(commitExpression(shown));\n handleText(settled);\n onCommit?.(settled);\n };\n const typed = (raw: string) => handleText(numeric.read(raw));\n // The currency list is CurrencySelect's (round 0.34 Wave 2, DUP-4) on the picker\n // family's core: the chip was a hand copy of it and had drifted (no wrap at Large, no\n // `options` subset, no check mark, no listbox id, no #308 width), and both were plain\n // buttons under a listbox promise. `filter: false`: the list filters its own rows.\n const core = useComboboxCore<string>({ filter: false, backCloses: true });\n // `chipRef`: the chip the currency list hangs off (Keksdose dev#548: portalled, so the\n // panel needs a real trigger rect rather than a relative parent). It is also where\n // Escape and a pick hand focus back (round 0.34 BUG-1): Safari does not focus a\n // clicked button, so \"whatever held focus\" is not the chip.\n const { open, setOpen, closeToTrigger, triggerRef: chipRef } = core;\n const listboxId = `${generatedId}-currencies`;\n // A lock arriving while the list is up closes it, as on CountrySelect — adjusted\n // while rendering, so no frame shows a list that can no longer be used.\n if (!editable && open) setOpen(false);\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 // The two strings read out first, so the memo depends on them and not on the\n // caller's `labels` object (a new one every render) — what the React Compiler infers.\n const currencyLabel = labels?.currency;\n const currencySearchLabel = labels?.currencySearch;\n const currencyOverrides = useMemo(() => {\n const out: Partial<CurrencyLabels> = {};\n if (currencyLabel !== undefined) out.currency = currencyLabel;\n if (currencySearchLabel !== undefined) out.search = currencySearchLabel;\n return out;\n }, [currencyLabel, currencySearchLabel]);\n const currencyText = useKitLabels(\"currency\", DEFAULT_CURRENCY_LABELS, currencyOverrides);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n\n const selected = getCurrency(currency);\n\n return (\n <div {...dataAttributes(props)} 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). It is\n the kit's FloatingField, which draws the label — floating, or sr-only in\n the display shape — and puts a FieldHint on the label's line, as it does\n for NumberInput. */}\n {/* Locked, the field sits in the reason's frame (LockedReason: the line, or the\n Tooltip), as NumberInput does; the root above keeps `className`, so nothing\n reflows. */}\n <LockedOrNot lock={lock} display={disabledReasonDisplay}>\n <FloatingField\n className=\"w-full\"\n htmlFor={fieldId}\n label={label}\n srOnlyLabel={asDisplay}\n hint={numeric.hint.labelHint}\n >\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={off}\n // Locked: focusable, `readOnly`, `aria-disabled` — see `disabledReason`.\n readOnly={locked || undefined}\n aria-disabled={locked || undefined}\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={display}\n onChange={(e) => {\n if (!locked) typed(e.target.value);\n }}\n onFocus={() => setFocused(true)}\n onBlur={() => {\n // Nothing settles under the lock — not even a draft typed before it arrived,\n // which stays in the field for when it lifts.\n if (!locked) commit();\n setFocused(false);\n }}\n onKeyDown={(e) => {\n if (e.key !== \"Enter\") return;\n // Locked: Enter submits no form and settles nothing.\n if (locked) e.preventDefault();\n else 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 // The plain end padding, with nothing trailing: cosmetic, so the caller's\n // to change (keksdose 0.24 — a symmetric `px-2` in a budget cell).\n !trailingRoom && (asDisplay ? \"pe-0\" : \"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 below 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 // Over the base class's own text colour.\n TONE_CLASS[tone],\n // The caller's, over all of the above — base, plain padding, alignment and\n // tone — and under only what the field needs to work (see `inputClassName`).\n inputClassName,\n // Room for the trailing controls, after the caller's so a `px-2` cannot run\n // the digits under the chip (NumberInput's order, which reserves its unit\n // and calculator the same way).\n trailingRoom,\n invalid && FIELD_INVALID,\n locked && \"cursor-not-allowed\",\n )}\n // The classes above are the fallback; once measured the field reserves exactly\n // its trailing controls' width, inline so it wins over every class (see\n // `trailingRoom`).\n style={hasEnd && endWidth != null ? { paddingInlineEnd: endWidth + (asDisplay ? 4 : 8) } : undefined}\n aria-invalid={invalid || undefined}\n aria-describedby={numeric.describedBy}\n aria-required={ariaRequired}\n />\n {/* The label is FloatingField's, after these children (the floating trick\n reads the input through `peer-*`). The display shape drops it VISUALLY,\n not from the accessibility tree: a 36px tinted figure at the top of a\n transaction form is legibly the amount, but a screen reader still needs\n the name, and callers that pass `label` without `aria-label` would\n otherwise be left with none. */}\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 // Measured for the input's end padding (see `trailingRoom`).\n ref={endRef}\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 // The mark the field shows but not the typist's grouping: the evaluator\n // reads either mark, and \"1.234,5\" is two of them. The result comes back\n // dot-decimal.\n value={derived}\n // Live: every result, settled, so the field never shows more decimals than\n // it will keep. The commit is the session's one (INP-1): its \"=\", or the pad\n // closing on a newer result — not each figure on the way to the result.\n onChange={(result, expression) => {\n setDraft(null);\n handleText(settle(result), expression);\n }}\n onCommit={(result) => onCommit?.(settle(result))}\n className=\"px-1.5\"\n aria-label={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-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 // A button that opens a listbox, and says so: the chip is a control inside\n // a text field, not a field of its own, so not a combobox.\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={listboxId}\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-secondary hover:bg-hover\",\n asDisplay ? \"text-sm\" : \"text-xs\",\n )}\n >\n {currency}\n <ChevronDown className=\"size-3\" />\n </button>\n )}\n </div>\n {editable && (\n <CurrencyOptionList\n core={core}\n listboxId={listboxId}\n value={currency}\n codes={currencyOptions}\n currencyNames={currencyNames}\n locale={locale}\n searchPlaceholder={currencyText.search}\n // The phone sheet's title: what the chip is for.\n sheetTitle={currencyText.currency}\n onChoose={(code) => {\n onCurrencyChange?.(code);\n closeToTrigger();\n }}\n />\n )}\n </FloatingField>\n </LockedOrNot>\n {/* Outside the relative box, as NumberInput's caption is: the trailing\n controls are `inset-y-1` in it and would stretch down over a second line. */}\n <FieldCaption parts={numeric.hint} />\n {/* The news after the standing advice, as Select orders them. The root is\n already a steady box, so the message coming and going remounts nothing. */}\n {numeric.errorEl}\n {showNumpad && (\n <NumberPadSheet\n // Localised like the field it mirrors. Keys are typing, read by the\n // locale's marks like the keyboard's; \"=\" is a result, dot-decimal.\n value={display}\n onChange={typed}\n onResult={(result) => {\n setDraft(null);\n const settled = settle(result);\n handleText(settled);\n onCommit?.(settled);\n }}\n onDone={() => innerRef.current?.blur()}\n label={label}\n labels={labels?.pad}\n decimalMark={mark}\n />\n )}\n </div>\n );\n}\n\n/** The field in its lock's {@link LockedReason} while locked, as it is otherwise. A\n * component rather than a ternary so the field's JSX is written once. `block w-full`:\n * the frame's box stands where the field's own did. */\nfunction LockedOrNot({\n lock,\n display,\n children,\n}: {\n lock: LockReason;\n display: DisabledReasonDisplay | undefined;\n children: ReactNode;\n}) {\n if (!lock.locked) return <>{children}</>;\n return (\n <LockedReason lock={lock} display={display} className=\"block w-full\">\n {children}\n </LockedReason>\n );\n}\n"],"mappings":";AA2kBU,SAkNiB,UAlNjB,KA+HI,YA/HJ;AA3kBV,SAAS,OAAO,SAAS,cAAc;AACvC,SAAS,mBAAmB;AAE5B,SAAS,oBAAoB,mBAAmB;AAChD,SAAS,uBAAuB;AAChC,SAAS,YAAY,eAAe,eAAe,sBAAsB,qBAAqB;AAC9F,SAAS,UAAU;AACnB,SAAS,2BAA2B;AACpC,S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O;AAAA,cACP,OAAO;AAAA,cACP;AAAA,cACA;AAAA,cACA,mBAAmB,aAAa;AAAA,cAEhC,YAAY,aAAa;AAAA,cACzB,UAAU,CAAC,SAAS;AAClB,mCAAmB,IAAI;AACvB,+BAAe;AAAA,cACjB;AAAA;AAAA,UACF;AAAA;AAAA;AAAA,IAEJ,GACF;AAAA,IAGA,oBAAC,gBAAa,OAAO,QAAQ,MAAM;AAAA,IAGlC,QAAQ;AAAA,IACR,cACC;AAAA,MAAC;AAAA;AAAA,QAGC,OAAO;AAAA,QACP,UAAU;AAAA,QACV,UAAU,CAAC,WAAW;AACpB,mBAAS,IAAI;AACb,gBAAM,UAAU,OAAO,MAAM;AAC7B,qBAAW,OAAO;AAClB,qBAAW,OAAO;AAAA,QACpB;AAAA,QACA,QAAQ,MAAM,SAAS,SAAS,KAAK;AAAA,QACrC;AAAA,QACA,QAAQ,QAAQ;AAAA,QAChB,aAAa;AAAA;AAAA,IACf;AAAA,KAEJ;AAEJ;AAKA,SAAS,YAAY;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,MAAI,CAAC,KAAK,OAAQ,QAAO,gCAAG,UAAS;AACrC,SACE,oBAAC,gBAAa,MAAY,SAAkB,WAAU,gBACnD,UACH;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/amount-input.tsx"],"sourcesContent":["import { useId, useMemo, useRef } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport type { ReactNode, Ref } from \"react\";\nimport { CurrencyOptionList, getCurrency } from \"./currency-option-list\";\nimport { useComboboxCore } from \"./combobox-core\";\nimport { FIELD_BASE, FIELD_DISPLAY, FIELD_INVALID, FLOATING_INPUT_CLASS, FloatingField } from \"./field-base\";\nimport { cn } from \"../lib/cn\";\nimport { currencyMinorDigits } from \"../lib/format\";\nimport { roundHalfAway } from \"../lib/round\";\nimport { CalculatorButton, type CalculatorButtonLabels } from \"./calculator\";\nimport { NumberPadSheet, type NumberPadSheetLabels } from \"./numpad-sheet\";\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\";\nimport {\n FieldCaption,\n LockedReason,\n mergeRefs,\n type DisabledReasonDisplay,\n type FieldHelpProps,\n type LockReason,\n} from \"./field-parts\";\nimport { useEndWidth, useNumericField } from \"./numeric-field\";\nimport type { CommitScope } from \"./write-lock\";\nimport { dataAttributes, type DataAttributes } from \"../lib/data-attributes\";\n\n/** {@link AmountInput}'s props — exported since 0.34 (refactor audit 2026-10, API-9): a\n * wrapper typed itself off `ComponentProps<typeof AmountInput>` until then. */\nexport interface AmountInputProps extends FieldHelpProps, DataAttributes {\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 /**\n * What is wrong with the amount, in the caller's own words — {@link Input}'s `error`\n * (keksdose K4: \"exceeds the outstanding balance\" was a loose `<p>` beside the field\n * that nothing pointed at). Rendered under the field, after a text `hint`; merged into\n * `aria-describedby` after the caller's ids and the hint's; implies `invalid`, so the\n * field paints as well as announces. `null`, `false` and `\"\"` are no message.\n * {@link MoneyField} takes it too.\n */\n error?: ReactNode;\n /**\n * Show the desktop calculator trigger (default `true`). `false` for an amount in an\n * ephemeral close-on-blur editor — a budget's assigned cell, a VAT cell (keksdose K6)\n * — where a click on the icon blurs the field and tears the editor down before the\n * popover can open. Typing a calculation (\"200+50\", then Enter) still evaluates, and\n * a phone keeps its numpad, exactly as {@link NumberInput}'s `calculator={false}`.\n */\n calculator?: boolean;\n /** The field's WRAPPER — width, a margin, a flex share. The `<input>` is\n * `inputClassName`'s. */\n className?: string;\n /**\n * Classes for the `<input>` itself — {@link NumberInput}'s and {@link Input}'s prop of\n * the same name, merged the same way: after everything the field sets for LOOKS — the\n * base classes, the plain end padding, the display shape's centring and the `tone`\n * colour — so it can restyle the figure (`text-end` for a money column whose decimal\n * points line up, `font-medium`, a tighter `py-1` or a symmetric `px-2` in a table\n * cell, `text-transparent` while a figure is being re-fetched), and before what the\n * field needs to WORK: the end padding the calculator and the currency chip reserve,\n * and the invalid border. Neither of those can be taken away by accident — a caller's\n * `px-2` keeps its start edge and the digits still stop short of the chip, and a\n * borderless cell's `border-transparent` still turns red when the value is wrong.\n *\n * keksdose G7: the invoice's VAT cell right-aligns its figure, and with only\n * `className` (the wrapper) it reached the element through `[&_input]:text-end` — a\n * descendant selector that depends on the field's inner markup, which the kit is free\n * to change, and that a reader of the call site has to decode. {@link MoneyField}\n * passes it through, and `RhfMoneyField` takes it too.\n *\n * keksdose 0.24: until then it sat BEFORE the plain end padding (`pe-3`) and the tone,\n * so the budget's assigned cell could not make its padding symmetric (`px-2` came out\n * `px-2 pe-3`) and the holdings price could not hide an outflow-toned figure while\n * re-fetching — both were back on `[&_input]:` selectors on the wrapper.\n */\n inputClassName?: string;\n id?: string;\n /** Names the field when it has no visible `label` (a table cell, the display shape). */\n \"aria-label\"?: string;\n /**\n * Set on the `<input>`, with `id` above. Declared so `Field`'s render-prop spread —\n * `{(ids) => <AmountInput {...ids} … />}` — is typed and reaches the input: the\n * hint and error are described, a required amount is announced as required, and\n * `aria-invalid` paints {@link FIELD_INVALID} the way `invalid` does.\n */\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean | \"true\" | \"false\";\n \"aria-required\"?: boolean | \"true\" | \"false\";\n /**\n * BCP 47 tag for this field — {@link NumberInput}'s `locale` (0.34, DUP-10): the decimal\n * mark the field SHOWS and reads typing in (\"1,5\" for fr-CH, \"1.5\" for de-CH, as `Intl`\n * decides), and the language of the currency picker's search. Default the\n * `<UiKitProvider locale>`, else the runtime's. `value` and `onChange` stay\n * dot-decimal.\n */\n locale?: string;\n /** {@link NumberInput}'s `hint`, the same rule: a {@link FieldHint} \"?\" rides the\n * label's own line, beside the label (not at the far end, where the calculator and\n * the currency chip live); plain TEXT (a string or a number) is a caption UNDER\n * the field, attached through `aria-describedby` after the caller's own. A phone's\n * `variant=\"display\"` has no visible label, so a FieldHint is dropped there; a\n * caption still shows.\n *\n * Since 0.34 a FieldHint is that caption at Large and on a touch screen, as on\n * NumberInput since 0.32 (`useInlineHint`, docs/text-size-harmonization.md §4: a fact\n * a finger cannot hover open is printed). A `HelpPopover` — help, not a fact (§10.23)\n * — stays on the label line at every size. */\n hint?: ReactNode;\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 /** Offer only these ISO codes in the chip's list, in this order — `CurrencySelect`'s\n * `options`, since the chip renders CurrencySelect's list (round 0.34 Wave 2, DUP-4).\n * Default every currency the kit knows. */\n currencyOptions?: 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 * Since 0.15.5 it is drawn on its own too, for a read-only or disabled signed figure\n * (an \"Items total\" of −5.18): no `onNegativeChange` needed just to show the minus.\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 * Decimals the committed amount is rounded to (kastlan 0.12: \"12.345\" and a\n * calculator's \"100/3\" reached a `Numeric(10,2)` column unrounded and failed with a\n * 422). Default: the currency's minor unit, from `Intl` (CHF and EUR 2, JPY 0). With\n * no `currency`, nothing is rounded unless this is set. Rounding is half away from\n * zero (12.345 → 12.35, -12.345 → -12.35) and happens when the figure settles: on\n * blur, on Enter, and on every result the calculator writes back. Keystrokes are left\n * alone, so \"12.3\" can still become \"12.34\".\n *\n * ⚠️ **A unit price or a rate needs `digits`.** The default is right for an amount of\n * money and silently wrong for a price per unit: a fund's NAV of 123.4567 or fuel at\n * 1.789 €/l is stored as 123.46 / 1.79, and no test fails (keksdose G2, a\n * `Numeric(18,6)` holding price and a `Numeric(18,4)` unit price). Pass the column's\n * scale: `digits={4}`, `digits={6}`.\n *\n * **Set `digits` for any sub-currency scale** — not only a price: any field whose\n * column holds more decimals than the currency's minor unit. A split line stored at\n * the ledger's 4dp (`Numeric(18,4)`) and loaded as 12.3456 is SHOWN as 12.35, and\n * committed as 12.35 as soon as the user tabs through it (blur settles) — so the form\n * no longer equals what the server holds: the lines stop summing to the 4dp total,\n * and Save is held (keksdose live #240). With a `currency`, every commit rounds to that currency's\n * minor unit unless `digits` says otherwise: pass the column's scale (`digits={4}`).\n */\n digits?: number;\n /** The smallest amount the field settles on. A lower figure is raised to it when it\n * settles, like `digits`. Compared with the signed figure. */\n min?: number;\n /** The largest amount the field settles on (a deposit release capped at the\n * balance). A higher figure is lowered to it when it settles. */\n max?: number;\n /**\n * The SETTLED figure, dot-decimal, sign included — fired on blur, on Enter, on the\n * numpad's \"=\" and once per calculator session (its \"=\" or Enter in its display, or\n * the pad closing on a result not committed yet), never on a keystroke (\"1200+\" is\n * not a figure yet). `onChange` still reports every keystroke and every result the\n * calculator writes back; this is for a host that stores a number and must not see\n * drafts (kastlan 52; see {@link MoneyField}, which is built on it).\n *\n * Refactor audit 2026-10-30, INP-1: every calculator keystroke that resolved used to\n * commit, so \"100+50\" committed 105 on its way to 150 — keksdose saved both, and its\n * threshold field, `disabled` while it saves, lost the calculator to the first.\n */\n onCommit?: (value: string) => void;\n /**\n * Why the amount cannot be changed — {@link NumberInput}'s `disabledReason` (0.34,\n * round 0.34 C2), for an amount that SAVES itself: a budget row's assigned cell, a\n * price committed on blur. `disabled` takes the field out of the tab order, so the\n * reason never reached a keyboard.\n *\n * With a reason the field stays in the tab order and shows its figure, `readOnly` (the\n * settled grey FIELD_BASE gives a `[readonly]` field) and `aria-disabled`. Nothing\n * changes the amount: the calculator and the phone's numpad are not offered, the\n * currency chip is a read-out rather than a picker, and neither blur nor Enter\n * settles — so `onChange`, `onCommit`, `onNegativeChange` and `onCurrencyChange` are\n * never called. Enter is swallowed, so the field does not submit the form around it.\n * The reason is a line under the field at Large and on a touch screen, else in the kit\n * {@link Tooltip} (`disabledReasonDisplay`), and on the input's `aria-describedby`,\n * between the caption and the error. Wins over `disabled`. {@link MoneyField} and\n * `RhfMoneyField` take it too.\n */\n disabledReason?: ReactNode;\n /**\n * Where the reason shows — {@link Button}'s `disabledReasonDisplay`: by default a line\n * under the field at Large and on a touch screen, the tooltip otherwise (§4 \"No fact\n * only in a tooltip\"; DUP-3, refactor audit 2026-10).\n */\n disabledReasonDisplay?: DisabledReasonDisplay;\n /**\n * This amount COMMITS — {@link Button}'s `commit`, NumberInput's: under a locked\n * {@link WriteLockProvider} it is locked the `disabledReason` way with the lock's reason\n * (which wins over its own). An amount that only reaches the server through its form's\n * Save leaves this off and stays editable under the lock; the Save takes `commit`. No\n * provider, or an unlocked one: no effect.\n */\n commit?: CommitScope;\n /** The `<input>`. A React 19 ref prop since 0.34 (MOD-4, refactor audit 2026-10); it\n * was `forwardRef`. */\n ref?: Ref<HTMLInputElement>;\n}\n\n/**\n * A settled figure, rounded to `digits` (half away from zero) and clamped to\n * `min`/`max`. Only a plain number is touched. A half-typed draft or an expression\n * comes back as it was. Rounding is `lib/round.ts`'s, shared with `roundToCurrency`\n * (BUG-11: this copy blanked \"0.0000001\" and a 22-digit figure on blur).\n */\nfunction settleAmount(text: string, digits: number | undefined, min?: number, max?: number): string {\n const t = text.trim();\n if (!/^-?\\d*\\.?\\d*$/.test(t) || !/\\d/.test(t)) return text;\n let n = Number(t);\n if (!Number.isFinite(n)) return text;\n if (digits !== undefined) n = roundHalfAway(n, digits);\n if (min !== undefined && n < min) n = min;\n if (max !== undefined && n > max) n = max;\n const out = formatResult(n);\n // Unchanged figures keep their own spelling (\"12.50\" stays \"12.50\").\n return Number(out) === Number(t) ? text : out;\n}\n\n// The locale's decimal mark and the grouping parse (kastlan 40, keksdose G1) live in\n// `lib/decimal-marks.ts`, read through the engine NumberInput and this field share\n// (`numeric-field.ts`, DUP-10).\n\n/**\n * The figure's colour per {@link AmountInputProps.tone} — public as `AMOUNT_TONE_CLASS`,\n * for a table cell or a test that must paint the same figure the same way (keksdose's\n * receipt lines, dev#556).\n *\n * The consuming app's ONE money palette (`--money-expense` / `--money-income`), not a\n * bespoke rose/emerald pairing: a figure being typed has to wear the same colour the same\n * figure will wear once it is a row in the table behind the form (Keksdose dev#434). The\n * utilities are unlayered and theme-aware, so no `dark:` variant is needed and they win\n * over the field's own text colour regardless of where `cn` puts them.\n */\nconst TONE_CLASS: Readonly<Record<NonNullable<AmountInputProps[\"tone\"]>, string>> = {\n neutral: \"\",\n outflow: \"text-money-neg\",\n inflow: \"text-money-pos\",\n};\n// Exported in 0.52 because keksdose's tests read it out of dist/components/amount-input.js\n// with a regex for `const TONE_CLASS` — the one reach into the kit's dist in three apps,\n// which a rename or a moved module breaks with no public change (MOD-8, refactor audit\n// 2026-10-30; 0.34's move failed 91 of keksdose's test files that way). The local name\n// stays until keksdose imports the export, so the bump itself breaks nothing.\nexport { TONE_CLASS as AMOUNT_TONE_CLASS };\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(FIELD_DISPLAY, \"text-4xl font-semibold leading-tight tracking-tight tabular-nums\");\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, settle: (text: string) => string): boolean {\n const n = evaluateExpression(previous);\n // Compared settled, since the field rounds what the calculator hands it.\n return n !== null && settle(formatResult(n)) === text.trim();\n}\n\nexport function AmountInput(props: AmountInputProps) {\n const {\n ref,\n value,\n onChange,\n currency,\n onCurrencyChange,\n placeholder,\n label,\n className,\n inputClassName,\n id,\n \"aria-label\": ariaLabel,\n \"aria-required\": ariaRequired,\n autoFocus,\n tone = \"neutral\",\n negative = false,\n onNegativeChange,\n align = \"start\",\n labels,\n currencyNames,\n currencyOptions,\n digits: digitsProp,\n min,\n max,\n onCommit,\n disabledReasonDisplay,\n } = props;\n const generatedId = useId();\n const fieldId = id ?? generatedId;\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 // The sign is DRAWN whenever `negative` says so, handler or not (keksdose live #366):\n // a read-only or disabled total (\"−5.18\") used to need a dummy `onNegativeChange`\n // just to show its minus. Without the handler there is nothing to toggle — a typed\n // minus simply stays in the text, as in any field without a direction control.\n const shown = negative && isBareAmount(value) ? `-${value}` : value;\n // What the user SEES is `shown` with the locale's decimal mark (kastlan 40: a\n // fr-CH user typed \"1,5\" and watched it turn into \"1.5\" under their fingers). Display only — `value`, `onChange`, the sign split and the settle all\n // stay dot-decimal, because that string is the contract: RhfMoneyField's\n // `parseAmount`, every app's `Number(value)` and the calculator's evaluator read\n // it. The way back is free: {@link sanitizeLive} already folds a typed \",\" into\n // \".\", so a comma typed, pasted or tapped on the numpad lands as a dot.\n //\n // One character for one character, and no digit grouping: the caret stays where\n // the typist put it, and \"1.000\" cannot be read back as a thousand in one locale\n // and as one in the other. de-CH and it-CH are \".\" — CLDR says so, and this\n // follows `Intl` rather than a guess about a country. The field's own `locale`,\n // else the provider's (0.34, DUP-10).\n const locale = useKitLocale(props.locale);\n // Decimals the figure settles to: `digits`, else the currency's minor unit.\n const digits = digitsProp ?? currencyMinorDigits(currency);\n const settle = (text: string) => settleAmount(text, digits, min, max);\n // The engine NumberInput shares (DUP-10): the lock (focusable, `readOnly`, nothing\n // changes or settles — see `disabledReason`), the hint — a FieldHint is its words at\n // Large and on touch, §4 — the error, the description's order, the typist's draft\n // in the locale's mark, the calculator and the numpad. On a phone the OS keyboard\n // is suppressed for the numpad sheet (feedback #334), and the display shape keys off\n // the SAME phone layout, so the two can never drift apart on the breakpoint.\n //\n // A value the HOST set (not one typed here) is shown at the currency's minor unit\n // while the field is not being edited: an FX estimate of 93.4213 showed four\n // decimals (keksdose live #356). Display only — `value` is the host's, untouched.\n const numeric = useNumericField(props, {\n settle,\n display: (focused) => (focused ? shown : settleAmount(shown, digits)),\n });\n const { lock, locked, off, isMobile, asDisplay, showCalc, showNumpad, setFocused, mark, draft, setDraft, derived } =\n numeric;\n const invalid = numeric.isInvalid;\n // A locked or disabled chip is a read-out: picking a currency is a change too.\n const editable = !!onCurrencyChange && !locked && !off;\n // Room for the trailing controls — the calculator and the currency chip — once\n // measured, as NumberInput reserves its own (keksdose live #367, DUP-10): their\n // width, the track's `end-1` inset in the boxed shape, and NumberInput's 4px gap.\n // Before that (the first paint, and wherever there is no layout) the classes below\n // stand in. showCalc is always false on a phone, so the display shape only has to\n // clear the chip, by its own width rather than the boxed shape's room (feedback #430\n // rework: on a 375px screen 16px decide between a readable figure and a clipped one).\n const hasEnd = showCalc || Boolean(currency);\n const [endRef, endWidth] = useEndWidth(hasEnd);\n const trailingRoom = asDisplay\n ? currency\n ? editable\n ? \"pe-16\"\n : \"pe-12\"\n : undefined\n : showCalc\n ? currency\n ? editable\n ? \"pe-24\"\n : \"pe-16\"\n : \"pe-10\"\n : currency\n ? editable\n ? \"pe-20\"\n : \"pe-14\"\n : undefined;\n const innerRef = useRef<HTMLInputElement>(null);\n const setRefs = useMemo(() => mergeRefs(innerRef, ref), [ref]);\n // While the typist is typing, the field shows THEIR text (\"1.234,5\" stays exactly\n // that), not the value re-spelt: re-spelling turned a grouping \".\" into a \",\" under\n // their fingers, after which no rule could tell the two apart (keksdose G1). The\n // draft only while it says what the field holds AND holds nothing the live\n // sanitising would drop — a letter, a second decimal point (see `showsTyped`); a\n // value set from outside, a calculator result or a commit shows the derived spelling.\n const display =\n draft === null\n ? derived\n : (numeric.typedFor(shown) ??\n // The caller owns the sign: the typed \"12\" is shown as the \"-12\" it is.\n (signOwned && negative && shown.startsWith(\"-\") && numeric.typedFor(shown.slice(1)) !== null\n ? `-${draft}`\n : derived));\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, settle)) {\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 = () => {\n setDraft(null);\n const settled = settle(commitExpression(shown));\n handleText(settled);\n onCommit?.(settled);\n };\n const typed = (raw: string) => handleText(numeric.read(raw));\n // The currency list is CurrencySelect's (round 0.34 Wave 2, DUP-4) on the picker\n // family's core: the chip was a hand copy of it and had drifted (no wrap at Large, no\n // `options` subset, no check mark, no listbox id, no #308 width), and both were plain\n // buttons under a listbox promise. `filter: false`: the list filters its own rows.\n const core = useComboboxCore<string>({ filter: false, backCloses: true });\n // `chipRef`: the chip the currency list hangs off (Keksdose dev#548: portalled, so the\n // panel needs a real trigger rect rather than a relative parent). It is also where\n // Escape and a pick hand focus back (round 0.34 BUG-1): Safari does not focus a\n // clicked button, so \"whatever held focus\" is not the chip.\n const { open, setOpen, closeToTrigger, triggerRef: chipRef } = core;\n const listboxId = `${generatedId}-currencies`;\n // A lock arriving while the list is up closes it, as on CountrySelect — adjusted\n // while rendering, so no frame shows a list that can no longer be used.\n if (!editable && open) setOpen(false);\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 // The two strings read out first, so the memo depends on them and not on the\n // caller's `labels` object (a new one every render) — what the React Compiler infers.\n const currencyLabel = labels?.currency;\n const currencySearchLabel = labels?.currencySearch;\n const currencyOverrides = useMemo(() => {\n const out: Partial<CurrencyLabels> = {};\n if (currencyLabel !== undefined) out.currency = currencyLabel;\n if (currencySearchLabel !== undefined) out.search = currencySearchLabel;\n return out;\n }, [currencyLabel, currencySearchLabel]);\n const currencyText = useKitLabels(\"currency\", DEFAULT_CURRENCY_LABELS, currencyOverrides);\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n\n const selected = getCurrency(currency);\n\n return (\n <div {...dataAttributes(props)} 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). It is\n the kit's FloatingField, which draws the label — floating, or sr-only in\n the display shape — and puts a FieldHint on the label's line, as it does\n for NumberInput. */}\n {/* Locked, the field sits in the reason's frame (LockedReason: the line, or the\n Tooltip), as NumberInput does; the root above keeps `className`, so nothing\n reflows. */}\n <LockedOrNot lock={lock} display={disabledReasonDisplay}>\n <FloatingField\n className=\"w-full\"\n htmlFor={fieldId}\n label={label}\n srOnlyLabel={asDisplay}\n hint={numeric.hint.labelHint}\n >\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={off}\n // Locked: focusable, `readOnly`, `aria-disabled` — see `disabledReason`.\n readOnly={locked || undefined}\n aria-disabled={locked || undefined}\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={display}\n onChange={(e) => {\n if (!locked) typed(e.target.value);\n }}\n onFocus={() => setFocused(true)}\n onBlur={() => {\n // Nothing settles under the lock — not even a draft typed before it arrived,\n // which stays in the field for when it lifts.\n if (!locked) commit();\n setFocused(false);\n }}\n onKeyDown={(e) => {\n if (e.key !== \"Enter\") return;\n // Locked: Enter submits no form and settles nothing.\n if (locked) e.preventDefault();\n else 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 // The plain end padding, with nothing trailing: cosmetic, so the caller's\n // to change (keksdose 0.24 — a symmetric `px-2` in a budget cell).\n !trailingRoom && (asDisplay ? \"pe-0\" : \"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 below 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 // Over the base class's own text colour.\n TONE_CLASS[tone],\n // The caller's, over all of the above — base, plain padding, alignment and\n // tone — and under only what the field needs to work (see `inputClassName`).\n inputClassName,\n // Room for the trailing controls, after the caller's so a `px-2` cannot run\n // the digits under the chip (NumberInput's order, which reserves its unit\n // and calculator the same way).\n trailingRoom,\n invalid && FIELD_INVALID,\n locked && \"cursor-not-allowed\",\n )}\n // The classes above are the fallback; once measured the field reserves exactly\n // its trailing controls' width, inline so it wins over every class (see\n // `trailingRoom`).\n style={hasEnd && endWidth != null ? { paddingInlineEnd: endWidth + (asDisplay ? 4 : 8) } : undefined}\n aria-invalid={invalid || undefined}\n aria-describedby={numeric.describedBy}\n aria-required={ariaRequired}\n />\n {/* The label is FloatingField's, after these children (the floating trick\n reads the input through `peer-*`). The display shape drops it VISUALLY,\n not from the accessibility tree: a 36px tinted figure at the top of a\n transaction form is legibly the amount, but a screen reader still needs\n the name, and callers that pass `label` without `aria-label` would\n otherwise be left with none. */}\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 // Measured for the input's end padding (see `trailingRoom`).\n ref={endRef}\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 // The mark the field shows but not the typist's grouping: the evaluator\n // reads either mark, and \"1.234,5\" is two of them. The result comes back\n // dot-decimal.\n value={derived}\n // Live: every result, settled, so the field never shows more decimals than\n // it will keep. The commit is the session's one (INP-1): its \"=\", or the pad\n // closing on a newer result — not each figure on the way to the result.\n onChange={(result, expression) => {\n setDraft(null);\n handleText(settle(result), expression);\n }}\n onCommit={(result) => onCommit?.(settle(result))}\n className=\"px-1.5\"\n aria-label={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-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 // A button that opens a listbox, and says so: the chip is a control inside\n // a text field, not a field of its own, so not a combobox.\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n aria-controls={listboxId}\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-secondary hover:bg-hover\",\n asDisplay ? \"text-sm\" : \"text-xs\",\n )}\n >\n {currency}\n <ChevronDown className=\"size-3\" />\n </button>\n )}\n </div>\n {editable && (\n <CurrencyOptionList\n core={core}\n listboxId={listboxId}\n value={currency}\n codes={currencyOptions}\n currencyNames={currencyNames}\n locale={locale}\n searchPlaceholder={currencyText.search}\n // The phone sheet's title: what the chip is for.\n sheetTitle={currencyText.currency}\n onChoose={(code) => {\n onCurrencyChange?.(code);\n closeToTrigger();\n }}\n />\n )}\n </FloatingField>\n </LockedOrNot>\n {/* Outside the relative box, as NumberInput's caption is: the trailing\n controls are `inset-y-1` in it and would stretch down over a second line. */}\n <FieldCaption parts={numeric.hint} />\n {/* The news after the standing advice, as Select orders them. The root is\n already a steady box, so the message coming and going remounts nothing. */}\n {numeric.errorEl}\n {showNumpad && (\n <NumberPadSheet\n // Localised like the field it mirrors. Keys are typing, read by the\n // locale's marks like the keyboard's; \"=\" is a result, dot-decimal.\n value={display}\n onChange={typed}\n onResult={(result) => {\n setDraft(null);\n const settled = settle(result);\n handleText(settled);\n onCommit?.(settled);\n }}\n onDone={() => innerRef.current?.blur()}\n label={label}\n labels={labels?.pad}\n decimalMark={mark}\n />\n )}\n </div>\n );\n}\n\n/** The field in its lock's {@link LockedReason} while locked, as it is otherwise. A\n * component rather than a ternary so the field's JSX is written once. `block w-full`:\n * the frame's box stands where the field's own did. */\nfunction LockedOrNot({\n lock,\n display,\n children,\n}: {\n lock: LockReason;\n display: DisabledReasonDisplay | undefined;\n children: ReactNode;\n}) {\n if (!lock.locked) return <>{children}</>;\n return (\n <LockedReason lock={lock} display={display} className=\"block w-full\">\n {children}\n </LockedReason>\n );\n}\n"],"mappings":";AAslBU,SAkNiB,UAlNjB,KA+HI,YA/HJ;AAtlBV,SAAS,OAAO,SAAS,cAAc;AACvC,SAAS,mBAAmB;AAE5B,SAAS,oBAAoB,mBAAmB;AAChD,SAAS,uBAAuB;AAChC,SAAS,YAAY,eAAe,eAAe,sBAAsB,qBAAqB;AAC9F,SAAS,UAAU;AACnB,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B,SAAS,wBAAqD;AAC9D,SAAS,sBAAiD;AAC1D;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;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,aAAa,uBAAuB;AAE7C,SAAS,sBAA2C;AA8RpD,SAAS,aAAa,MAAc,QAA4B,KAAc,KAAsB;AAClG,QAAM,IAAI,KAAK,KAAK;AACpB,MAAI,CAAC,gBAAgB,KAAK,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,EAAG,QAAO;AACtD,MAAI,IAAI,OAAO,CAAC;AAChB,MAAI,CAAC,OAAO,SAAS,CAAC,EAAG,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