@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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/error-boundary.tsx"],"sourcesContent":["import { Component } from \"react\";\nimport type { ErrorInfo, ReactNode } from \"react\";\nimport { AlertTriangle, RefreshCw, WifiOff } from \"lucide-react\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { Button } from \"./button\";\nimport { EmptyState } from \"./empty-state\";\nimport { CopyButton } from \"./copy-button\";\nimport { Disclosure } from \"./disclosure\";\nimport { documentNavigation } from \"../lib/document-navigation\";\nimport { DEFAULT_ERROR_BOUNDARY_LABELS } from \"./error-boundary-labels\";\n\n/** The words of the default fallback. */\nexport interface ErrorBoundaryLabels {\n /** The fallback's heading. */\n title: string;\n /** The line under it. */\n message: string;\n /** The button that clears the error and renders the children again. */\n retry: string;\n /** The disclosure that opens the full error report (`showDetails`). */\n details: string;\n /** The button that reloads the whole page (0.13). */\n reload: string;\n /** Heading when a lazy chunk failed to load while online — a deploy replaced the\n * files this page was built from (0.13). */\n updateTitle: string;\n updateMessage: string;\n /** Heading when the browser says it is offline (0.13). */\n offlineTitle: string;\n offlineMessage: string;\n /** The copy button's words: what it copies is the plain-text report (0.13). */\n copyReport: string;\n /** Shown once `onReport` has filed the crash and returned no reference (0.13). */\n reported: string;\n /** Shown once `onReport` has filed the crash under a reference — rendered as the\n * app returned it, so return `\"#123\"` if the hash belongs to it (0.13). */\n reportedAs: (reference: string) => string;\n}\n\n// Defined in ./error-boundary-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_ERROR_BOUNDARY_LABELS };\n\n/**\n * What was thrown, as flat strings, read ONCE when it arrives.\n *\n * React stores whatever was thrown, hostile or not — `throw { get message() { throw … } }`,\n * `throw { name: Symbol() }`, `throw undefined` — and reading one of those during the\n * fallback's own render would throw INSIDE the boundary, escalating to the next one up\n * (keksdose's error-boundary.tsx learned this as feedback #160: at the app level there is\n * none, and the result is the white screen the boundary exists to prevent).\n */\nexport interface ErrorBoundaryDetails {\n name: string;\n message: string;\n stack?: string;\n}\n\nfunction read(get: () => unknown): string | undefined {\n try {\n const v = get();\n return typeof v === \"string\" ? v : v === undefined || v === null ? undefined : String(v);\n } catch {\n return undefined;\n }\n}\n\n/** `JSON.stringify` that never throws (a cycle, a BigInt, a hostile getter) and never\n * returns more than 500 characters. \"\" when there is nothing to say. */\nfunction safeJson(value: unknown): string {\n try {\n const json = JSON.stringify(value);\n if (!json || json === \"{}\") return \"\";\n return json.length > 500 ? `${json.slice(0, 499)}…` : json;\n } catch {\n return \"\";\n }\n}\n\n/** {@link ErrorBoundaryDetails} of any thrown value, without ever throwing. */\nexport function describeThrown(error: unknown): ErrorBoundaryDetails {\n if (typeof error === \"object\" && error !== null) {\n const e = error as { name?: unknown; message?: unknown; stack?: unknown };\n const message = read(() => e.message) ?? \"\";\n return {\n name: read(() => e.name) ?? \"Error\",\n // `throw { code: 500 }` has no message, and an empty line leaves crash triage with\n // nothing (keksdose G3a; its old reporter filed `{\"code\":500}`). Such a value is\n // quoted as JSON instead, capped, and never at the cost of a throw.\n message: message || (error instanceof Error ? \"\" : safeJson(error)),\n stack: read(() => e.stack),\n };\n }\n return { name: \"Error\", message: read(() => error) ?? \"\" };\n}\n\n/**\n * Is this a failed lazy import — a route chunk that did not arrive?\n *\n * Two causes, and neither is a bug in the page: the device is offline and the chunk was\n * never cached, or a deploy replaced the hashed files the running page still points at.\n * Both are cured by a reload and by nothing else — `React.lazy` caches the rejected\n * import, so Try again re-throws the same error without fetching. The patterns are\n * keksdose's (crash-report.ts), which covers Vite (\"dynamically imported module\",\n * \"module script failed\"), webpack (\"ChunkLoadError\", \"Loading chunk\") and the bare\n * `fetch` failure a service worker hands back.\n *\n * Never throws: it runs inside the fallback's own render, where a throw is a white\n * screen. An error it cannot read is not a chunk failure.\n */\nexport function isChunkLoadError(error: { name?: string | null; message?: string | null } | null | undefined): boolean {\n try {\n const s = `${error?.name ?? \"\"} ${error?.message ?? \"\"}`;\n return /ChunkLoadError|dynamically imported module|module script failed|Loading chunk|Failed to fetch/i.test(s);\n } catch {\n return false;\n }\n}\n\n/**\n * Everything a crash report carries, read once when the boundary catches.\n *\n * Plain strings only, so it survives `JSON.stringify` into an app's crash endpoint as is\n * and {@link formatCrashReport} can print it without a single guard. The wording of the\n * printed report is English on purpose: it is read by whoever fixes the bug, not by the\n * user who copies it, and a report in nine languages cannot be searched.\n */\nexport interface CrashReport {\n /** The thrown value's `name` (\"TypeError\"), \"Error\" for a non-object. */\n name: string;\n message: string;\n stack?: string;\n /** React's component stack from `componentDidCatch` — the part that names the\n * component, which a minified JS stack no longer does. */\n componentStack?: string;\n /** `pathname + search` at the moment of the crash. The search may carry what the\n * user typed — see `redact`. */\n page: string;\n /** ISO 8601, UTC. */\n time: string;\n userAgent: string;\n /** The boundary's `appVersion` prop. */\n appVersion?: string;\n /** The boundary's `placement` prop (\"app\", \"page\", \"widget\"): which boundary caught\n * it, so triage can tell a whole-app crash from one page's (keksdose G3b). */\n placement?: string;\n /** `navigator.onLine` at the moment of the crash; left out where there is none. */\n online?: boolean;\n /** {@link isChunkLoadError} of the thrown value. Such a crash is never handed to\n * `onReport` — it is a deploy or a dropped connection, not a defect — but it is\n * still in the copied report. */\n chunkLoad: boolean;\n /** The boundary's `reportExtras()`, stringified. */\n extras: Record<string, string>;\n}\n\n/**\n * The report as one plain-text block — what the copy button puts on the clipboard and\n * the details disclosure shows.\n *\n * lenkbank's layout, because that is the one that was already being pasted into\n * feedback messages: the error line first (it is what a search for the bug matches),\n * then where / when / what, then the two stacks.\n */\nexport function formatCrashReport(report: CrashReport): string {\n const lines = [\n report.message ? `${report.name}: ${report.message}` : report.name,\n `Page: ${report.page}`,\n `Time: ${report.time}`,\n `User agent: ${report.userAgent}`,\n ];\n if (report.appVersion) lines.push(`App version: ${report.appVersion}`);\n if (report.placement) lines.push(`Placement: ${report.placement}`);\n if (report.online === false) lines.push(\"Online: no\");\n for (const [key, value] of Object.entries(report.extras)) lines.push(`${key}: ${value}`);\n if (report.stack) lines.push(\"\", \"Stack:\", report.stack.trim());\n if (report.componentStack) lines.push(\"\", \"Component stack:\", report.componentStack.trim());\n return lines.join(\"\\n\");\n}\n\n/**\n * A key for \"the same crash again\": the error's name and message and the first frames\n * of its stack.\n *\n * Page-load local, not a server-side grouping key (keksdose's crash-report.ts draws the\n * same line): its only job is to stop one page load filing one bug twice — React's dev\n * StrictMode, a Try again that crashes again, a render loop that trips the boundary many\n * times a second. The page and the time are left out on purpose: the same bug on two\n * routes is still one bug.\n */\nexport function crashFingerprint(\n report: Pick<CrashReport, \"name\" | \"message\" | \"stack\"> & Pick<Partial<CrashReport>, \"placement\">,\n): string {\n const frames = (report.stack ?? \"\").split(\"\\n\").slice(0, 4).join(\"|\");\n // The placement is part of it (keksdose G3b): the same error caught by the page\n // boundary and, after Try again fails, by the app boundary is two facts for triage.\n const where = report.placement ? `${report.placement}::` : \"\";\n return `${where}${report.name}::${report.message}::${frames}`;\n}\n\n/**\n * What `onReport` may resolve with. `{ reference }` is shown (\"Reported as …\");\n * nothing (or `{}`) means filed without one. `{ filed: false }` says the app decided NOT\n * to file (a demo session, a hot-reload artefact, a report buffered for later): the\n * screen then claims nothing and keeps the copy button — claiming a report that was\n * never sent is the same false statement as hiding one that was.\n */\nexport type CrashReportResult = { reference?: string; filed?: boolean } | void;\n\ninterface Filing {\n filed: boolean;\n reference?: string;\n}\n\nconst NOT_FILED: Filing = { filed: false };\n\n/** A render loop can trip a boundary dozens of times a second with a different message\n * each time (a counter in it); without a ceiling the first bad deploy files hundreds of\n * rows. keksdose's number. */\nconst MAX_REPORTS_PER_PAGE_LOAD = 5;\n\n/** Fingerprint → the one filing for it in this page load. Module scope IS the page\n * load: a reload starts it empty. A duplicate gets the first filing's promise, so the\n * second screen shows the same reference instead of claiming nothing. */\nconst filings = new Map<string, Promise<Filing>>();\n\nfunction settle(out: unknown): Filing {\n try {\n if (out && typeof out === \"object\") {\n const o = out as { filed?: unknown; reference?: unknown };\n if (o.filed === false) return NOT_FILED;\n const reference = typeof o.reference === \"string\" && o.reference ? o.reference : undefined;\n return { filed: true, reference };\n }\n return { filed: true };\n } catch {\n return NOT_FILED;\n }\n}\n\n/** Hand the report to the app, once per fingerprint per page load, and never throw —\n * not for a synchronous throw, a rejection, or a hostile thenable. */\nfunction fileOnce(report: CrashReport, onReport: (report: CrashReport) => unknown): Promise<Filing> {\n const key = crashFingerprint(report);\n const known = filings.get(key);\n if (known) return known;\n if (filings.size >= MAX_REPORTS_PER_PAGE_LOAD) return Promise.resolve(NOT_FILED);\n let filing: Promise<Filing>;\n try {\n filing = Promise.resolve(onReport(report)).then(settle, () => NOT_FILED);\n } catch {\n filing = Promise.resolve(NOT_FILED);\n }\n // Claimed before the first await: two catches in the same tick (StrictMode) must not\n // both get past the lookup above.\n filings.set(key, filing);\n return filing;\n}\n\nfunction isOffline(): boolean {\n try {\n return typeof navigator !== \"undefined\" && navigator.onLine === false;\n } catch {\n return false;\n }\n}\n\nfunction reloadPage(): void {\n try {\n documentNavigation.reload();\n } catch {\n /* nothing left to do from here */\n }\n}\n\n/** What a render-prop `fallback` is handed. */\nexport interface ErrorBoundaryFallbackProps {\n /** The thrown value, as it was thrown. Read it with care — see {@link describeThrown}. */\n error: unknown;\n details: ErrorBoundaryDetails;\n /** Clear the error and render the children again. */\n reset: () => void;\n /** The crash report, once `componentDidCatch` has built it (null on the very first\n * render of the fallback, which happens before it). Already `redact`ed. */\n report: CrashReport | null;\n}\n\nexport interface ErrorBoundaryProps {\n children?: ReactNode;\n /** Replaces the default fallback: a node, or a render function handed the error and\n * a `reset`. The same rule applies to it as to the default: see the component docs. */\n fallback?: ReactNode | ((props: ErrorBoundaryFallbackProps) => ReactNode);\n /** Called once per caught error with the raw value — log it. A throw from it is\n * swallowed: the boundary is the last thing standing. For filing a report, prefer\n * `onReport`, which gets the finished report, dedupe and the reference on screen. */\n onError?: (error: unknown, info: ErrorInfo) => void;\n /** Called when the error is cleared, by Try again, `reset` or a `resetKeys` change —\n * drop a cache, refetch. */\n onReset?: () => void;\n /**\n * When any of these changes (compared with `Object.is`) AFTER an error was caught, the\n * error is cleared and the children render again — a change in the same update that\n * threw does not count (it is what the error was shown under) — pass the route path so leaving a broken page does not\n * carry its fallback to the next one (keksdose's `resetKey`).\n */\n resetKeys?: ReadonlyArray<unknown>;\n /** Quote the error's `name: message` in a monospace box under the hint. Default on\n * (0.13): three sentences true of every crash identify none of them, and the one\n * line that does is what a user can read out or screenshot (lenkbank P7). Not shown\n * for a chunk-load / offline screen, where the message is a URL that explains\n * nothing the title does not. */\n showMessage?: boolean;\n /** A collapsed disclosure holding the full plain-text report. Default on since 0.13\n * (it was an opt-in showing name, message and stack): closed, it costs one line, and\n * it is where a support conversation asks the user to look. */\n showDetails?: boolean;\n /** The copy button for the plain-text report (the kit's CopyButton, which says when\n * the clipboard refused). Default on. Hidden once `onReport` has filed the crash —\n * there is nothing left to paste anywhere — and shown again whenever it did not. */\n copyReport?: boolean;\n /** The app's version, printed in the report — the first question on every crash. */\n appVersion?: string;\n /** Which boundary this is — \"app\" at the root, \"page\" in the layout — carried into\n * the report (`placement`) and its fingerprint, so `onReport` needs no closure to say\n * where the crash was caught (keksdose G3b). */\n placement?: string;\n /** More `key: value` lines for the report, read when the boundary catches (a tenant\n * id, the feature flags). A throw from it is swallowed and the lines are left out. */\n reportExtras?: () => Record<string, string>;\n /**\n * Rewrite the report before anything sees it: the screen, the clipboard and\n * `onReport` all get the returned one.\n *\n * THE REPORT IS STRUCTURE, NEVER CONTENT — and only the app knows which of its query\n * params hold content. keksdose's register put the free-text search in `?q=` and payee\n * names in the `f.*` filters, and its crash channel sent them in the clear to a column\n * every admin reads (crash-report.ts `safeUrl`). The cure there is an ALLOW-list, so a\n * param added later is dropped until somebody decides otherwise — rebuild `page`\n * from `new URL(r.page, location.origin)`, keeping only the listed `searchParams`.\n * `extras` are the app's own and need no second pass. A throw from `redact` falls\n * back to the pathname alone and no extras — failing closed.\n *\n * The same holds inside `onReport`, which is the other place to do it: clamp fields\n * to what the endpoint accepts, drop what it must not store. The kit cannot know.\n */\n redact?: (report: CrashReport) => CrashReport;\n /**\n * File the report automatically. Called from `componentDidCatch`, at most once per\n * {@link crashFingerprint} per page load (and at most five times in all), never for a\n * chunk-load error. It can NOT throw into the boundary: a synchronous throw and a\n * rejection both read as \"not filed\", and the copy button stays.\n *\n * Resolve with `{ reference }` and the screen says \"Reported as …\" instead of the copy\n * button; see {@link CrashReportResult} for \"filed without a reference\" and \"decided not\n * to file\". Whatever the app's reporter does, it must do without the router, the query\n * client or the auth store's hooks — a bare `fetch` with `keepalive`, so it survives\n * the reload the user is about to press (keksdose crash-report.ts `post`).\n */\n onReport?: (report: CrashReport) => Promise<CrashReportResult> | CrashReportResult;\n /** The app's own escape hatches, beside Reload / Try again — keksdose's \"Clear local\n * data\" for a poisoned persisted cache that no in-app action could otherwise break.\n * A full-width hint under it: wrap it in `<div className=\"basis-full\">`. */\n actions?: ReactNode;\n /** The default fallback's heading level. Default `h2`: the fallback often IS the page. */\n headingAs?: \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n /** Classes for the default fallback's box (`m-8 min-h-[400px]`, kastlan). */\n className?: string;\n labels?: LabelOverride<ErrorBoundaryLabels>;\n}\n\ntype FilingState = \"none\" | \"pending\" | \"filed\" | \"failed\";\n\ninterface ErrorBoundaryState {\n /** A flag of its own, so `throw undefined` is still an error shown. */\n failed: boolean;\n error: unknown;\n details: ErrorBoundaryDetails | null;\n report: CrashReport | null;\n filing: FilingState;\n reference: string | undefined;\n}\n\nconst CLEAR: ErrorBoundaryState = {\n failed: false,\n error: null,\n details: null,\n report: null,\n filing: \"none\",\n reference: undefined,\n};\n\nfunction keysChanged(a: ReadonlyArray<unknown> | undefined, b: ReadonlyArray<unknown> | undefined): boolean {\n if (a === b) return false;\n if (!a || !b || a.length !== b.length) return true;\n return a.some((v, i) => !Object.is(v, b[i]));\n}\n\nfunction currentPage(): { page: string; path: string } {\n try {\n const { pathname, search } = window.location;\n return { page: `${pathname}${search}`, path: pathname };\n } catch {\n return { page: \"\", path: \"\" };\n }\n}\n\nfunction buildReport(\n details: ErrorBoundaryDetails,\n componentStack: string | undefined,\n props: ErrorBoundaryProps,\n): CrashReport {\n const { page, path } = currentPage();\n const extras: Record<string, string> = {};\n try {\n const more = props.reportExtras?.();\n if (more) for (const [k, v] of Object.entries(more)) extras[k] = String(v);\n } catch {\n /* documented: the lines are left out */\n }\n let userAgent = \"\";\n let online: boolean | undefined;\n try {\n userAgent = navigator.userAgent;\n online = typeof navigator.onLine === \"boolean\" ? navigator.onLine : undefined;\n } catch {\n /* no navigator (SSR, a worker test) */\n }\n const report: CrashReport = {\n name: details.name,\n message: details.message,\n stack: details.stack,\n componentStack: componentStack ?? undefined,\n page,\n time: new Date().toISOString(),\n userAgent,\n appVersion: props.appVersion,\n placement: props.placement,\n online,\n chunkLoad: isChunkLoadError(details),\n extras,\n };\n if (!props.redact) return report;\n try {\n return props.redact(report);\n } catch {\n // Fail closed: an app that asked for redaction must not get the unredacted page.\n return { ...report, page: path, extras: {} };\n }\n}\n\n/**\n * Catch a render error below it and show ONE crash screen instead of an empty page.\n *\n * The three apps each built one. kastlan's and keksdose's sat on `EmptyState\n * tone=\"danger\"`; lenkbank's quoted the error and offered a plain-text report to copy;\n * keksdose's filed the crash itself, told a lazy-chunk failure apart as \"offline\", and\n * offered \"clear local data\" when a poisoned cache made Retry useless (feedback #160).\n * This is all of that, so the apps reduce to\n * `<ErrorBoundary resetKeys={[pathname]} appVersion={__VERSION__} />` plus, for an app\n * with a crash endpoint, `onReport` and `actions`:\n *\n * - the error's `name: message`, quoted (`showMessage`);\n * - Try again (reset the boundary) AND Reload (the page) — Try again alone re-renders\n * the same subtree from the same state, which a deterministic crash survives;\n * - a chunk-load error or an offline browser gets its own title and Reload first\n * (\"A new version is available\" / \"You're offline\");\n * - the copy button and the report in a disclosure; `onReport` for filing it, deduped\n * per page load, with its reference on screen.\n *\n * THE RULE for this fallback — and for a `fallback` or `actions` an app passes in: it\n * must not depend on the router, the query client or the auth store. A crash is exactly\n * when those may be what broke, and a fallback that throws escalates to the next\n * boundary up — at the app level there is none, and the user gets the white screen this\n * exists to prevent. So no `useNavigate`, no `useQuery`, no `useAuth()` in it; reload\n * with `window.location`, not the router. The kit's own label hooks are the one context\n * it does read (`errorBoundary.*` from `UiKitProvider`), and they degrade to the English\n * defaults when there is no provider above — which is why the app-level boundary may\n * sit OUTSIDE the provider and still render.\n *\n * The fallback is `role=\"alert\"`: a page replaced by an error is news, and a reader\n * that was on it is told.\n */\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n state: ErrorBoundaryState = CLEAR;\n\n /** Bumped by every catch and reset, so a filing that settles after the screen moved\n * on (Try again, a route change, a second crash) does not write into it. */\n private generation = 0;\n\n /**\n * Forget which crashes this page load has filed, and the count towards the cap.\n *\n * For tests: the dedupe lives in module scope because a page load is what it spans,\n * and a test file is one page load — so without this, the sixth test that files a\n * report finds the cap reached and `onReport` never called. Call it in `beforeEach`.\n * Never needed in an app: a reload is the reset.\n */\n static forgetReports(): void {\n filings.clear();\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState> {\n return { failed: true, error, details: describeThrown(error), report: null, filing: \"none\", reference: undefined };\n }\n\n componentDidCatch(error: unknown, info: ErrorInfo): void {\n try {\n this.props.onError?.(error, info);\n } catch {\n /* documented: a logger must not take the fallback down */\n }\n const details = this.state.details ?? describeThrown(error);\n const report = buildReport(details, info.componentStack ?? undefined, this.props);\n const { onReport } = this.props;\n const willFile = onReport !== undefined && !report.chunkLoad;\n const generation = ++this.generation;\n this.setState({ report, filing: willFile ? \"pending\" : \"none\", reference: undefined });\n if (!willFile) return;\n void fileOnce(report, onReport).then((filing) => {\n if (generation !== this.generation) return;\n this.setState(\n filing.filed ? { filing: \"filed\", reference: filing.reference } : { filing: \"failed\", reference: undefined },\n );\n });\n }\n\n componentDidUpdate(prev: ErrorBoundaryProps, prevState: ErrorBoundaryState): void {\n // Only a change AFTER the error was caught clears it (react-error-boundary's rule).\n // `prevState.failed` is false in the update that caught it: that update may well be\n // the one that changed the keys too — a navigation to a page that throws, with\n // `resetKeys={[pathname]}` — and resetting then would fire `onReset` for nothing and\n // render the failing child a second time. From then on `prev.resetKeys` are the\n // keys the error was shown under, so any change clears it.\n if (this.state.failed && prevState.failed && keysChanged(prev.resetKeys, this.props.resetKeys)) {\n this.reset();\n }\n }\n\n reset = (): void => {\n this.generation++;\n this.props.onReset?.();\n this.setState(CLEAR);\n };\n\n render(): ReactNode {\n const { failed, error, details, report, filing, reference } = this.state;\n if (!failed || !details) return this.props.children;\n const { fallback } = this.props;\n if (typeof fallback === \"function\") return fallback({ error, details, reset: this.reset, report });\n if (fallback !== undefined) return fallback;\n return (\n <ErrorFallback\n details={details}\n report={report}\n filing={filing}\n reference={reference}\n reset={this.reset}\n showMessage={this.props.showMessage ?? true}\n showDetails={this.props.showDetails ?? true}\n copyReport={this.props.copyReport ?? true}\n actions={this.props.actions}\n headingAs={this.props.headingAs ?? \"h2\"}\n className={this.props.className}\n labels={this.props.labels}\n />\n );\n }\n}\n\nfunction ErrorFallback({\n details,\n report,\n filing,\n reference,\n reset,\n showMessage,\n showDetails,\n copyReport,\n actions,\n headingAs,\n className,\n labels,\n}: {\n details: ErrorBoundaryDetails;\n report: CrashReport | null;\n filing: FilingState;\n reference: string | undefined;\n reset: () => void;\n showMessage: boolean;\n showDetails: boolean;\n copyReport: boolean;\n actions?: ReactNode;\n headingAs: NonNullable<ErrorBoundaryProps[\"headingAs\"]>;\n className?: string;\n labels?: LabelOverride<ErrorBoundaryLabels>;\n}) {\n const text = useKitLabels(\"errorBoundary\", DEFAULT_ERROR_BOUNDARY_LABELS, labels);\n const chunk = isChunkLoadError(details);\n // Offline first, as keksdose has it: offline, a chunk failure is the connection, and\n // any other crash most likely a request that could not be made — either way \"reload\n // once you are back\" is the advice, and \"a new version\" would be a false one.\n const mode = isOffline() ? \"offline\" : chunk ? \"update\" : \"error\";\n const title = mode === \"offline\" ? text.offlineTitle : mode === \"update\" ? text.updateTitle : text.title;\n const hint = mode === \"offline\" ? text.offlineMessage : mode === \"update\" ? text.updateMessage : text.message;\n const Icon = mode === \"offline\" ? WifiOff : mode === \"update\" ? RefreshCw : AlertTriangle;\n const reportText = report ? formatCrashReport(report) : null;\n const errorLine = details.message ? `${details.name}: ${details.message}` : details.name;\n\n const reloadButton = (\n <Button key=\"reload\" variant={mode === \"error\" ? \"secondary\" : \"default\"} onClick={reloadPage}>\n {text.reload}\n </Button>\n );\n // Not after a chunk failure: `React.lazy` keeps the rejected import, so Try again\n // could only throw the same error again.\n const retryButton = chunk ? null : (\n <Button key=\"retry\" variant={mode === \"error\" ? \"default\" : \"secondary\"} onClick={reset}>\n {text.retry}\n </Button>\n );\n\n return (\n <EmptyState\n role=\"alert\"\n tone={mode === \"error\" ? \"danger\" : undefined}\n headingAs={headingAs}\n className={className}\n icon={<Icon />}\n title={title}\n hint={hint}\n action={\n <>\n {showMessage && mode === \"error\" && (\n // A quotation, not prose: left-aligned and monospaced, so it reads as the\n // program's words and can be read out or screenshotted verbatim.\n <p\n data-error-message=\"\"\n className=\"-mt-1 mb-1 basis-full whitespace-pre-wrap break-words rounded-md border border-danger-strong bg-danger-soft px-3 py-2 text-start font-mono text-xs text-primary\"\n >\n {errorLine}\n </p>\n )}\n {filing === \"filed\" && (\n <p className=\"-mt-1 mb-1 basis-full text-xs\">{reference ? text.reportedAs(reference) : text.reported}</p>\n )}\n {mode === \"error\" ? [retryButton, reloadButton] : [reloadButton, retryButton]}\n {copyReport && reportText !== null && filing !== \"filed\" && (\n <CopyButton variant=\"label\" buttonVariant=\"ghost\" label={text.copyReport} text={reportText} />\n )}\n {actions}\n {showDetails && reportText !== null && (\n <Disclosure variant=\"bare\" title={text.details} className=\"basis-full text-start\">\n <pre className=\"max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-secondary\">\n {reportText}\n </pre>\n </Disclosure>\n )}\n </>\n }\n />\n );\n}\n"],"mappings":";AAsiBM,SAgFE,UAhFF,KAgFE,YAhFF;AAtiBN,SAAS,iBAAiB;AAE1B,SAAS,eAA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AA,MACC,MAAK;AAAA,MACL,MAAM,SAAS,UAAU,WAAW;AAAA,MACpC;AAAA,MACA;AAAA,MACA,MAAM,oBAAC,QAAK;AAAA,MACZ;AAAA,MACA;AAAA,MACA,QACE,iCACG;AAAA,uBAAe,SAAS;AAAA;AAAA,QAGvB;AAAA,UAAC;AAAA;AAAA,YACC,sBAAmB;AAAA,YACnB,WAAU;AAAA,YAET;AAAA;AAAA,QACH;AAAA,QAED,WAAW,WACV,oBAAC,OAAE,WAAU,iCAAiC,sBAAY,KAAK,WAAW,SAAS,IAAI,KAAK,UAAS;AAAA,QAEtG,SAAS,UAAU,CAAC,aAAa,YAAY,IAAI,CAAC,cAAc,WAAW;AAAA,QAC3E,cAAc,eAAe,QAAQ,WAAW,WAC/C,oBAAC,cAAW,SAAQ,SAAQ,eAAc,SAAQ,OAAO,KAAK,YAAY,MAAM,YAAY;AAAA,QAE7F;AAAA,QACA,eAAe,eAAe,QAC7B,oBAAC,cAAW,SAAQ,QAAO,OAAO,KAAK,SAAS,WAAU,yBACxD,8BAAC,SAAI,WAAU,iFACZ,sBACH,GACF;AAAA,SAEJ;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/error-boundary.tsx"],"sourcesContent":["import { Component, useEffect } from \"react\";\nimport type { ErrorInfo, ReactNode } from \"react\";\nimport { AlertTriangle, RefreshCw, WifiOff } from \"lucide-react\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { Button } from \"./button\";\nimport { EmptyState } from \"./empty-state\";\nimport { CopyButton } from \"./copy-button\";\nimport { Disclosure } from \"./disclosure\";\nimport { documentNavigation } from \"../lib/document-navigation\";\nimport { useAnnounce } from \"../hooks/use-announce\";\nimport { DEFAULT_ERROR_BOUNDARY_LABELS } from \"./error-boundary-labels\";\n\n/** The words of the default fallback. */\nexport interface ErrorBoundaryLabels {\n /** The fallback's heading. */\n title: string;\n /** The line under it. */\n message: string;\n /** The button that clears the error and renders the children again. */\n retry: string;\n /** The disclosure that opens the full error report (`showDetails`). */\n details: string;\n /** The button that reloads the whole page (0.13). */\n reload: string;\n /** Heading when a lazy chunk failed to load while online — a deploy replaced the\n * files this page was built from (0.13). */\n updateTitle: string;\n updateMessage: string;\n /** Heading when the browser says it is offline (0.13). */\n offlineTitle: string;\n offlineMessage: string;\n /** The copy button's words: what it copies is the plain-text report (0.13). */\n copyReport: string;\n /** Shown once `onReport` has filed the crash and returned no reference (0.13). */\n reported: string;\n /** Shown once `onReport` has filed the crash under a reference — rendered as the\n * app returned it, so return `\"#123\"` if the hash belongs to it (0.13). */\n reportedAs: (reference: string) => string;\n}\n\n// Defined in ./error-boundary-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_ERROR_BOUNDARY_LABELS };\n\n/**\n * What was thrown, as flat strings, read ONCE when it arrives.\n *\n * React stores whatever was thrown, hostile or not — `throw { get message() { throw … } }`,\n * `throw { name: Symbol() }`, `throw undefined` — and reading one of those during the\n * fallback's own render would throw INSIDE the boundary, escalating to the next one up\n * (keksdose's error-boundary.tsx learned this as feedback #160: at the app level there is\n * none, and the result is the white screen the boundary exists to prevent).\n */\nexport interface ErrorBoundaryDetails {\n name: string;\n message: string;\n stack?: string;\n}\n\nfunction read(get: () => unknown): string | undefined {\n try {\n const v = get();\n return typeof v === \"string\" ? v : v === undefined || v === null ? undefined : String(v);\n } catch {\n return undefined;\n }\n}\n\n/** `JSON.stringify` that never throws (a cycle, a BigInt, a hostile getter) and never\n * returns more than 500 characters. \"\" when there is nothing to say. */\nfunction safeJson(value: unknown): string {\n try {\n const json = JSON.stringify(value);\n if (!json || json === \"{}\") return \"\";\n return json.length > 500 ? `${json.slice(0, 499)}…` : json;\n } catch {\n return \"\";\n }\n}\n\n/** {@link ErrorBoundaryDetails} of any thrown value, without ever throwing. */\nexport function describeThrown(error: unknown): ErrorBoundaryDetails {\n if (typeof error === \"object\" && error !== null) {\n const e = error as { name?: unknown; message?: unknown; stack?: unknown };\n const message = read(() => e.message) ?? \"\";\n return {\n name: read(() => e.name) ?? \"Error\",\n // `throw { code: 500 }` has no message, and an empty line leaves crash triage with\n // nothing (keksdose G3a; its old reporter filed `{\"code\":500}`). Such a value is\n // quoted as JSON instead, capped, and never at the cost of a throw.\n message: message || (error instanceof Error ? \"\" : safeJson(error)),\n stack: read(() => e.stack),\n };\n }\n return { name: \"Error\", message: read(() => error) ?? \"\" };\n}\n\n/**\n * Is this a failed lazy import — a route chunk that did not arrive?\n *\n * Two causes, and neither is a bug in the page: the device is offline and the chunk was\n * never cached, or a deploy replaced the hashed files the running page still points at.\n * Both are cured by a reload and by nothing else — `React.lazy` caches the rejected\n * import, so Try again re-throws the same error without fetching. The patterns are\n * keksdose's (crash-report.ts), which covers Vite (\"dynamically imported module\",\n * \"module script failed\"), webpack (\"ChunkLoadError\", \"Loading chunk\") and the bare\n * `fetch` failure a service worker hands back.\n *\n * Never throws: it runs inside the fallback's own render, where a throw is a white\n * screen. An error it cannot read is not a chunk failure.\n */\nexport function isChunkLoadError(error: { name?: string | null; message?: string | null } | null | undefined): boolean {\n try {\n const s = `${error?.name ?? \"\"} ${error?.message ?? \"\"}`;\n return /ChunkLoadError|dynamically imported module|module script failed|Loading chunk|Failed to fetch/i.test(s);\n } catch {\n return false;\n }\n}\n\n/**\n * Everything a crash report carries, read once when the boundary catches.\n *\n * Plain strings only, so it survives `JSON.stringify` into an app's crash endpoint as is\n * and {@link formatCrashReport} can print it without a single guard. The wording of the\n * printed report is English on purpose: it is read by whoever fixes the bug, not by the\n * user who copies it, and a report in nine languages cannot be searched.\n */\nexport interface CrashReport {\n /** The thrown value's `name` (\"TypeError\"), \"Error\" for a non-object. */\n name: string;\n message: string;\n stack?: string;\n /** React's component stack from `componentDidCatch` — the part that names the\n * component, which a minified JS stack no longer does. */\n componentStack?: string;\n /** `pathname + search` at the moment of the crash. The search may carry what the\n * user typed — see `redact`. */\n page: string;\n /** ISO 8601, UTC. */\n time: string;\n userAgent: string;\n /** The boundary's `appVersion` prop. */\n appVersion?: string;\n /** The boundary's `placement` prop (\"app\", \"page\", \"widget\"): which boundary caught\n * it, so triage can tell a whole-app crash from one page's (keksdose G3b). */\n placement?: string;\n /** `navigator.onLine` at the moment of the crash; left out where there is none. */\n online?: boolean;\n /** {@link isChunkLoadError} of the thrown value. Such a crash is never handed to\n * `onReport` — it is a deploy or a dropped connection, not a defect — but it is\n * still in the copied report. */\n chunkLoad: boolean;\n /** The boundary's `reportExtras()`, stringified. */\n extras: Record<string, string>;\n}\n\n/**\n * The report as one plain-text block — what the copy button puts on the clipboard and\n * the details disclosure shows.\n *\n * lenkbank's layout, because that is the one that was already being pasted into\n * feedback messages: the error line first (it is what a search for the bug matches),\n * then where / when / what, then the two stacks.\n */\nexport function formatCrashReport(report: CrashReport): string {\n const lines = [\n report.message ? `${report.name}: ${report.message}` : report.name,\n `Page: ${report.page}`,\n `Time: ${report.time}`,\n `User agent: ${report.userAgent}`,\n ];\n if (report.appVersion) lines.push(`App version: ${report.appVersion}`);\n if (report.placement) lines.push(`Placement: ${report.placement}`);\n if (report.online === false) lines.push(\"Online: no\");\n for (const [key, value] of Object.entries(report.extras)) lines.push(`${key}: ${value}`);\n if (report.stack) lines.push(\"\", \"Stack:\", report.stack.trim());\n if (report.componentStack) lines.push(\"\", \"Component stack:\", report.componentStack.trim());\n return lines.join(\"\\n\");\n}\n\n/**\n * A key for \"the same crash again\": the error's name and message and the first frames\n * of its stack.\n *\n * Page-load local, not a server-side grouping key (keksdose's crash-report.ts draws the\n * same line): its only job is to stop one page load filing one bug twice — React's dev\n * StrictMode, a Try again that crashes again, a render loop that trips the boundary many\n * times a second. The page and the time are left out on purpose: the same bug on two\n * routes is still one bug.\n */\nexport function crashFingerprint(\n report: Pick<CrashReport, \"name\" | \"message\" | \"stack\"> & Pick<Partial<CrashReport>, \"placement\">,\n): string {\n const frames = (report.stack ?? \"\").split(\"\\n\").slice(0, 4).join(\"|\");\n // The placement is part of it (keksdose G3b): the same error caught by the page\n // boundary and, after Try again fails, by the app boundary is two facts for triage.\n const where = report.placement ? `${report.placement}::` : \"\";\n return `${where}${report.name}::${report.message}::${frames}`;\n}\n\n/**\n * What `onReport` may resolve with. `{ reference }` is shown (\"Reported as …\");\n * nothing (or `{}`) means filed without one. `{ filed: false }` says the app decided NOT\n * to file (a demo session, a hot-reload artefact, a report buffered for later): the\n * screen then claims nothing and keeps the copy button — claiming a report that was\n * never sent is the same false statement as hiding one that was.\n */\nexport type CrashReportResult = { reference?: string; filed?: boolean } | void;\n\ninterface Filing {\n filed: boolean;\n reference?: string;\n}\n\nconst NOT_FILED: Filing = { filed: false };\n\n/** A render loop can trip a boundary dozens of times a second with a different message\n * each time (a counter in it); without a ceiling the first bad deploy files hundreds of\n * rows. keksdose's number. */\nconst MAX_REPORTS_PER_PAGE_LOAD = 5;\n\n/** Fingerprint → the one filing for it in this page load. Module scope IS the page\n * load: a reload starts it empty. A duplicate gets the first filing's promise, so the\n * second screen shows the same reference instead of claiming nothing. */\nconst filings = new Map<string, Promise<Filing>>();\n\nfunction settle(out: unknown): Filing {\n try {\n if (out && typeof out === \"object\") {\n const o = out as { filed?: unknown; reference?: unknown };\n if (o.filed === false) return NOT_FILED;\n const reference = typeof o.reference === \"string\" && o.reference ? o.reference : undefined;\n return { filed: true, reference };\n }\n return { filed: true };\n } catch {\n return NOT_FILED;\n }\n}\n\n/** Hand the report to the app, once per fingerprint per page load, and never throw —\n * not for a synchronous throw, a rejection, or a hostile thenable. */\nfunction fileOnce(report: CrashReport, onReport: (report: CrashReport) => unknown): Promise<Filing> {\n const key = crashFingerprint(report);\n const known = filings.get(key);\n if (known) return known;\n if (filings.size >= MAX_REPORTS_PER_PAGE_LOAD) return Promise.resolve(NOT_FILED);\n let filing: Promise<Filing>;\n try {\n filing = Promise.resolve(onReport(report)).then(settle, () => NOT_FILED);\n } catch {\n filing = Promise.resolve(NOT_FILED);\n }\n // Claimed before the first await: two catches in the same tick (StrictMode) must not\n // both get past the lookup above.\n filings.set(key, filing);\n return filing;\n}\n\nfunction isOffline(): boolean {\n try {\n return typeof navigator !== \"undefined\" && navigator.onLine === false;\n } catch {\n return false;\n }\n}\n\nfunction reloadPage(): void {\n try {\n documentNavigation.reload();\n } catch {\n /* nothing left to do from here */\n }\n}\n\n/** What a render-prop `fallback` is handed. */\nexport interface ErrorBoundaryFallbackProps {\n /** The thrown value, as it was thrown. Read it with care — see {@link describeThrown}. */\n error: unknown;\n details: ErrorBoundaryDetails;\n /** Clear the error and render the children again. */\n reset: () => void;\n /** The crash report, once `componentDidCatch` has built it (null on the very first\n * render of the fallback, which happens before it). Already `redact`ed. */\n report: CrashReport | null;\n}\n\nexport interface ErrorBoundaryProps {\n children?: ReactNode;\n /** Replaces the default fallback: a node, or a render function handed the error and\n * a `reset`. The same rule applies to it as to the default: see the component docs. */\n fallback?: ReactNode | ((props: ErrorBoundaryFallbackProps) => ReactNode);\n /** Called once per caught error with the raw value — log it. A throw from it is\n * swallowed: the boundary is the last thing standing. For filing a report, prefer\n * `onReport`, which gets the finished report, dedupe and the reference on screen. */\n onError?: (error: unknown, info: ErrorInfo) => void;\n /** Called when the error is cleared, by Try again, `reset` or a `resetKeys` change —\n * drop a cache, refetch. */\n onReset?: () => void;\n /**\n * When any of these changes (compared with `Object.is`) AFTER an error was caught, the\n * error is cleared and the children render again — a change in the same update that\n * threw does not count (it is what the error was shown under) — pass the route path so leaving a broken page does not\n * carry its fallback to the next one (keksdose's `resetKey`).\n */\n resetKeys?: ReadonlyArray<unknown>;\n /** Quote the error's `name: message` in a monospace box under the hint. Default on\n * (0.13): three sentences true of every crash identify none of them, and the one\n * line that does is what a user can read out or screenshot (lenkbank P7). Not shown\n * for a chunk-load / offline screen, where the message is a URL that explains\n * nothing the title does not. */\n showMessage?: boolean;\n /** A collapsed disclosure holding the full plain-text report. Default on since 0.13\n * (it was an opt-in showing name, message and stack): closed, it costs one line, and\n * it is where a support conversation asks the user to look. */\n showDetails?: boolean;\n /** The copy button for the plain-text report (the kit's CopyButton, which says when\n * the clipboard refused). Default on. Hidden once `onReport` has filed the crash —\n * there is nothing left to paste anywhere — and shown again whenever it did not. */\n copyReport?: boolean;\n /** The app's version, printed in the report — the first question on every crash. */\n appVersion?: string;\n /** Which boundary this is — \"app\" at the root, \"page\" in the layout — carried into\n * the report (`placement`) and its fingerprint, so `onReport` needs no closure to say\n * where the crash was caught (keksdose G3b). */\n placement?: string;\n /** More `key: value` lines for the report, read when the boundary catches (a tenant\n * id, the feature flags). A throw from it is swallowed and the lines are left out. */\n reportExtras?: () => Record<string, string>;\n /**\n * Rewrite the report before anything sees it: the screen, the clipboard and\n * `onReport` all get the returned one.\n *\n * THE REPORT IS STRUCTURE, NEVER CONTENT — and only the app knows which of its query\n * params hold content. keksdose's register put the free-text search in `?q=` and payee\n * names in the `f.*` filters, and its crash channel sent them in the clear to a column\n * every admin reads (crash-report.ts `safeUrl`). The cure there is an ALLOW-list, so a\n * param added later is dropped until somebody decides otherwise — rebuild `page`\n * from `new URL(r.page, location.origin)`, keeping only the listed `searchParams`.\n * `extras` are the app's own and need no second pass. A throw from `redact` falls\n * back to the pathname alone and no extras — failing closed.\n *\n * The same holds inside `onReport`, which is the other place to do it: clamp fields\n * to what the endpoint accepts, drop what it must not store. The kit cannot know.\n */\n redact?: (report: CrashReport) => CrashReport;\n /**\n * File the report automatically. Called from `componentDidCatch`, at most once per\n * {@link crashFingerprint} per page load (and at most five times in all), never for a\n * chunk-load error. It can NOT throw into the boundary: a synchronous throw and a\n * rejection both read as \"not filed\", and the copy button stays.\n *\n * Resolve with `{ reference }` and the screen says \"Reported as …\" instead of the copy\n * button; see {@link CrashReportResult} for \"filed without a reference\" and \"decided not\n * to file\". Whatever the app's reporter does, it must do without the router, the query\n * client or the auth store's hooks — a bare `fetch` with `keepalive`, so it survives\n * the reload the user is about to press (keksdose crash-report.ts `post`).\n */\n onReport?: (report: CrashReport) => Promise<CrashReportResult> | CrashReportResult;\n /** The app's own escape hatches, beside Reload / Try again — keksdose's \"Clear local\n * data\" for a poisoned persisted cache that no in-app action could otherwise break.\n * A full-width hint under it: wrap it in `<div className=\"basis-full\">`. */\n actions?: ReactNode;\n /** The default fallback's heading level. Default `h2`: the fallback often IS the page. */\n headingAs?: \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n /** Classes for the default fallback's box (`m-8 min-h-[400px]`, kastlan). */\n className?: string;\n labels?: LabelOverride<ErrorBoundaryLabels>;\n}\n\ntype FilingState = \"none\" | \"pending\" | \"filed\" | \"failed\";\n\ninterface ErrorBoundaryState {\n /** A flag of its own, so `throw undefined` is still an error shown. */\n failed: boolean;\n error: unknown;\n details: ErrorBoundaryDetails | null;\n report: CrashReport | null;\n filing: FilingState;\n reference: string | undefined;\n}\n\nconst CLEAR: ErrorBoundaryState = {\n failed: false,\n error: null,\n details: null,\n report: null,\n filing: \"none\",\n reference: undefined,\n};\n\nfunction keysChanged(a: ReadonlyArray<unknown> | undefined, b: ReadonlyArray<unknown> | undefined): boolean {\n if (a === b) return false;\n if (!a || !b || a.length !== b.length) return true;\n return a.some((v, i) => !Object.is(v, b[i]));\n}\n\nfunction currentPage(): { page: string; path: string } {\n try {\n const { pathname, search } = window.location;\n return { page: `${pathname}${search}`, path: pathname };\n } catch {\n return { page: \"\", path: \"\" };\n }\n}\n\nfunction buildReport(\n details: ErrorBoundaryDetails,\n componentStack: string | undefined,\n props: ErrorBoundaryProps,\n): CrashReport {\n const { page, path } = currentPage();\n const extras: Record<string, string> = {};\n try {\n const more = props.reportExtras?.();\n if (more) for (const [k, v] of Object.entries(more)) extras[k] = String(v);\n } catch {\n /* documented: the lines are left out */\n }\n let userAgent = \"\";\n let online: boolean | undefined;\n try {\n userAgent = navigator.userAgent;\n online = typeof navigator.onLine === \"boolean\" ? navigator.onLine : undefined;\n } catch {\n /* no navigator (SSR, a worker test) */\n }\n const report: CrashReport = {\n name: details.name,\n message: details.message,\n stack: details.stack,\n componentStack: componentStack ?? undefined,\n page,\n time: new Date().toISOString(),\n userAgent,\n appVersion: props.appVersion,\n placement: props.placement,\n online,\n chunkLoad: isChunkLoadError(details),\n extras,\n };\n if (!props.redact) return report;\n try {\n return props.redact(report);\n } catch {\n // Fail closed: an app that asked for redaction must not get the unredacted page.\n return { ...report, page: path, extras: {} };\n }\n}\n\n/**\n * Catch a render error below it and show ONE crash screen instead of an empty page.\n *\n * The three apps each built one. kastlan's and keksdose's sat on `EmptyState\n * tone=\"danger\"`; lenkbank's quoted the error and offered a plain-text report to copy;\n * keksdose's filed the crash itself, told a lazy-chunk failure apart as \"offline\", and\n * offered \"clear local data\" when a poisoned cache made Retry useless (feedback #160).\n * This is all of that, so the apps reduce to\n * `<ErrorBoundary resetKeys={[pathname]} appVersion={__VERSION__} />` plus, for an app\n * with a crash endpoint, `onReport` and `actions`:\n *\n * - the error's `name: message`, quoted (`showMessage`);\n * - Try again (reset the boundary) AND Reload (the page) — Try again alone re-renders\n * the same subtree from the same state, which a deterministic crash survives;\n * - a chunk-load error or an offline browser gets its own title and Reload first\n * (\"A new version is available\" / \"You're offline\");\n * - the copy button and the report in a disclosure; `onReport` for filing it, deduped\n * per page load, with its reference on screen.\n *\n * THE RULE for this fallback — and for a `fallback` or `actions` an app passes in: it\n * must not depend on the router, the query client or the auth store. A crash is exactly\n * when those may be what broke, and a fallback that throws escalates to the next\n * boundary up — at the app level there is none, and the user gets the white screen this\n * exists to prevent. So no `useNavigate`, no `useQuery`, no `useAuth()` in it; reload\n * with `window.location`, not the router. The kit's own label hooks are the one context\n * it does read (`errorBoundary.*` from `UiKitProvider`), and they degrade to the English\n * defaults when there is no provider above — which is why the app-level boundary may\n * sit OUTSIDE the provider and still render.\n *\n * The fallback is `role=\"alert\"`: a page replaced by an error is news, and a reader\n * that was on it is told.\n */\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n state: ErrorBoundaryState = CLEAR;\n\n /** Bumped by every catch and reset, so a filing that settles after the screen moved\n * on (Try again, a route change, a second crash) does not write into it. */\n private generation = 0;\n\n /**\n * Forget which crashes this page load has filed, and the count towards the cap.\n *\n * For tests: the dedupe lives in module scope because a page load is what it spans,\n * and a test file is one page load — so without this, the sixth test that files a\n * report finds the cap reached and `onReport` never called. Call it in `beforeEach`.\n * Never needed in an app: a reload is the reset.\n */\n static forgetReports(): void {\n filings.clear();\n }\n\n static getDerivedStateFromError(error: unknown): Partial<ErrorBoundaryState> {\n return { failed: true, error, details: describeThrown(error), report: null, filing: \"none\", reference: undefined };\n }\n\n componentDidCatch(error: unknown, info: ErrorInfo): void {\n try {\n this.props.onError?.(error, info);\n } catch {\n /* documented: a logger must not take the fallback down */\n }\n const details = this.state.details ?? describeThrown(error);\n const report = buildReport(details, info.componentStack ?? undefined, this.props);\n const { onReport } = this.props;\n const willFile = onReport !== undefined && !report.chunkLoad;\n const generation = ++this.generation;\n this.setState({ report, filing: willFile ? \"pending\" : \"none\", reference: undefined });\n if (!willFile) return;\n void fileOnce(report, onReport).then((filing) => {\n if (generation !== this.generation) return;\n this.setState(\n filing.filed ? { filing: \"filed\", reference: filing.reference } : { filing: \"failed\", reference: undefined },\n );\n });\n }\n\n componentDidUpdate(prev: ErrorBoundaryProps, prevState: ErrorBoundaryState): void {\n // Only a change AFTER the error was caught clears it (react-error-boundary's rule).\n // `prevState.failed` is false in the update that caught it: that update may well be\n // the one that changed the keys too — a navigation to a page that throws, with\n // `resetKeys={[pathname]}` — and resetting then would fire `onReset` for nothing and\n // render the failing child a second time. From then on `prev.resetKeys` are the\n // keys the error was shown under, so any change clears it.\n if (this.state.failed && prevState.failed && keysChanged(prev.resetKeys, this.props.resetKeys)) {\n this.reset();\n }\n }\n\n reset = (): void => {\n this.generation++;\n this.props.onReset?.();\n this.setState(CLEAR);\n };\n\n render(): ReactNode {\n const { failed, error, details, report, filing, reference } = this.state;\n if (!failed || !details) return this.props.children;\n const { fallback } = this.props;\n if (typeof fallback === \"function\") return fallback({ error, details, reset: this.reset, report });\n if (fallback !== undefined) return fallback;\n return (\n <ErrorFallback\n details={details}\n report={report}\n filing={filing}\n reference={reference}\n reset={this.reset}\n showMessage={this.props.showMessage ?? true}\n showDetails={this.props.showDetails ?? true}\n copyReport={this.props.copyReport ?? true}\n actions={this.props.actions}\n headingAs={this.props.headingAs ?? \"h2\"}\n className={this.props.className}\n labels={this.props.labels}\n />\n );\n }\n}\n\nfunction ErrorFallback({\n details,\n report,\n filing,\n reference,\n reset,\n showMessage,\n showDetails,\n copyReport,\n actions,\n headingAs,\n className,\n labels,\n}: {\n details: ErrorBoundaryDetails;\n report: CrashReport | null;\n filing: FilingState;\n reference: string | undefined;\n reset: () => void;\n showMessage: boolean;\n showDetails: boolean;\n copyReport: boolean;\n actions?: ReactNode;\n headingAs: NonNullable<ErrorBoundaryProps[\"headingAs\"]>;\n className?: string;\n labels?: LabelOverride<ErrorBoundaryLabels>;\n}) {\n const text = useKitLabels(\"errorBoundary\", DEFAULT_ERROR_BOUNDARY_LABELS, labels);\n const chunk = isChunkLoadError(details);\n // Offline first, as keksdose has it: offline, a chunk failure is the connection, and\n // any other crash most likely a request that could not be made — either way \"reload\n // once you are back\" is the advice, and \"a new version\" would be a false one.\n const mode = isOffline() ? \"offline\" : chunk ? \"update\" : \"error\";\n const title = mode === \"offline\" ? text.offlineTitle : mode === \"update\" ? text.updateTitle : text.title;\n const hint = mode === \"offline\" ? text.offlineMessage : mode === \"update\" ? text.updateMessage : text.message;\n const Icon = mode === \"offline\" ? WifiOff : mode === \"update\" ? RefreshCw : AlertTriangle;\n const reportText = report ? formatCrashReport(report) : null;\n const errorLine = details.message ? `${details.name}: ${details.message}` : details.name;\n\n // The title and the hint, said once through an assertive region of their own (0.52,\n // refactor audit 2026-10-30, DSP-17). `role=\"alert\"` on the whole box put the actions\n // in it, so each later insertion was read out as news: \"Copy error report\" and\n // \"Details\" on `componentDidCatch`'s second render, \"Reported as …\", and on opening\n // Details both stacks of the crash report. EmptyState has no wrapper for title and\n // hint alone, and a region mounted with its message is often missed anyway.\n const alert = useAnnounce({ politeness: \"assertive\" });\n const { announce } = alert;\n const spoken = `${title}. ${hint}`;\n useEffect(() => announce(spoken), [announce, spoken]);\n\n const reloadButton = (\n <Button key=\"reload\" variant={mode === \"error\" ? \"secondary\" : \"default\"} onClick={reloadPage}>\n {text.reload}\n </Button>\n );\n // Not after a chunk failure: `React.lazy` keeps the rejected import, so Try again\n // could only throw the same error again.\n const retryButton = chunk ? null : (\n <Button key=\"retry\" variant={mode === \"error\" ? \"default\" : \"secondary\"} onClick={reset}>\n {text.retry}\n </Button>\n );\n\n return (\n <>\n <span {...alert.regionProps} />\n <EmptyState\n tone={mode === \"error\" ? \"danger\" : undefined}\n headingAs={headingAs}\n className={className}\n icon={<Icon />}\n title={title}\n hint={hint}\n action={\n <>\n {showMessage && mode === \"error\" && (\n // A quotation, not prose: left-aligned and monospaced, so it reads as the\n // program's words and can be read out or screenshotted verbatim.\n <p\n data-error-message=\"\"\n className=\"-mt-1 mb-1 basis-full whitespace-pre-wrap break-words rounded-md border border-danger-strong bg-danger-soft px-3 py-2 text-start font-mono text-xs text-primary\"\n >\n {errorLine}\n </p>\n )}\n {filing === \"filed\" && (\n <p className=\"-mt-1 mb-1 basis-full text-xs\">{reference ? text.reportedAs(reference) : text.reported}</p>\n )}\n {mode === \"error\" ? [retryButton, reloadButton] : [reloadButton, retryButton]}\n {copyReport && reportText !== null && filing !== \"filed\" && (\n <CopyButton variant=\"label\" buttonVariant=\"ghost\" label={text.copyReport} text={reportText} />\n )}\n {actions}\n {showDetails && reportText !== null && (\n <Disclosure variant=\"bare\" title={text.details} className=\"basis-full text-start\">\n <pre className=\"max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-secondary\">\n {reportText}\n </pre>\n </Disclosure>\n )}\n </>\n }\n />\n </>\n );\n}\n"],"mappings":";AAuiBM,SA4FI,UA5FJ,KA4FI,YA5FJ;AAviBN,SAAS,WAAW,iBAAiB;AAErC,SAAS,eAAe,WAAW,eAAe;AAClD,SAAS,oBAAwC;AACjD,SAAS,c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AAK,UADI,QAEZ;AAIF,QAAM,cAAc,QAAQ,OAC1B,oBAAC,UAAmB,SAAS,SAAS,UAAU,YAAY,aAAa,SAAS,OAC/E,eAAK,SADI,OAEZ;AAGF,SACE,iCACE;AAAA,wBAAC,UAAM,GAAG,MAAM,aAAa;AAAA,IAC7B;AAAA,MAAC;AAAA;AAAA,QACC,MAAM,SAAS,UAAU,WAAW;AAAA,QACpC;AAAA,QACA;AAAA,QACA,MAAM,oBAAC,QAAK;AAAA,QACZ;AAAA,QACA;AAAA,QACA,QACE,iCACG;AAAA,yBAAe,SAAS;AAAA;AAAA,UAGvB;AAAA,YAAC;AAAA;AAAA,cACC,sBAAmB;AAAA,cACnB,WAAU;AAAA,cAET;AAAA;AAAA,UACH;AAAA,UAED,WAAW,WACV,oBAAC,OAAE,WAAU,iCAAiC,sBAAY,KAAK,WAAW,SAAS,IAAI,KAAK,UAAS;AAAA,UAEtG,SAAS,UAAU,CAAC,aAAa,YAAY,IAAI,CAAC,cAAc,WAAW;AAAA,UAC3E,cAAc,eAAe,QAAQ,WAAW,WAC/C,oBAAC,cAAW,SAAQ,SAAQ,eAAc,SAAQ,OAAO,KAAK,YAAY,MAAM,YAAY;AAAA,UAE7F;AAAA,UACA,eAAe,eAAe,QAC7B,oBAAC,cAAW,SAAQ,QAAO,OAAO,KAAK,SAAS,WAAU,yBACxD,8BAAC,SAAI,WAAU,iFACZ,sBACH,GACF;AAAA,WAEJ;AAAA;AAAA,IAEJ;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { CharacterCountLabels, PasswordRevealLabels } from "./field-base.js";
|
|
2
|
-
import type { TabsLabels } from "./tabs.js";
|
|
3
2
|
export declare const DEFAULT_PASSWORD_REVEAL_LABELS: PasswordRevealLabels;
|
|
4
3
|
export declare const DEFAULT_CHARACTER_COUNT_LABELS: CharacterCountLabels;
|
|
5
|
-
export declare const DEFAULT_TABS_LABELS: TabsLabels;
|
|
@@ -8,15 +8,8 @@ const DEFAULT_CHARACTER_COUNT_LABELS = {
|
|
|
8
8
|
remaining: (left) => left === 1 ? "1 character left" : `${left} characters left`,
|
|
9
9
|
limitReached: "Character limit reached"
|
|
10
10
|
};
|
|
11
|
-
const DEFAULT_TABS_LABELS = {
|
|
12
|
-
add: "Add tab",
|
|
13
|
-
remove: (tab) => `Remove ${tab}`,
|
|
14
|
-
more: "More tabs",
|
|
15
|
-
previous: "Previous tabs"
|
|
16
|
-
};
|
|
17
11
|
export {
|
|
18
12
|
DEFAULT_CHARACTER_COUNT_LABELS,
|
|
19
|
-
DEFAULT_PASSWORD_REVEAL_LABELS
|
|
20
|
-
DEFAULT_TABS_LABELS
|
|
13
|
+
DEFAULT_PASSWORD_REVEAL_LABELS
|
|
21
14
|
};
|
|
22
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=field-base-labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/field-base-labels.ts"],"sourcesContent":["// The English words of ./field-base, in a module with no component code: the English\n// catalogue (src/i18n/defaults.ts) imports them without the component, so `en` loads as one\n// chunk like the other languages (0.34, KS U8). ./field-base re-exports them.\n//\n// Until 0.52 they shared ui-labels.ts with the tabs' words, named after the ui.tsx that\n// 0.34 split up (MOD-7, refactor audit 2026-10-30): one labels module per component now,\n// as every other `*-labels.ts` is.\n\nimport type { CharacterCountLabels, PasswordRevealLabels } from \"./field-base\";\n\nexport const DEFAULT_PASSWORD_REVEAL_LABELS: PasswordRevealLabels = {\n show: \"Show password\",\n hide: \"Hide password\",\n};\n\nexport const DEFAULT_CHARACTER_COUNT_LABELS: CharacterCountLabels = {\n count: (used, max) => `${used} of ${max} characters`,\n remaining: (left) => (left === 1 ? \"1 character left\" : `${left} characters left`),\n limitReached: \"Character limit reached\",\n};\n"],"mappings":";AAUO,MAAM,iCAAuD;AAAA,EAClE,MAAM;AAAA,EACN,MAAM;AACR;AAEO,MAAM,iCAAuD;AAAA,EAClE,OAAO,CAAC,MAAM,QAAQ,GAAG,IAAI,OAAO,GAAG;AAAA,EACvC,WAAW,CAAC,SAAU,SAAS,IAAI,qBAAqB,GAAG,IAAI;AAAA,EAC/D,cAAc;AAChB;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
2
|
import { type FieldHintParts } from "./field-parts.js";
|
|
3
|
-
import { DEFAULT_CHARACTER_COUNT_LABELS, DEFAULT_PASSWORD_REVEAL_LABELS } from "./
|
|
3
|
+
import { DEFAULT_CHARACTER_COUNT_LABELS, DEFAULT_PASSWORD_REVEAL_LABELS } from "./field-base-labels.js";
|
|
4
4
|
/**
|
|
5
5
|
* The field base: what Input, Select and Textarea — and every kit field built on the same
|
|
6
6
|
* look — share (0.34, MOD-2, refactor audit 2026-10). The `FIELD_*` classes, the floating
|
|
@@ -8,7 +8,8 @@ import { DEFAULT_CHARACTER_COUNT_LABELS, DEFAULT_PASSWORD_REVEAL_LABELS } from "
|
|
|
8
8
|
* reveal and the character counter. The message under a wrong field is field-parts'
|
|
9
9
|
* `useFieldError`, every field's.
|
|
10
10
|
*
|
|
11
|
-
* Public through
|
|
11
|
+
* Public through the barrel (src/index.ts) by name. `FieldGroup`, the counter and the
|
|
12
|
+
* placeholder helpers are
|
|
12
13
|
* the three fields' shared parts (`@internal`), as are the Select's own classes and its
|
|
13
14
|
* `SelectWidthFloor` (0.51).
|
|
14
15
|
*/
|
|
@@ -32,7 +33,7 @@ export declare const FIELD_BASE: string;
|
|
|
32
33
|
* cannot make the later one win. */
|
|
33
34
|
export declare const FIELD_WRITABLE_LOOK = "[&[readonly]]:bg-surface [&[readonly]]:text-primary";
|
|
34
35
|
export declare const FIELD_FLOATING_PAD = "pt-4 pb-1 large:py-2";
|
|
35
|
-
export declare const FIELD_INVALID = "border-danger-strong ring-1 ring-danger-strong focus:border-[var(--danger)] focus:ring-[var(--danger)]";
|
|
36
|
+
export declare const FIELD_INVALID = "border-danger-strong ring-1 contrast:ring-2 ring-danger-strong focus:border-[var(--danger)] focus:ring-[var(--danger)]";
|
|
36
37
|
export declare const FLOATING_INPUT_CLASS: string;
|
|
37
38
|
/**
|
|
38
39
|
* The PHONE display treatment (Keksdose feedback #176, carried across the entry
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
LABEL_ABOVE_BOX,
|
|
12
12
|
STATIC_LABEL_TYPE
|
|
13
13
|
} from "./field-parts.js";
|
|
14
|
-
import { DEFAULT_CHARACTER_COUNT_LABELS, DEFAULT_PASSWORD_REVEAL_LABELS } from "./
|
|
14
|
+
import { DEFAULT_CHARACTER_COUNT_LABELS, DEFAULT_PASSWORD_REVEAL_LABELS } from "./field-base-labels.js";
|
|
15
15
|
const FIELD_TOUCH_TEXT = "pointer-coarse:text-[length:max(0.875rem,16px)]";
|
|
16
|
-
const FIELD_BASE = "block w-full rounded-md border border-subtle bg-surface px-3 py-2 text-sm text-primary shadow-sm placeholder:text-placeholder focus:border-brand focus:ring-1 focus:ring-inset focus:ring-brand " + // §10.1: at least 16 px on a touch screen, or iOS zooms the page on focus.
|
|
16
|
+
const FIELD_BASE = "block w-full rounded-md border border-subtle bg-surface px-3 py-2 text-sm text-primary shadow-sm placeholder:text-placeholder focus:border-brand focus:ring-1 contrast:focus:ring-2 focus:ring-inset focus:ring-brand " + // §10.1: at least 16 px on a touch screen, or iOS zooms the page on focus.
|
|
17
17
|
FIELD_TOUCH_TEXT + " disabled:cursor-default disabled:bg-surface-2 disabled:text-muted [&[readonly]]:bg-surface-2 [&[readonly]]:text-muted";
|
|
18
18
|
const FIELD_WRITABLE_LOOK = "[&[readonly]]:bg-surface [&[readonly]]:text-primary";
|
|
19
19
|
const FIELD_FLOATING_PAD = "pt-4 pb-1 large:py-2";
|
|
20
|
-
const FIELD_INVALID = "border-danger-strong ring-1 ring-danger-strong focus:border-[var(--danger)] focus:ring-[var(--danger)]";
|
|
20
|
+
const FIELD_INVALID = "border-danger-strong ring-1 contrast:ring-2 ring-danger-strong focus:border-[var(--danger)] focus:ring-[var(--danger)]";
|
|
21
21
|
const FLOATING_INPUT_CLASS = cn(FIELD_BASE, FIELD_FLOATING_PAD, "peer placeholder:text-transparent");
|
|
22
22
|
const FIELD_DISPLAY = "block w-full border-x-0 border-t-0 border-b border-subtle bg-transparent px-0 pt-0 pb-1 text-primary shadow-none placeholder:text-placeholder focus:border-brand focus:shadow-[inset_0_-1px_0_var(--brand)] focus:outline-none focus:ring-0 disabled:opacity-60";
|
|
23
23
|
const FIELD_TRIGGER = cn(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/field-base.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport {\n FieldCaption,\n FLOATING_LABEL_STATIC,\n LABEL_ABOVE_AT_LARGE,\n LABEL_ABOVE_BOX,\n STATIC_LABEL_TYPE,\n type FieldHintParts,\n} from \"./field-parts\";\nimport { DEFAULT_CHARACTER_COUNT_LABELS, DEFAULT_PASSWORD_REVEAL_LABELS } from \"./ui-labels\";\n\n/**\n * The field base: what Input, Select and Textarea — and every kit field built on the same\n * look — share (0.34, MOD-2, refactor audit 2026-10). The `FIELD_*` classes, the floating\n * label and its `FloatingField` box, `Label`, the chevron, and the words of the password\n * reveal and the character counter. The message under a wrong field is field-parts'\n * `useFieldError`, every field's.\n *\n * Public through ./ui by name. `FieldGroup`, the counter and the placeholder helpers are\n * the three fields' shared parts (`@internal`), as are the Select's own classes and its\n * `SelectWidthFloor` (0.51).\n */\n\n/**\n * The 16 px floor on touch (docs/text-size-harmonization.md §10.1). iOS zooms the page\n * when a field under 16 px takes focus, and keksdose's `maximum-scale=1` — which stopped\n * it — goes so pinch zoom works again (WCAG 1.4.4). A zoomed page drops the keyboard\n * inset to 0 (§10.2), so the zoom would put a pinned editor footer behind the keyboard\n * (keksdose #154). So on a coarse pointer a field is at least 16 px, at every text size:\n * `max()` leaves Large and Extra large alone, where `text-sm` is already 17.5 / 21 px.\n *\n * In px on purpose: the threshold is the browser's, in CSS px, whatever the root size.\n * Font size only — the line height keeps `text-sm`'s ratio. Part of {@link FIELD_BASE};\n * add it to any other text-entry control whose type is below 16 px.\n */\nexport const FIELD_TOUCH_TEXT = \"pointer-coarse:text-[length:max(0.875rem,16px)]\";\n\nexport const FIELD_BASE =\n \"block w-full rounded-md border border-subtle bg-surface px-3 py-2 text-sm text-primary shadow-sm placeholder:text-placeholder focus:border-brand \" +\n // The focus line, whole at fractional display scaling (K5 follow-up, keksdose run 78):\n // at 125 % a 1px border covers 1.25 device pixels, and the sides that fall across a\n // pixel boundary read half-strength. A 1px INSET ring in the focus colour beside it\n // doubles the line inward — FIELD_INVALID's border-plus-ring (live #295), and the\n // DatePicker stepper's fix (0.34) — so every side keeps one fully covered device\n // pixel. Inset: nothing outside the field moves or is covered.\n \"focus:ring-1 focus:ring-inset focus:ring-brand \" +\n // §10.1: at least 16 px on a touch screen, or iOS zooms the page on focus.\n FIELD_TOUCH_TEXT +\n \" \" +\n // A field the user cannot change has to LOOK settled. Without this, `disabled`\n // dimmed the floating label and nothing else — FIELD_BASE's own\n // `text-primary` overrides the browser's grey — so a read-only value\n // sat there at full body-text strength, indistinguishable from one you could retype\n // (Keksdose dev#455/#474).\n \"disabled:cursor-default disabled:bg-surface-2 disabled:text-muted \" +\n // Same for a field that takes focus but refuses keys: `readOnly` is not\n // `disabled`, and a value that cannot be edited should not claim it can be. Opt\n // OUT with {@link FIELD_WRITABLE_LOOK} in the one case where `readOnly` does not\n // mean that — see the two-factor code field, which uses it to block an autofill\n // and drops it the moment you focus the field.\n //\n // ⚠️ The ATTRIBUTE, never the `:read-only` pseudo-class (Keksdose dev#477).\n // `:read-only` does not mean \"was marked readonly\" — per Selectors 4 it matches\n // everything that is not `:read-write`, and only editable inputs/textareas and\n // contenteditable elements are `:read-write`. So `read-only:` matched every\n // `<select>` in the app and every field-styled `<button>` built on this base —\n // the native selects, the date trigger, the entity/currency/multi pickers — and\n // painted them all in the \"you may not edit this\" grey. On one transaction form\n // that made three different-looking families out of one field style: plain\n // inputs, grey selects, grey trigger buttons.\n \"[&[readonly]]:bg-surface-2 [&[readonly]]:text-muted\";\n\n/** Cancels FIELD_BASE's read-only treatment for a field that is `readOnly` for a\n * reason other than \"you may not edit this\". Attribute-scoped for the same reason\n * FIELD_BASE is — the two have to cancel on the identical selector or twMerge\n * cannot make the later one win. */\nexport const FIELD_WRITABLE_LOOK = \"[&[readonly]]:bg-surface [&[readonly]]:text-primary\";\n\n// Extra top padding leaves room for a label that floats INSIDE the field (the\n// \"filled\" pattern) — the label sits in the top strip, the value below it. Used by\n// every labelled field (native + custom-dropdown triggers). twMerge lets pt/pb win\n// over FIELD_BASE's py-2. At Large the label stands above the field (0.33, §10.17,\n// LABEL_ABOVE_AT_LARGE), so the strip goes and the field is FIELD_BASE's `py-2` again.\nexport const FIELD_FLOATING_PAD = \"pt-4 pb-1 large:py-2\";\n\n// Error/required highlight for a field that is missing a value — a `--danger`\n// border and matching focus ring so the control itself shows what's wrong, not just\n// a note beside it (feedback #235). Layered after FIELD_BASE so twMerge wins.\n//\n// The `ring-1` is not decoration; it is what makes the highlight SURVIVE display\n// scaling (Keksdose live #295 — *\"Account select boundary. It is not highlighted on\n// the sides.\"*). At 125%, the browser's usual setting on a 2560px screen, a 1px CSS\n// border is 1.25 device pixels: the horizontal edges land on whole rows and paint\n// solid, while one of the two VERTICAL edges lands across a pixel boundary and is\n// spread over two columns at partial coverage. Measured on the receipt's required\n// account field, dark theme, back when this was a hard-coded rose (full =\n// rgb(208,30,78)): left/top/bottom all 208, right 160 then 115 — the side that is\n// supposed to shout, at 55–77% of the others. A border plus a ring is 2 CSS px, so\n// whatever the fraction there is always one fully covered device pixel on every side\n// (re-measured: worst side 241). It is the GEOMETRY that carries that, not the hue,\n// so the fix survives a consumer re-pointing `--danger-border`.\n//\n// A ring rather than `border-2`: a box-shadow adds no layout, so an invalid field\n// stays exactly the size of a valid one and nothing beside it moves when the value\n// arrives.\nexport const FIELD_INVALID =\n \"border-danger-strong ring-1 ring-danger-strong focus:border-[var(--danger)] focus:ring-[var(--danger)]\";\n\nexport const FLOATING_INPUT_CLASS = cn(FIELD_BASE, FIELD_FLOATING_PAD, \"peer placeholder:text-transparent\");\n\n/**\n * The PHONE display treatment (Keksdose feedback #176, carried across the entry\n * forms by #179): the field chrome removed so the ONE input a form is actually\n * about reads as the thing itself, not as another boxed row in a stack.\n *\n * Every control that takes `variant=\"display\"` — {@link Input}, `NumberInput`,\n * `AmountInput` — means exactly the same thing by it: the treatment applies in the\n * phone layout (`usePhoneLayout()`, `max-md:` at the text size in force) and the field\n * is untouched above it, so a caller never has\n * to ask the viewport, and a form can't end up half-treated across breakpoints.\n *\n * What stays, deliberately:\n * - A hairline baseline. With the box gone something still has to say \"you can\n * type here\"; it takes the brand colour on focus, where a bordered field would\n * light its whole outline. Each edge is set exactly once (`border-x-0\n * border-t-0 border-b`) so the rule can't hinge on utility order. On focus the\n * line is doubled inward by an inset shadow on that edge alone — FIELD_BASE's\n * inset ring, for the same reason (K5 follow-up: a 1px line reads half-strength at\n * 125 %) — where a ring would draw a box round the figure.\n * - The muted placeholder colour, because a display field is usually empty at\n * the moment it matters most and has nothing else to show.\n * - The label, moved to `sr-only` rather than dropped: display type is legible\n * to the eye, not to a screen reader.\n *\n * Size and weight are NOT here — an amount wants display type, a subject line\n * wants a heading — so each control adds its own on top.\n */\nexport const FIELD_DISPLAY =\n \"block w-full border-x-0 border-t-0 border-b border-subtle bg-transparent px-0 pt-0 pb-1 text-primary shadow-none placeholder:text-placeholder focus:border-brand focus:shadow-[inset_0_-1px_0_var(--brand)] focus:outline-none focus:ring-0 disabled:opacity-60\";\n\n// A field-styled button trigger for the custom dropdown controls (MultiSelect,\n// CurrencySelect) — the field look (border/bg) as a flex row for the value + chevron,\n// so they don't hand-copy the field classes. Add FIELD_FLOATING_PAD only when the\n// trigger carries a label (unlabelled triggers stay normal height to match buttons /\n// adjacent controls). Pair the labelled case with a static FieldLabel.\n// `relative` so the trigger can host an absolutely-centred FieldChevron / clear\n// button the way the native Select does.\n//\n// `[&>:first-child]:min-h-[1lh]` holds one line box open whatever the value is. A\n// trigger with nothing chosen and no placeholder renders an EMPTY value span, an\n// empty span has no line box, and the trigger collapsed to its padding — 18px\n// tall in a stack of 38px fields (an RhfCombobox without a placeholder; DatePicker\n// and MonthPicker had met the same thing as Keksdose live #294 and patched their\n// own span with a U+00A0). Here, on the shared class, it covers every trigger\n// built on it, including a `renderTrigger` one. `1lh` rather than a fixed height\n// so it tracks whatever type the trigger is set in; the first child is the value\n// in every trigger here (the chevron and the clear button are absolute).\nexport const FIELD_TRIGGER = cn(\n FIELD_BASE,\n \"relative flex items-center justify-between gap-2 text-start hover:bg-hover\",\n \"[&>:first-child]:min-h-[1lh]\",\n);\n\n/** An alias rather than an interface: the chevron adds nothing of its own to an\n * `<svg>`'s props, and an interface declaring no members is the same type wearing a\n * name that suggests otherwise. */\nexport type FieldChevronProps = Omit<ComponentPropsWithRef<\"svg\">, \"children\">;\n\n/** The dropdown chevron, shared by the native {@link Select} and every custom\n * {@link FIELD_TRIGGER} control.\n *\n * Absolutely positioned and centred on the FIELD box. As an ordinary flex child\n * it centres on the *content* box instead, and `FIELD_FLOATING_PAD` (pt-4 pb-1)\n * pushes that box's midline down — so a labelled currency/multi-select chevron\n * sat visibly lower than the native select's right beside it (feedback #400).\n * Pair it with `pe-9` on the trigger so the value can't run underneath. At the\n * inline END, not the right: a right-to-left form reads the value from the right,\n * and a chevron parked on top of its first word hid exactly the part that says\n * what was picked. */\nexport function FieldChevron({ className, ...rest }: FieldChevronProps) {\n return (\n <ChevronDown\n {...rest}\n // After the spread: the chevron is decoration beside a control that already has\n // a name, and an `aria-hidden` a caller could switch off by accident is a second\n // announcement of the same field.\n aria-hidden\n className={cn(\"pointer-events-none absolute end-2.5 top-1/2 size-4 -translate-y-1/2 text-placeholder\", className)}\n />\n );\n}\n\n/** A native dropdown Select's dress: no native arrow, and `pe-9`, the room the\n * {@link FieldChevron} takes. Shared with {@link SelectWidthFloor}. `@internal` */\nexport const SELECT_MENU_DRESS = \"appearance-none pe-9\";\n\n/** The compact Select (`size=\"sm\"`): the field's colours, a toolbar button's height.\n * `py-0` and a fixed height rather than a smaller padding, so the box is 28px whatever\n * line height the caller's type brings with it. Shared with {@link SelectWidthFloor}.\n * `@internal` */\nexport const SELECT_SM = \"h-7 py-0 ps-2 pe-7 text-xs\";\n\n/**\n * The width an UNLABELLED Select needs to show the widest of `values` whole: an invisible,\n * zero-height line under it, in the select's own type, padding, chevron room and border\n * (the same classes), one value per line. Placed beside the Select in the box that sizes\n * it, it holds that box to the widest value, and the `w-full` select fills it. `@internal`\n *\n * Why it takes a sizer (0.51, Kurvenschmiede N5). A `<select>` with a percentage width\n * is a \"compressible\" element: its min-content contribution is ZERO (CSS Sizing 3\n * §5.2.2), so the auto table layout squeezes its column to the header, and beside a\n * `grow` column every other column IS squeezed to its min-content (data-table-fit.ts).\n * The user roster's role select stood 92px and read \"Meml…\" and \"Admi…\" (KS review,\n * 0.49 and 0.50). `min-width: max-content` on the select would hold it instead — but to\n * its widest OPTION, and an unavailable role's option carries its reason (\"Customer (owns\n * work)\", RoleSelect's `optionDisabledReason`): the column would widen for a text that is\n * never the selected value. So the caller says which values can be selected, in the\n * current language.\n */\nexport function SelectWidthFloor({ values, size = \"md\" }: { values: readonly string[]; size?: \"sm\" | \"md\" }) {\n if (values.length === 0) return null;\n return (\n <span\n aria-hidden\n data-select-floor=\"\"\n className={cn(\n FIELD_BASE,\n SELECT_MENU_DRESS,\n size === \"sm\" && SELECT_SM,\n // The horizontal box only: no height, no vertical padding or border, not painted.\n \"invisible h-0 overflow-hidden border-y-0 py-0 whitespace-nowrap shadow-none\",\n )}\n >\n {values.map((value, i) => (\n // The value as generated content, not as text: it is laid out (and so measured)\n // the same, but a test's `getByText(\"Member\")` still finds the one option, and a\n // find-in-page or a copied row does not meet a word nobody sees.\n <span key={i} data-value={value} className=\"block before:content-[attr(data-value)]\" />\n ))}\n </span>\n );\n}\n\n// Animated label that starts centred (as a placeholder) in an empty field and\n// floats up INSIDE the top strip on focus or once the field has a value. Sits on\n// the field's own surface, so no background chip and nothing to mismatch the card.\n//\n// At Large it is a static label ABOVE the field instead (0.33, §10.17): in flow, so it\n// wraps; always in its floated look, since there is no strip to float into and no\n// placeholder to stand in for; no transition, since it never moves.\nconst LABEL_FLOATED_AT_LARGE = \"large:text-caption large:leading-tight large:text-secondary large:transition-none\";\n\nexport const FLOATING_LABEL_CLASS = cn(\n \"pointer-events-none absolute start-3 top-2.5 text-sm text-placeholder transition-all\",\n \"max-w-[calc(100%-1.5rem)] truncate-until-large\",\n \"peer-focus:top-1 peer-focus:text-caption peer-focus:leading-tight peer-focus:text-secondary\",\n \"peer-[:not(:placeholder-shown)]:top-1 peer-[:not(:placeholder-shown)]:text-caption peer-[:not(:placeholder-shown)]:leading-tight peer-[:not(:placeholder-shown)]:text-secondary\",\n \"peer-disabled:opacity-50\",\n LABEL_ABOVE_AT_LARGE,\n \"large:block\",\n LABEL_FLOATED_AT_LARGE,\n);\n\n// The animated label again, as a ROW that the label and its \"?\" share — same\n// placement, same float, same type, but with the type on the row so the label\n// INHERITS it. It has to be that way round: `peer-focus:` compiles to a sibling\n// selector, so the classes have to sit on the element that is actually a sibling\n// of the input, and a label nested inside a wrapper is not one.\n//\n// Wider end clearance than the label alone takes (`3rem` rather than `1.5rem`),\n// because the controls that carry an animated label are the ones with something\n// at the end edge of the field — NumberInput's calculator is the case this was\n// written for. The label truncates a little sooner; the alternative was the \"?\"\n// sitting on top of a button (steering-design feedback #48). At Large the row stands\n// above the field, as the label alone does, and nothing at the end edge is under it.\nconst FLOATING_ROW_CLASS = cn(\n \"pointer-events-none absolute start-3 top-2.5 flex items-center gap-1 transition-all\",\n \"max-w-[calc(100%-3rem)] text-sm text-placeholder\",\n \"peer-focus:top-1 peer-focus:text-caption peer-focus:leading-tight peer-focus:text-secondary\",\n \"peer-[:not(:placeholder-shown)]:top-1 peer-[:not(:placeholder-shown)]:text-caption peer-[:not(:placeholder-shown)]:leading-tight peer-[:not(:placeholder-shown)]:text-secondary\",\n \"peer-disabled:opacity-50\",\n LABEL_ABOVE_AT_LARGE,\n LABEL_FLOATED_AT_LARGE,\n);\n\n/** The static label's row with its \"?\" at the field's end, in the top strip — and at\n * Large above the field (LABEL_ABOVE_AT_LARGE). */\nconst STATIC_ROW_CLASS = cn(\n \"pointer-events-none absolute inset-x-3 top-1 flex items-center gap-1\",\n LABEL_ABOVE_AT_LARGE,\n);\n\n/**\n * The one place that assembles a labelled field: a `relative` wrapper around the\n * control (`children`) plus a floating label inside the top strip. Pass `staticLabel`\n * for controls that always have a value (selects); omit it for free-text fields whose\n * label animates from centred→up. Used by Input/Select/Textarea/NumberInput; the\n * dropdown controls that need a ref + menu keep their own wrapper but the same label\n * (via {@link FieldLabel}) and trigger ({@link FIELD_TRIGGER}) styles.\n */\nexport interface FloatingFieldProps extends ComponentPropsWithRef<\"div\"> {\n htmlFor?: string;\n label?: ReactNode;\n staticLabel?: boolean;\n /** Keep the label in the accessibility tree but out of the layout — what\n * {@link FIELD_DISPLAY} needs, since a floating label inside a field with no\n * field left would have nothing to float in. */\n srOnlyLabel?: boolean;\n /** Something interactive that belongs to the LABEL rather than to the value —\n * in practice a {@link FieldHint} \"?\" (dev#468). It is rendered in a flex row\n * with the label, so it is centred on the label's line by the layout instead\n * of by a hand-tuned `top-…`, and it can never drift when the type changes.\n *\n * It rides an ANIMATED label too, and the two cases place it differently on\n * purpose. A static label has a field-wide strip to itself, so the hint sits\n * at the far end of it and a long label truncates into the gap. An animated\n * one belongs to a control with something at the end edge of the field — a\n * calculator, a stepper — so the hint follows the label instead, and it is\n * the label that gives way (steering-design feedback #48). */\n hint?: ReactNode;\n children: ReactNode;\n}\n\nexport function FloatingField({\n className,\n htmlFor,\n label,\n staticLabel,\n srOnlyLabel,\n hint,\n children,\n ...rest\n}: FloatingFieldProps) {\n const withHint = hint !== undefined && !srOnlyLabel;\n const atEnd = withHint && staticLabel;\n // A label drawn over the field: at Large it stands above it instead (0.33, §10.17),\n // in the first row of this box (LABEL_ABOVE_BOX), though it FOLLOWS the control in\n // the DOM — `peer-*` reads the input before it.\n const above = label !== undefined && !srOnlyLabel;\n const labelEl = label !== undefined && (\n <label\n htmlFor={htmlFor}\n // In the first row at Large, out of LABEL_ABOVE_BOX's rule for the field's parts.\n data-field-label={above && !withHint ? \"\" : undefined}\n className={\n srOnlyLabel\n ? \"sr-only\"\n : atEnd\n ? cn(\"pointer-events-none min-w-0 truncate-until-large\", STATIC_LABEL_TYPE)\n : withHint\n ? \"pointer-events-none min-w-0 truncate-until-large\"\n : staticLabel\n ? FLOATING_LABEL_STATIC\n : FLOATING_LABEL_CLASS\n }\n >\n {label}\n </label>\n );\n return (\n // `relative` is the whole contract of this wrapper — the floating label and every\n // control that hangs off it (a reveal toggle, a chevron) are positioned against\n // this box — so it is merged through `cn` after the spread rather than left where\n // a caller's stray `className` or `style` could unset it. At Large, with a label\n // above, a grid: the label's row over the field's, the field's parts in the latter.\n <div {...rest} className={cn(\"relative\", above && LABEL_ABOVE_BOX, className)}>\n {children}\n {withHint ? (\n // Static: `inset-x-3` rather than `start-3`, so a long label truncates at\n // the field's own end padding instead of running under the chevron.\n // Animated: the row floats with the label and is only as wide as it needs\n // to be. Either way the hint keeps its width (`shrink-0`) and the label\n // is the one that gives way.\n <div data-field-label=\"\" className={atEnd ? STATIC_ROW_CLASS : FLOATING_ROW_CLASS}>\n {labelEl}\n <span className=\"pointer-events-auto flex shrink-0 items-center\">{hint}</span>\n </div>\n ) : (\n labelEl\n )}\n </div>\n );\n}\n\nexport interface LabelProps extends ComponentPropsWithRef<\"label\"> {\n /** Draw the required mark after the text. The mark is `aria-hidden`: what a\n * screen reader hears is the control's own `required` / `aria-required`, which\n * the caller still sets — a \"star\" read out as the last word of every name is\n * noise, and a control that is not marked required is not required however its\n * label looks. */\n required?: boolean;\n /** `sm` for a toolbar or a dense filter row (12px), `md` otherwise (14px). */\n size?: \"sm\" | \"md\";\n /** Dim the label with its control. A label ABOVE its field is not the field's\n * `peer`, so `peer-disabled:` cannot reach it the way it reaches a floating one. */\n disabled?: boolean;\n}\n\n/**\n * The label ABOVE a field, for the places a floating label does not fit: a control\n * the kit did not render (a third-party picker, a range slider, a group of radios),\n * a filter bar whose fields are unlabelled {@link Select}s, a form that sets labels\n * above its fields throughout.\n *\n * A new component rather than a mode of {@link FieldLabel}, because the two share\n * nothing but the word. `FieldLabel` is an absolutely positioned `<span>` inside a\n * trigger's `relative` box and has to stay exactly that for every dropdown that\n * already lines up with it; this is a real `<label>` in normal flow, with `htmlFor`,\n * that a click focuses the control through. Spacing below it belongs to the caller's\n * layout (`space-y-1.5` on the pair, typically), as it would for any block.\n */\nexport function Label({ required, size = \"md\", disabled, className, children, ...rest }: LabelProps) {\n return (\n <label\n {...rest}\n className={cn(\n \"inline-flex items-center gap-0.5 font-medium leading-none text-primary\",\n size === \"sm\" ? \"text-xs\" : \"text-sm\",\n disabled && \"cursor-default opacity-50\",\n className,\n )}\n >\n {children}\n {required && (\n <span aria-hidden className=\"text-danger\">\n *\n </span>\n )}\n </label>\n );\n}\n\n// The message under a field that is wrong, and the wiring that attaches it — `useFieldError`\n// — lives in field-parts since 0.34, every field's (DUP-8, refactor audit 2026-10).\n\n/**\n * @internal A field and its message as one box.\n *\n * The message cannot go INSIDE the field's own `relative` box. The password reveal\n * toggle is `inset-y-0` and the select chevron is `top-1/2`, so both centre on\n * whatever that box contains — put two lines of message in it and the chevron drifts\n * down out of the field, between the value and the text. So the field keeps its box\n * and this wraps the pair.\n *\n * WHEN IT WRAPS. A field that never takes `error` renders nothing of its own here,\n * which is what keeps the prop additive: it is exactly the DOM it was before the prop\n * existed, down to the bare `<input>` an unlabelled {@link Input} drops straight into a\n * caller's flex row. A field that DOES take `error` — the key is passed, whatever its\n * value — is wrapped for as long as it is mounted, message or not (`reserve`).\n *\n * It used to wrap only while a message showed, and that cost the control its\n * identity: a fragment and a `<div>` are different elements at the same spot in the\n * tree, so React threw the `<input>` away and mounted a new one every time the message\n * came or went. Focus fell to `<body>`, the caret went with it, and an uncontrolled\n * field lost what had been typed — Kurvenschmiede's confirm-password dialog clears its\n * \"Wrong password\" on change, so the first keystroke of the retry dropped the user out\n * of the field. Keeping the box stops that; the field is never reparented.\n *\n * The other ways to keep it stable were worse. A box on EVERY field changes what every\n * flex row and grid in three apps lays out (`flex-1`, `w-56`, `col-span-2` on the\n * field would land on a child of the item instead of the item). A `display: contents`\n * box would keep the flex/grid item, but a contents box takes no margin, so a parent's\n * `space-y-*` stops spacing the field — the shape of Kurvenschmiede's reset-password\n * form and gear wizard, both `space-y-*` stacks of fields with `error` — and it moves\n * `first:`/`last:`/`> *` matches. A field passing `error` already took this plain box\n * whenever its message showed, so what changes is only that it keeps it while none\n * does; every such call site in the three apps sits in a block or a `space-y`/grid\n * stack where a full-width block box is the field's own size. The case it does change\n * is a field passing `error` whose `className` sizes it as a flex item (`flex-1` in a\n * row): that caller already lost the sizing while a message showed, and now sees the\n * same box without one. Pass `error` only where a message can actually appear.\n *\n * `className` is NOT moved out here, for the same reason — it goes on the field, as it\n * always has, so the box cannot silently change what that prop styles.\n */\nexport function FieldGroup({\n errorEl,\n reserve = false,\n children,\n}: {\n errorEl: ReactNode;\n /** The caller passed `error`: keep the box even while there is no message. */\n reserve?: boolean;\n children: ReactNode;\n}) {\n if (errorEl === null && !reserve) return <>{children}</>;\n return (\n <div>\n {children}\n {errorEl}\n </div>\n );\n}\n\n/** The two names the password reveal toggle can wear. See {@link Input}. */\nexport interface PasswordRevealLabels {\n /** While the value is hidden — activating the toggle will show it. */\n show: string;\n /** While the value is shown. */\n hide: string;\n}\n\n// Defined in ./ui-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_PASSWORD_REVEAL_LABELS };\n\n/**\n * What the character counter of {@link Input} and {@link Textarea} (`showCount`) says.\n * The visible \"12/80\" is digits and a slash and is not translated; these are the words\n * a screen reader gets instead of it.\n */\nexport interface CharacterCountLabels {\n /** The counter as part of the field's description, read when focus reaches the\n * field: \"12 of 80 characters\". */\n count: (used: number, max: number) => string;\n /** Said once, politely, on entering the last stretch before the limit: \"8\n * characters left\". */\n remaining: (left: number) => string;\n /** Said once, politely, on reaching the limit. */\n limitReached: string;\n}\n\n// Defined in ./ui-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_CHARACTER_COUNT_LABELS };\n\n/** The length the browser's own `maxLength` counts — UTF-16 code units — so the counter\n * and the limit can never disagree about whether a field is full. */\nfunction textLength(value: unknown): number {\n return value === undefined || value === null ? 0 : String(value).length;\n}\n\n/** @internal The counter's length: the controlled `value`'s, else what the field has been typed\n * to (from `defaultValue` on). `track` is called from the field's change handler. */\nexport function useTypedLength(value: unknown, defaultValue: unknown) {\n const [typed, setTyped] = useState(() => textLength(defaultValue));\n return { used: value !== undefined ? textLength(value) : typed, track: (text: string) => setTyped(text.length) };\n}\n\ntype CountZone = \"ok\" | \"near\" | \"limit\";\n\n/** The last stretch before the limit: a tenth of it, at least 1 and at most 20 — \"8\n * left\" of 80, and 20 of 2,000 rather than 200, which is not \"near\" in any sense a\n * person typing means. */\nfunction nearLimitAt(max: number): number {\n return Math.min(20, Math.max(1, Math.ceil(max * 0.1)));\n}\n\nfunction countZone(used: number, max: number): CountZone {\n if (used >= max) return \"limit\";\n return max - used <= nearLimitAt(max) ? \"near\" : \"ok\";\n}\n\n/**\n * @internal The live \"12/80\" under a field with `showCount` (keksdose K11: the admin broadcast,\n * support replies, canned replies and the handoff note each counted by hand, and one\n * announced every keystroke).\n *\n * Three channels, each saying only what it should:\n * - the digits, `aria-hidden` — \"12 slash 80\" is not a sentence;\n * - a `hidden` \"12 of 80 characters\" on the field's `aria-describedby`, so the count is\n * read with the field when focus reaches it, and never while typing;\n * - a polite live region that speaks ONCE per stretch: on entering the last tenth\n * (\"8 characters left\") and on reaching the limit. A region that changed on every\n * keystroke would talk over the user's own typing echo for the whole message.\n * Nothing is said on mount: a stored note already near its limit is not news.\n */\nexport function CharacterCount({\n id,\n used,\n max,\n labels,\n caption,\n}: {\n id: string;\n used: number;\n max: number;\n labels: CharacterCountLabels;\n caption: ReactNode;\n}) {\n const zone = countZone(used, max);\n // What the live region holds, re-set only when the stretch changes — the previous\n // render's zone kept in state, the pattern React documents for \"adjusting state when\n // a prop changes\", so the region's text (and so the announcement) changes at most\n // once per crossing.\n const [said, setSaid] = useState<{ zone: CountZone; text: string }>({ zone, text: \"\" });\n if (said.zone !== zone) {\n setSaid({\n zone,\n text: zone === \"near\" ? labels.remaining(max - used) : zone === \"limit\" ? labels.limitReached : \"\",\n });\n }\n return (\n // `relative` holds the sr-only region (see sr-only-containment.test).\n <div className=\"relative mt-1 flex items-start gap-2\">\n <div className=\"min-w-0 flex-1\">{caption}</div>\n <span\n aria-hidden\n className={cn(\n \"shrink-0 text-caption leading-tight tabular-nums\",\n zone === \"limit\" ? \"text-danger\" : zone === \"near\" ? \"text-warning\" : \"text-muted\",\n )}\n >\n {used}/{max}\n </span>\n <span id={id} hidden>\n {labels.count(used, max)}\n </span>\n <span role=\"status\" className=\"sr-only\">\n {said.text}\n </span>\n </div>\n );\n}\n\n/** @internal What goes under a text field: the caption (beside the counter, when there is one),\n * then the error. `null` when there is nothing, so a field with none keeps exactly the\n * DOM it had (see {@link FieldGroup}). */\nexport function fieldBelow(hint: FieldHintParts, counter: ReactNode, errorEl: ReactNode): ReactNode {\n if (counter === null && hint.captionText === undefined && errorEl === null) return null;\n return (\n <>\n {counter ?? <FieldCaption parts={hint} />}\n {errorEl}\n </>\n );\n}\n\n/**\n * @internal kastlan 8: a caller's placeholder on a LABELLED field, shown once the label has\n * floated out of its way — on focus — and transparent until then, while the label sits\n * where the placeholder would be. Without it the field forced `placeholder=\" \"` for the\n * float trick and dropped the caller's text without a word (kastlan's \"note\" field lost\n * its hint). `:placeholder-shown` still drives the float: it matches an empty field\n * whatever the placeholder's text is.\n */\nexport const FLOATING_PLACEHOLDER_ON_FOCUS = \"focus:placeholder:text-placeholder\";\n\n/** @internal A placeholder with something to show. `\"\"` and blanks are the float trick's own\n * `\" \"`, never the caller's hint. */\nexport const hasPlaceholderText = (placeholder: string | undefined): placeholder is string =>\n placeholder !== undefined && placeholder.trim() !== \"\";\n\n/** @internal The counter's words: the `characterCount` namespace — prop > `<UiKitProvider\n * labels>` > English. One place, so the namespace is named once. */\nexport function useCharacterCountLabels(prop: Partial<CharacterCountLabels> | undefined): CharacterCountLabels {\n return useKitLabels(\"characterCount\", DEFAULT_CHARACTER_COUNT_LABELS, prop);\n}\n"],"mappings":";AAyLI,SAgTuC,UAhTvC,KAgMI,YAhMJ;AAzLJ,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAE5B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,gCAAgC,sCAAsC;AA0BxE,MAAM,mBAAmB;AAEzB,MAAM,aACX;AASA,mBACA;AA4BK,MAAM,sBAAsB;AAO5B,MAAM,qBAAqB;AAsB3B,MAAM,gBACX;AAEK,MAAM,uBAAuB,GAAG,YAAY,oBAAoB,mCAAmC;AA6BnG,MAAM,gBACX;AAmBK,MAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACF;AAkBO,SAAS,aAAa,EAAE,WAAW,GAAG,KAAK,GAAsB;AACtE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MAIJ,eAAW;AAAA,MACX,WAAW,GAAG,yFAAyF,SAAS;AAAA;AAAA,EAClH;AAEJ;AAIO,MAAM,oBAAoB;AAM1B,MAAM,YAAY;AAmBlB,SAAS,iBAAiB,EAAE,QAAQ,OAAO,KAAK,GAAsD;AAC3G,MAAI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eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMG;AACD,QAAM,OAAO,UAAU,MAAM,GAAG;AAKhC,QAAM,CAAC,MAAM,OAAO,IAAI,SAA4C,EAAE,MAAM,MAAM,GAAG,CAAC;AACtF,MAAI,KAAK,SAAS,MAAM;AACtB,YAAQ;AAAA,MACN;AAAA,MACA,MAAM,SAAS,SAAS,OAAO,UAAU,MAAM,IAAI,IAAI,SAAS,UAAU,OAAO,eAAe;AAAA,IAClG,CAAC;AAAA,EACH;AACA;AAAA;AAAA,IAEE,qBAAC,SAAI,WAAU,wCACb;AAAA,0BAAC,SAAI,WAAU,kBAAkB,mBAAQ;AAAA,MACzC;AAAA,QAAC;AAAA;AAAA,UACC,eAAW;AAAA,UACX,WAAW;AAAA,YACT;AAAA,YACA,SAAS,UAAU,gBAAgB,SAAS,SAAS,iBAAiB;AAAA,UACxE;AAAA,UAEC;AAAA;AAAA,YAAK;AAAA,YAAE;AAAA;AAAA;AAAA,MACV;AAAA,MACA,oBAAC,UAAK,IAAQ,QAAM,MACjB,iBAAO,MAAM,MAAM,GAAG,GACzB;AAAA,MACA,oBAAC,UAAK,MAAK,UAAS,WAAU,WAC3B,eAAK,MACR;AAAA,OACF;AAAA;AAEJ;AAKO,SAAS,WAAW,MAAsB,SAAoB,SAA+B;AAClG,MAAI,YAAY,QAAQ,KAAK,gBAAgB,UAAa,YAAY,KAAM,QAAO;AACnF,SACE,iCACG;AAAA,eAAW,oBAAC,gBAAa,OAAO,MAAM;AAAA,IACtC;AAAA,KACH;AAEJ;AAUO,MAAM,gCAAgC;AAItC,MAAM,qBAAqB,CAAC,gBACjC,gBAAgB,UAAa,YAAY,KAAK,MAAM;AAI/C,SAAS,wBAAwB,MAAuE;AAC7G,SAAO,aAAa,kBAAkB,gCAAgC,IAAI;AAC5E;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/field-base.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport {\n FieldCaption,\n FLOATING_LABEL_STATIC,\n LABEL_ABOVE_AT_LARGE,\n LABEL_ABOVE_BOX,\n STATIC_LABEL_TYPE,\n type FieldHintParts,\n} from \"./field-parts\";\nimport { DEFAULT_CHARACTER_COUNT_LABELS, DEFAULT_PASSWORD_REVEAL_LABELS } from \"./field-base-labels\";\n\n/**\n * The field base: what Input, Select and Textarea — and every kit field built on the same\n * look — share (0.34, MOD-2, refactor audit 2026-10). The `FIELD_*` classes, the floating\n * label and its `FloatingField` box, `Label`, the chevron, and the words of the password\n * reveal and the character counter. The message under a wrong field is field-parts'\n * `useFieldError`, every field's.\n *\n * Public through the barrel (src/index.ts) by name. `FieldGroup`, the counter and the\n * placeholder helpers are\n * the three fields' shared parts (`@internal`), as are the Select's own classes and its\n * `SelectWidthFloor` (0.51).\n */\n\n/**\n * The 16 px floor on touch (docs/text-size-harmonization.md §10.1). iOS zooms the page\n * when a field under 16 px takes focus, and keksdose's `maximum-scale=1` — which stopped\n * it — goes so pinch zoom works again (WCAG 1.4.4). A zoomed page drops the keyboard\n * inset to 0 (§10.2), so the zoom would put a pinned editor footer behind the keyboard\n * (keksdose #154). So on a coarse pointer a field is at least 16 px, at every text size:\n * `max()` leaves Large and Extra large alone, where `text-sm` is already 17.5 / 21 px.\n *\n * In px on purpose: the threshold is the browser's, in CSS px, whatever the root size.\n * Font size only — the line height keeps `text-sm`'s ratio. Part of {@link FIELD_BASE};\n * add it to any other text-entry control whose type is below 16 px.\n */\nexport const FIELD_TOUCH_TEXT = \"pointer-coarse:text-[length:max(0.875rem,16px)]\";\n\nexport const FIELD_BASE =\n \"block w-full rounded-md border border-subtle bg-surface px-3 py-2 text-sm text-primary shadow-sm placeholder:text-placeholder focus:border-brand \" +\n // The focus line, whole at fractional display scaling (K5 follow-up, keksdose run 78):\n // at 125 % a 1px border covers 1.25 device pixels, and the sides that fall across a\n // pixel boundary read half-strength. A 1px INSET ring in the focus colour beside it\n // doubles the line inward — FIELD_INVALID's border-plus-ring (live #295), and the\n // DatePicker stepper's fix (0.34) — so every side keeps one fully covered device\n // pixel. Inset: nothing outside the field moves or is covered.\n //\n // Under More contrast the ring is 2px, so the line is 3px — what `--focus-ring-width`\n // gives every `FOCUS_RING` there, and what `appearance.contrastHelp` promises (\"thickens\n // focus frames\"); before 0.52 a text field kept its 2px (refactor audit 2026-10-30,\n // DOC-2). Still inset, so nothing moves.\n \"focus:ring-1 contrast:focus:ring-2 focus:ring-inset focus:ring-brand \" +\n // §10.1: at least 16 px on a touch screen, or iOS zooms the page on focus.\n FIELD_TOUCH_TEXT +\n \" \" +\n // A field the user cannot change has to LOOK settled. Without this, `disabled`\n // dimmed the floating label and nothing else — FIELD_BASE's own\n // `text-primary` overrides the browser's grey — so a read-only value\n // sat there at full body-text strength, indistinguishable from one you could retype\n // (Keksdose dev#455/#474).\n \"disabled:cursor-default disabled:bg-surface-2 disabled:text-muted \" +\n // Same for a field that takes focus but refuses keys: `readOnly` is not\n // `disabled`, and a value that cannot be edited should not claim it can be. Opt\n // OUT with {@link FIELD_WRITABLE_LOOK} in the one case where `readOnly` does not\n // mean that — see the two-factor code field, which uses it to block an autofill\n // and drops it the moment you focus the field.\n //\n // ⚠️ The ATTRIBUTE, never the `:read-only` pseudo-class (Keksdose dev#477).\n // `:read-only` does not mean \"was marked readonly\" — per Selectors 4 it matches\n // everything that is not `:read-write`, and only editable inputs/textareas and\n // contenteditable elements are `:read-write`. So `read-only:` matched every\n // `<select>` in the app and every field-styled `<button>` built on this base —\n // the native selects, the date trigger, the entity/currency/multi pickers — and\n // painted them all in the \"you may not edit this\" grey. On one transaction form\n // that made three different-looking families out of one field style: plain\n // inputs, grey selects, grey trigger buttons.\n \"[&[readonly]]:bg-surface-2 [&[readonly]]:text-muted\";\n\n/** Cancels FIELD_BASE's read-only treatment for a field that is `readOnly` for a\n * reason other than \"you may not edit this\". Attribute-scoped for the same reason\n * FIELD_BASE is — the two have to cancel on the identical selector or twMerge\n * cannot make the later one win. */\nexport const FIELD_WRITABLE_LOOK = \"[&[readonly]]:bg-surface [&[readonly]]:text-primary\";\n\n// Extra top padding leaves room for a label that floats INSIDE the field (the\n// \"filled\" pattern) — the label sits in the top strip, the value below it. Used by\n// every labelled field (native + custom-dropdown triggers). twMerge lets pt/pb win\n// over FIELD_BASE's py-2. At Large the label stands above the field (0.33, §10.17,\n// LABEL_ABOVE_AT_LARGE), so the strip goes and the field is FIELD_BASE's `py-2` again.\nexport const FIELD_FLOATING_PAD = \"pt-4 pb-1 large:py-2\";\n\n// Error/required highlight for a field that is missing a value — a `--danger`\n// border and matching focus ring so the control itself shows what's wrong, not just\n// a note beside it (feedback #235). Layered after FIELD_BASE so twMerge wins.\n//\n// The `ring-1` is not decoration; it is what makes the highlight SURVIVE display\n// scaling (Keksdose live #295 — *\"Account select boundary. It is not highlighted on\n// the sides.\"*). At 125%, the browser's usual setting on a 2560px screen, a 1px CSS\n// border is 1.25 device pixels: the horizontal edges land on whole rows and paint\n// solid, while one of the two VERTICAL edges lands across a pixel boundary and is\n// spread over two columns at partial coverage. Measured on the receipt's required\n// account field, dark theme, back when this was a hard-coded rose (full =\n// rgb(208,30,78)): left/top/bottom all 208, right 160 then 115 — the side that is\n// supposed to shout, at 55–77% of the others. A border plus a ring is 2 CSS px, so\n// whatever the fraction there is always one fully covered device pixel on every side\n// (re-measured: worst side 241). It is the GEOMETRY that carries that, not the hue,\n// so the fix survives a consumer re-pointing `--danger-border`.\n//\n// A ring rather than `border-2`: a box-shadow adds no layout, so an invalid field\n// stays exactly the size of a valid one and nothing beside it moves when the value\n// arrives. Under More contrast the ring is 2px, as FIELD_BASE's focus line (0.52, DOC-2).\nexport const FIELD_INVALID =\n \"border-danger-strong ring-1 contrast:ring-2 ring-danger-strong focus:border-[var(--danger)] focus:ring-[var(--danger)]\";\n\nexport const FLOATING_INPUT_CLASS = cn(FIELD_BASE, FIELD_FLOATING_PAD, \"peer placeholder:text-transparent\");\n\n/**\n * The PHONE display treatment (Keksdose feedback #176, carried across the entry\n * forms by #179): the field chrome removed so the ONE input a form is actually\n * about reads as the thing itself, not as another boxed row in a stack.\n *\n * Every control that takes `variant=\"display\"` — {@link Input}, `NumberInput`,\n * `AmountInput` — means exactly the same thing by it: the treatment applies in the\n * phone layout (`usePhoneLayout()`, `max-md:` at the text size in force) and the field\n * is untouched above it, so a caller never has\n * to ask the viewport, and a form can't end up half-treated across breakpoints.\n *\n * What stays, deliberately:\n * - A hairline baseline. With the box gone something still has to say \"you can\n * type here\"; it takes the brand colour on focus, where a bordered field would\n * light its whole outline. Each edge is set exactly once (`border-x-0\n * border-t-0 border-b`) so the rule can't hinge on utility order. On focus the\n * line is doubled inward by an inset shadow on that edge alone — FIELD_BASE's\n * inset ring, for the same reason (K5 follow-up: a 1px line reads half-strength at\n * 125 %) — where a ring would draw a box round the figure.\n * - The muted placeholder colour, because a display field is usually empty at\n * the moment it matters most and has nothing else to show.\n * - The label, moved to `sr-only` rather than dropped: display type is legible\n * to the eye, not to a screen reader.\n *\n * Size and weight are NOT here — an amount wants display type, a subject line\n * wants a heading — so each control adds its own on top.\n */\nexport const FIELD_DISPLAY =\n \"block w-full border-x-0 border-t-0 border-b border-subtle bg-transparent px-0 pt-0 pb-1 text-primary shadow-none placeholder:text-placeholder focus:border-brand focus:shadow-[inset_0_-1px_0_var(--brand)] focus:outline-none focus:ring-0 disabled:opacity-60\";\n\n// A field-styled button trigger for the custom dropdown controls (MultiSelect,\n// CurrencySelect) — the field look (border/bg) as a flex row for the value + chevron,\n// so they don't hand-copy the field classes. Add FIELD_FLOATING_PAD only when the\n// trigger carries a label (unlabelled triggers stay normal height to match buttons /\n// adjacent controls). Pair the labelled case with a static FieldLabel.\n// `relative` so the trigger can host an absolutely-centred FieldChevron / clear\n// button the way the native Select does.\n//\n// `[&>:first-child]:min-h-[1lh]` holds one line box open whatever the value is. A\n// trigger with nothing chosen and no placeholder renders an EMPTY value span, an\n// empty span has no line box, and the trigger collapsed to its padding — 18px\n// tall in a stack of 38px fields (an RhfCombobox without a placeholder; DatePicker\n// and MonthPicker had met the same thing as Keksdose live #294 and patched their\n// own span with a U+00A0). Here, on the shared class, it covers every trigger\n// built on it, including a `renderTrigger` one. `1lh` rather than a fixed height\n// so it tracks whatever type the trigger is set in; the first child is the value\n// in every trigger here (the chevron and the clear button are absolute).\nexport const FIELD_TRIGGER = cn(\n FIELD_BASE,\n \"relative flex items-center justify-between gap-2 text-start hover:bg-hover\",\n \"[&>:first-child]:min-h-[1lh]\",\n);\n\n/** An alias rather than an interface: the chevron adds nothing of its own to an\n * `<svg>`'s props, and an interface declaring no members is the same type wearing a\n * name that suggests otherwise. */\nexport type FieldChevronProps = Omit<ComponentPropsWithRef<\"svg\">, \"children\">;\n\n/** The dropdown chevron, shared by the native {@link Select} and every custom\n * {@link FIELD_TRIGGER} control.\n *\n * Absolutely positioned and centred on the FIELD box. As an ordinary flex child\n * it centres on the *content* box instead, and `FIELD_FLOATING_PAD` (pt-4 pb-1)\n * pushes that box's midline down — so a labelled currency/multi-select chevron\n * sat visibly lower than the native select's right beside it (feedback #400).\n * Pair it with `pe-9` on the trigger so the value can't run underneath. At the\n * inline END, not the right: a right-to-left form reads the value from the right,\n * and a chevron parked on top of its first word hid exactly the part that says\n * what was picked. */\nexport function FieldChevron({ className, ...rest }: FieldChevronProps) {\n return (\n <ChevronDown\n {...rest}\n // After the spread: the chevron is decoration beside a control that already has\n // a name, and an `aria-hidden` a caller could switch off by accident is a second\n // announcement of the same field.\n aria-hidden\n className={cn(\"pointer-events-none absolute end-2.5 top-1/2 size-4 -translate-y-1/2 text-placeholder\", className)}\n />\n );\n}\n\n/** A native dropdown Select's dress: no native arrow, and `pe-9`, the room the\n * {@link FieldChevron} takes. Shared with {@link SelectWidthFloor}. `@internal` */\nexport const SELECT_MENU_DRESS = \"appearance-none pe-9\";\n\n/** The compact Select (`size=\"sm\"`): the field's colours, a toolbar button's height.\n * `py-0` and a fixed height rather than a smaller padding, so the box is 28px whatever\n * line height the caller's type brings with it. Shared with {@link SelectWidthFloor}.\n * `@internal` */\nexport const SELECT_SM = \"h-7 py-0 ps-2 pe-7 text-xs\";\n\n/**\n * The width an UNLABELLED Select needs to show the widest of `values` whole: an invisible,\n * zero-height line under it, in the select's own type, padding, chevron room and border\n * (the same classes), one value per line. Placed beside the Select in the box that sizes\n * it, it holds that box to the widest value, and the `w-full` select fills it. `@internal`\n *\n * Why it takes a sizer (0.51, Kurvenschmiede N5). A `<select>` with a percentage width\n * is a \"compressible\" element: its min-content contribution is ZERO (CSS Sizing 3\n * §5.2.2), so the auto table layout squeezes its column to the header, and beside a\n * `grow` column every other column IS squeezed to its min-content (data-table-fit.ts).\n * The user roster's role select stood 92px and read \"Meml…\" and \"Admi…\" (KS review,\n * 0.49 and 0.50). `min-width: max-content` on the select would hold it instead — but to\n * its widest OPTION, and an unavailable role's option carries its reason (\"Customer (owns\n * work)\", RoleSelect's `optionDisabledReason`): the column would widen for a text that is\n * never the selected value. So the caller says which values can be selected, in the\n * current language.\n */\nexport function SelectWidthFloor({ values, size = \"md\" }: { values: readonly string[]; size?: \"sm\" | \"md\" }) {\n if (values.length === 0) return null;\n return (\n <span\n aria-hidden\n data-select-floor=\"\"\n className={cn(\n FIELD_BASE,\n SELECT_MENU_DRESS,\n size === \"sm\" && SELECT_SM,\n // The horizontal box only: no height, no vertical padding or border, not painted.\n \"invisible h-0 overflow-hidden border-y-0 py-0 whitespace-nowrap shadow-none\",\n )}\n >\n {values.map((value, i) => (\n // The value as generated content, not as text: it is laid out (and so measured)\n // the same, but a test's `getByText(\"Member\")` still finds the one option, and a\n // find-in-page or a copied row does not meet a word nobody sees.\n <span key={i} data-value={value} className=\"block before:content-[attr(data-value)]\" />\n ))}\n </span>\n );\n}\n\n// Animated label that starts centred (as a placeholder) in an empty field and\n// floats up INSIDE the top strip on focus or once the field has a value. Sits on\n// the field's own surface, so no background chip and nothing to mismatch the card.\n//\n// At Large it is a static label ABOVE the field instead (0.33, §10.17): in flow, so it\n// wraps; always in its floated look, since there is no strip to float into and no\n// placeholder to stand in for; no transition, since it never moves.\nconst LABEL_FLOATED_AT_LARGE = \"large:text-caption large:leading-tight large:text-secondary large:transition-none\";\n\nexport const FLOATING_LABEL_CLASS = cn(\n \"pointer-events-none absolute start-3 top-2.5 text-sm text-placeholder transition-all\",\n \"max-w-[calc(100%-1.5rem)] truncate-until-large\",\n \"peer-focus:top-1 peer-focus:text-caption peer-focus:leading-tight peer-focus:text-secondary\",\n \"peer-[:not(:placeholder-shown)]:top-1 peer-[:not(:placeholder-shown)]:text-caption peer-[:not(:placeholder-shown)]:leading-tight peer-[:not(:placeholder-shown)]:text-secondary\",\n \"peer-disabled:opacity-50\",\n LABEL_ABOVE_AT_LARGE,\n \"large:block\",\n LABEL_FLOATED_AT_LARGE,\n);\n\n// The animated label again, as a ROW that the label and its \"?\" share — same\n// placement, same float, same type, but with the type on the row so the label\n// INHERITS it. It has to be that way round: `peer-focus:` compiles to a sibling\n// selector, so the classes have to sit on the element that is actually a sibling\n// of the input, and a label nested inside a wrapper is not one.\n//\n// Wider end clearance than the label alone takes (`3rem` rather than `1.5rem`),\n// because the controls that carry an animated label are the ones with something\n// at the end edge of the field — NumberInput's calculator is the case this was\n// written for. The label truncates a little sooner; the alternative was the \"?\"\n// sitting on top of a button (steering-design feedback #48). At Large the row stands\n// above the field, as the label alone does, and nothing at the end edge is under it.\nconst FLOATING_ROW_CLASS = cn(\n \"pointer-events-none absolute start-3 top-2.5 flex items-center gap-1 transition-all\",\n \"max-w-[calc(100%-3rem)] text-sm text-placeholder\",\n \"peer-focus:top-1 peer-focus:text-caption peer-focus:leading-tight peer-focus:text-secondary\",\n \"peer-[:not(:placeholder-shown)]:top-1 peer-[:not(:placeholder-shown)]:text-caption peer-[:not(:placeholder-shown)]:leading-tight peer-[:not(:placeholder-shown)]:text-secondary\",\n \"peer-disabled:opacity-50\",\n LABEL_ABOVE_AT_LARGE,\n LABEL_FLOATED_AT_LARGE,\n);\n\n/** The static label's row with its \"?\" at the field's end, in the top strip — and at\n * Large above the field (LABEL_ABOVE_AT_LARGE). */\nconst STATIC_ROW_CLASS = cn(\n \"pointer-events-none absolute inset-x-3 top-1 flex items-center gap-1\",\n LABEL_ABOVE_AT_LARGE,\n);\n\n/**\n * The one place that assembles a labelled field: a `relative` wrapper around the\n * control (`children`) plus a floating label inside the top strip. Pass `staticLabel`\n * for controls that always have a value (selects); omit it for free-text fields whose\n * label animates from centred→up. Used by Input/Select/Textarea/NumberInput; the\n * dropdown controls that need a ref + menu keep their own wrapper but the same label\n * (via {@link FieldLabel}) and trigger ({@link FIELD_TRIGGER}) styles.\n */\nexport interface FloatingFieldProps extends ComponentPropsWithRef<\"div\"> {\n htmlFor?: string;\n label?: ReactNode;\n staticLabel?: boolean;\n /** Keep the label in the accessibility tree but out of the layout — what\n * {@link FIELD_DISPLAY} needs, since a floating label inside a field with no\n * field left would have nothing to float in. */\n srOnlyLabel?: boolean;\n /** Something interactive that belongs to the LABEL rather than to the value —\n * in practice a {@link FieldHint} \"?\" (dev#468). It is rendered in a flex row\n * with the label, so it is centred on the label's line by the layout instead\n * of by a hand-tuned `top-…`, and it can never drift when the type changes.\n *\n * It rides an ANIMATED label too, and the two cases place it differently on\n * purpose. A static label has a field-wide strip to itself, so the hint sits\n * at the far end of it and a long label truncates into the gap. An animated\n * one belongs to a control with something at the end edge of the field — a\n * calculator, a stepper — so the hint follows the label instead, and it is\n * the label that gives way (steering-design feedback #48). */\n hint?: ReactNode;\n children: ReactNode;\n}\n\nexport function FloatingField({\n className,\n htmlFor,\n label,\n staticLabel,\n srOnlyLabel,\n hint,\n children,\n ...rest\n}: FloatingFieldProps) {\n const withHint = hint !== undefined && !srOnlyLabel;\n const atEnd = withHint && staticLabel;\n // A label drawn over the field: at Large it stands above it instead (0.33, §10.17),\n // in the first row of this box (LABEL_ABOVE_BOX), though it FOLLOWS the control in\n // the DOM — `peer-*` reads the input before it.\n const above = label !== undefined && !srOnlyLabel;\n const labelEl = label !== undefined && (\n <label\n htmlFor={htmlFor}\n // In the first row at Large, out of LABEL_ABOVE_BOX's rule for the field's parts.\n data-field-label={above && !withHint ? \"\" : undefined}\n className={\n srOnlyLabel\n ? \"sr-only\"\n : atEnd\n ? cn(\"pointer-events-none min-w-0 truncate-until-large\", STATIC_LABEL_TYPE)\n : withHint\n ? \"pointer-events-none min-w-0 truncate-until-large\"\n : staticLabel\n ? FLOATING_LABEL_STATIC\n : FLOATING_LABEL_CLASS\n }\n >\n {label}\n </label>\n );\n return (\n // `relative` is the whole contract of this wrapper — the floating label and every\n // control that hangs off it (a reveal toggle, a chevron) are positioned against\n // this box — so it is merged through `cn` after the spread rather than left where\n // a caller's stray `className` or `style` could unset it. At Large, with a label\n // above, a grid: the label's row over the field's, the field's parts in the latter.\n <div {...rest} className={cn(\"relative\", above && LABEL_ABOVE_BOX, className)}>\n {children}\n {withHint ? (\n // Static: `inset-x-3` rather than `start-3`, so a long label truncates at\n // the field's own end padding instead of running under the chevron.\n // Animated: the row floats with the label and is only as wide as it needs\n // to be. Either way the hint keeps its width (`shrink-0`) and the label\n // is the one that gives way.\n <div data-field-label=\"\" className={atEnd ? STATIC_ROW_CLASS : FLOATING_ROW_CLASS}>\n {labelEl}\n <span className=\"pointer-events-auto flex shrink-0 items-center\">{hint}</span>\n </div>\n ) : (\n labelEl\n )}\n </div>\n );\n}\n\nexport interface LabelProps extends ComponentPropsWithRef<\"label\"> {\n /** Draw the required mark after the text. The mark is `aria-hidden`: what a\n * screen reader hears is the control's own `required` / `aria-required`, which\n * the caller still sets — a \"star\" read out as the last word of every name is\n * noise, and a control that is not marked required is not required however its\n * label looks. */\n required?: boolean;\n /** `sm` for a toolbar or a dense filter row (12px), `md` otherwise (14px). */\n size?: \"sm\" | \"md\";\n /** Dim the label with its control. A label ABOVE its field is not the field's\n * `peer`, so `peer-disabled:` cannot reach it the way it reaches a floating one. */\n disabled?: boolean;\n}\n\n/**\n * The label ABOVE a field, for the places a floating label does not fit: a control\n * the kit did not render (a third-party picker, a range slider, a group of radios),\n * a filter bar whose fields are unlabelled {@link Select}s, a form that sets labels\n * above its fields throughout.\n *\n * A new component rather than a mode of {@link FieldLabel}, because the two share\n * nothing but the word. `FieldLabel` is an absolutely positioned `<span>` inside a\n * trigger's `relative` box and has to stay exactly that for every dropdown that\n * already lines up with it; this is a real `<label>` in normal flow, with `htmlFor`,\n * that a click focuses the control through. Spacing below it belongs to the caller's\n * layout (`space-y-1.5` on the pair, typically), as it would for any block.\n */\nexport function Label({ required, size = \"md\", disabled, className, children, ...rest }: LabelProps) {\n return (\n <label\n {...rest}\n className={cn(\n \"inline-flex items-center gap-0.5 font-medium leading-none text-primary\",\n size === \"sm\" ? \"text-xs\" : \"text-sm\",\n disabled && \"cursor-default opacity-50\",\n className,\n )}\n >\n {children}\n {required && (\n <span aria-hidden className=\"text-danger\">\n *\n </span>\n )}\n </label>\n );\n}\n\n// The message under a field that is wrong, and the wiring that attaches it — `useFieldError`\n// — lives in field-parts since 0.34, every field's (DUP-8, refactor audit 2026-10).\n\n/**\n * @internal A field and its message as one box.\n *\n * The message cannot go INSIDE the field's own `relative` box. The password reveal\n * toggle is `inset-y-0` and the select chevron is `top-1/2`, so both centre on\n * whatever that box contains — put two lines of message in it and the chevron drifts\n * down out of the field, between the value and the text. So the field keeps its box\n * and this wraps the pair.\n *\n * WHEN IT WRAPS. A field that never takes `error` renders nothing of its own here,\n * which is what keeps the prop additive: it is exactly the DOM it was before the prop\n * existed, down to the bare `<input>` an unlabelled {@link Input} drops straight into a\n * caller's flex row. A field that DOES take `error` — the key is passed, whatever its\n * value — is wrapped for as long as it is mounted, message or not (`reserve`).\n *\n * It used to wrap only while a message showed, and that cost the control its\n * identity: a fragment and a `<div>` are different elements at the same spot in the\n * tree, so React threw the `<input>` away and mounted a new one every time the message\n * came or went. Focus fell to `<body>`, the caret went with it, and an uncontrolled\n * field lost what had been typed — Kurvenschmiede's confirm-password dialog clears its\n * \"Wrong password\" on change, so the first keystroke of the retry dropped the user out\n * of the field. Keeping the box stops that; the field is never reparented.\n *\n * The other ways to keep it stable were worse. A box on EVERY field changes what every\n * flex row and grid in three apps lays out (`flex-1`, `w-56`, `col-span-2` on the\n * field would land on a child of the item instead of the item). A `display: contents`\n * box would keep the flex/grid item, but a contents box takes no margin, so a parent's\n * `space-y-*` stops spacing the field — the shape of Kurvenschmiede's reset-password\n * form and gear wizard, both `space-y-*` stacks of fields with `error` — and it moves\n * `first:`/`last:`/`> *` matches. A field passing `error` already took this plain box\n * whenever its message showed, so what changes is only that it keeps it while none\n * does; every such call site in the three apps sits in a block or a `space-y`/grid\n * stack where a full-width block box is the field's own size. The case it does change\n * is a field passing `error` whose `className` sizes it as a flex item (`flex-1` in a\n * row): that caller already lost the sizing while a message showed, and now sees the\n * same box without one. Pass `error` only where a message can actually appear.\n *\n * `className` is NOT moved out here, for the same reason — it goes on the field, as it\n * always has, so the box cannot silently change what that prop styles.\n */\nexport function FieldGroup({\n errorEl,\n reserve = false,\n children,\n}: {\n errorEl: ReactNode;\n /** The caller passed `error`: keep the box even while there is no message. */\n reserve?: boolean;\n children: ReactNode;\n}) {\n if (errorEl === null && !reserve) return <>{children}</>;\n return (\n <div>\n {children}\n {errorEl}\n </div>\n );\n}\n\n/** The two names the password reveal toggle can wear. See {@link Input}. */\nexport interface PasswordRevealLabels {\n /** While the value is hidden — activating the toggle will show it. */\n show: string;\n /** While the value is shown. */\n hide: string;\n}\n\n// Defined in ./field-base-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_PASSWORD_REVEAL_LABELS };\n\n/**\n * What the character counter of {@link Input} and {@link Textarea} (`showCount`) says.\n * The visible \"12/80\" is digits and a slash and is not translated; these are the words\n * a screen reader gets instead of it.\n */\nexport interface CharacterCountLabels {\n /** The counter as part of the field's description, read when focus reaches the\n * field: \"12 of 80 characters\". */\n count: (used: number, max: number) => string;\n /** Said once, politely, on entering the last stretch before the limit: \"8\n * characters left\". */\n remaining: (left: number) => string;\n /** Said once, politely, on reaching the limit. */\n limitReached: string;\n}\n\n// Defined in ./field-base-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_CHARACTER_COUNT_LABELS };\n\n/** The length the browser's own `maxLength` counts — UTF-16 code units — so the counter\n * and the limit can never disagree about whether a field is full. */\nfunction textLength(value: unknown): number {\n return value === undefined || value === null ? 0 : String(value).length;\n}\n\n/** @internal The counter's length: the controlled `value`'s, else what the field has been typed\n * to (from `defaultValue` on). `track` is called from the field's change handler. */\nexport function useTypedLength(value: unknown, defaultValue: unknown) {\n const [typed, setTyped] = useState(() => textLength(defaultValue));\n return { used: value !== undefined ? textLength(value) : typed, track: (text: string) => setTyped(text.length) };\n}\n\ntype CountZone = \"ok\" | \"near\" | \"limit\";\n\n/** The last stretch before the limit: a tenth of it, at least 1 and at most 20 — \"8\n * left\" of 80, and 20 of 2,000 rather than 200, which is not \"near\" in any sense a\n * person typing means. */\nfunction nearLimitAt(max: number): number {\n return Math.min(20, Math.max(1, Math.ceil(max * 0.1)));\n}\n\nfunction countZone(used: number, max: number): CountZone {\n if (used >= max) return \"limit\";\n return max - used <= nearLimitAt(max) ? \"near\" : \"ok\";\n}\n\n/**\n * @internal The live \"12/80\" under a field with `showCount` (keksdose K11: the admin broadcast,\n * support replies, canned replies and the handoff note each counted by hand, and one\n * announced every keystroke).\n *\n * Three channels, each saying only what it should:\n * - the digits, `aria-hidden` — \"12 slash 80\" is not a sentence;\n * - a `hidden` \"12 of 80 characters\" on the field's `aria-describedby`, so the count is\n * read with the field when focus reaches it, and never while typing;\n * - a polite live region that speaks ONCE per stretch: on entering the last tenth\n * (\"8 characters left\") and on reaching the limit. A region that changed on every\n * keystroke would talk over the user's own typing echo for the whole message.\n * Nothing is said on mount: a stored note already near its limit is not news.\n */\nexport function CharacterCount({\n id,\n used,\n max,\n labels,\n caption,\n}: {\n id: string;\n used: number;\n max: number;\n labels: CharacterCountLabels;\n caption: ReactNode;\n}) {\n const zone = countZone(used, max);\n // What the live region holds, re-set only when the stretch changes — the previous\n // render's zone kept in state, the pattern React documents for \"adjusting state when\n // a prop changes\", so the region's text (and so the announcement) changes at most\n // once per crossing.\n const [said, setSaid] = useState<{ zone: CountZone; text: string }>({ zone, text: \"\" });\n if (said.zone !== zone) {\n setSaid({\n zone,\n text: zone === \"near\" ? labels.remaining(max - used) : zone === \"limit\" ? labels.limitReached : \"\",\n });\n }\n return (\n // `relative` holds the sr-only region (see sr-only-containment.test).\n <div className=\"relative mt-1 flex items-start gap-2\">\n <div className=\"min-w-0 flex-1\">{caption}</div>\n <span\n aria-hidden\n className={cn(\n \"shrink-0 text-caption leading-tight tabular-nums\",\n zone === \"limit\" ? \"text-danger\" : zone === \"near\" ? \"text-warning\" : \"text-muted\",\n )}\n >\n {used}/{max}\n </span>\n <span id={id} hidden>\n {labels.count(used, max)}\n </span>\n <span role=\"status\" className=\"sr-only\">\n {said.text}\n </span>\n </div>\n );\n}\n\n/** @internal What goes under a text field: the caption (beside the counter, when there is one),\n * then the error. `null` when there is nothing, so a field with none keeps exactly the\n * DOM it had (see {@link FieldGroup}). */\nexport function fieldBelow(hint: FieldHintParts, counter: ReactNode, errorEl: ReactNode): ReactNode {\n if (counter === null && hint.captionText === undefined && errorEl === null) return null;\n return (\n <>\n {counter ?? <FieldCaption parts={hint} />}\n {errorEl}\n </>\n );\n}\n\n/**\n * @internal kastlan 8: a caller's placeholder on a LABELLED field, shown once the label has\n * floated out of its way — on focus — and transparent until then, while the label sits\n * where the placeholder would be. Without it the field forced `placeholder=\" \"` for the\n * float trick and dropped the caller's text without a word (kastlan's \"note\" field lost\n * its hint). `:placeholder-shown` still drives the float: it matches an empty field\n * whatever the placeholder's text is.\n */\nexport const FLOATING_PLACEHOLDER_ON_FOCUS = \"focus:placeholder:text-placeholder\";\n\n/** @internal A placeholder with something to show. `\"\"` and blanks are the float trick's own\n * `\" \"`, never the caller's hint. */\nexport const hasPlaceholderText = (placeholder: string | undefined): placeholder is string =>\n placeholder !== undefined && placeholder.trim() !== \"\";\n\n/** @internal The counter's words: the `characterCount` namespace — prop > `<UiKitProvider\n * labels>` > English. One place, so the namespace is named once. */\nexport function useCharacterCountLabels(prop: Partial<CharacterCountLabels> | undefined): CharacterCountLabels {\n return useKitLabels(\"characterCount\", DEFAULT_CHARACTER_COUNT_LABELS, prop);\n}\n"],"mappings":";AA+LI,SAgTuC,UAhTvC,KAgMI,YAhMJ;AA/LJ,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAE5B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,gCAAgC,sCAAsC;AA2BxE,MAAM,mBAAmB;AAEzB,MAAM,aACX;AAcA,mBACA;AA4BK,MAAM,sBAAsB;AAO5B,MAAM,qBAAqB;AAsB3B,MAAM,gBACX;AAEK,MAAM,uBAAuB,GAAG,YAAY,oBAAoB,mCAAmC;AA6BnG,MAAM,gBACX;AAmBK,MAAM,gBAAgB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AACF;AAkBO,SAAS,aAAa,EAAE,WAAW,GAAG,KAAK,GAAsB;AACtE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MAIJ,eAAW;AAAA,MACX,WAAW,GAAG,yFAAyF,SAAS;AAAA;AAAA,EAClH;AAEJ;AAIO,MAAM,oBAAoB;AAM1B,MAAM,YAAY;AAmBlB,SAAS,iBAAiB,EAAE,QAAQ,OAAO,KAAK,GAAsD;AAC3G,MAAI,OAAO,WAAW,EAAG,QAAO;AAChC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,MACX,qBAAkB;AAAA,MAClB,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,SAAS,QAAQ;AAAA;AAAA,QAEjB;AAAA,MACF;A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tF,MAAI,KAAK,SAAS,MAAM;AACtB,YAAQ;AAAA,MACN;AAAA,MACA,MAAM,SAAS,SAAS,OAAO,UAAU,MAAM,IAAI,IAAI,SAAS,UAAU,OAAO,eAAe;AAAA,IAClG,CAAC;AAAA,EACH;AACA;AAAA;AAAA,IAEE,qBAAC,SAAI,WAAU,wCACb;AAAA,0BAAC,SAAI,WAAU,kBAAkB,mBAAQ;AAAA,MACzC;AAAA,QAAC;AAAA;AAAA,UACC,eAAW;AAAA,UACX,WAAW;AAAA,YACT;AAAA,YACA,SAAS,UAAU,gBAAgB,SAAS,SAAS,iBAAiB;AAAA,UACxE;AAAA,UAEC;AAAA;AAAA,YAAK;AAAA,YAAE;AAAA;AAAA;AAAA,MACV;AAAA,MACA,oBAAC,UAAK,IAAQ,QAAM,MACjB,iBAAO,MAAM,MAAM,GAAG,GACzB;AAAA,MACA,oBAAC,UAAK,MAAK,UAAS,WAAU,WAC3B,eAAK,MACR;AAAA,OACF;AAAA;AAEJ;AAKO,SAAS,WAAW,MAAsB,SAAoB,SAA+B;AAClG,MAAI,YAAY,QAAQ,KAAK,gBAAgB,UAAa,YAAY,KAAM,QAAO;AACnF,SACE,iCACG;AAAA,eAAW,oBAAC,gBAAa,OAAO,MAAM;AAAA,IACtC;AAAA,KACH;AAEJ;AAUO,MAAM,gCAAgC;AAItC,MAAM,qBAAqB,CAAC,gBACjC,gBAAgB,UAAa,YAAY,KAAK,MAAM;AAI/C,SAAS,wBAAwB,MAAuE;AAC7G,SAAO,aAAa,kBAAkB,gCAAgC,IAAI;AAC5E;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/field-sync-labels.ts"],"sourcesContent":["// The English words of ./field-sync, in a module with no component code: the English\n// catalogue (src/i18n/defaults.ts) imports them without the component, so `en` loads as one\n// chunk like the other languages (0.34, KS U8). ./field-sync re-exports them.\n\nimport type { FieldSyncLabels } from \"./field-sync\";\n\nexport const DEFAULT_FIELD_SYNC_LABELS: FieldSyncLabels = {\n synced: \"Saved\",\n edited: \"Unsaved changes\",\n pending: \"Saving…\",\n error: \"Could not save\",\n retry: \"Retry\",\n};\n"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../src/components/field-sync-labels.ts"],"sourcesContent":["// The English words of ./field-sync, in a module with no component code: the English\n// catalogue (src/i18n/defaults.ts) imports them without the component, so `en` loads as one\n// chunk like the other languages (0.34, KS U8). ./field-sync re-exports them.\n\nimport type { FieldSyncLabels } from \"./field-sync\";\n\n/** @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */\nexport const DEFAULT_FIELD_SYNC_LABELS: FieldSyncLabels = {\n synced: \"Saved\",\n edited: \"Unsaved changes\",\n pending: \"Saving…\",\n error: \"Could not save\",\n retry: \"Retry\",\n};\n"],"mappings":";AAOO,MAAM,4BAA6C;AAAA,EACxD,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AACT;","names":[]}
|
|
@@ -16,8 +16,16 @@ import { DEFAULT_FIELD_SYNC_LABELS } from "./field-sync-labels.js";
|
|
|
16
16
|
* because the state is useful without the dot — a form can disable its submit
|
|
17
17
|
* button while any field is `pending`, and a router can block navigation while
|
|
18
18
|
* any field is `edited`.
|
|
19
|
+
*
|
|
20
|
+
* Deprecated in 0.52 as a whole, removed in 0.53 (decision 4 of the refactor audit
|
|
21
|
+
* 2026-10-30, MOD-5): no app renders it or calls the hook — 483 lines and a namespace in
|
|
22
|
+
* seven catalogues that only this package's tests and showcase read. An app that wants
|
|
23
|
+
* it keeps a copy of this file.
|
|
24
|
+
*
|
|
25
|
+
* @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53.
|
|
19
26
|
*/
|
|
20
27
|
export type FieldSyncState = "synced" | "edited" | "pending" | "error";
|
|
28
|
+
/** @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */
|
|
21
29
|
export interface FieldSyncLabels {
|
|
22
30
|
synced: string;
|
|
23
31
|
edited: string;
|
|
@@ -27,6 +35,7 @@ export interface FieldSyncLabels {
|
|
|
27
35
|
retry: string;
|
|
28
36
|
}
|
|
29
37
|
export { DEFAULT_FIELD_SYNC_LABELS };
|
|
38
|
+
/** @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */
|
|
30
39
|
export interface UseFieldSyncOptions<T> {
|
|
31
40
|
/** What the database currently holds. Changing it re-seeds a CLEAN field. */
|
|
32
41
|
value: T;
|
|
@@ -45,6 +54,7 @@ export interface UseFieldSyncOptions<T> {
|
|
|
45
54
|
/** Called once per rejected save, with whatever `onSave` threw. */
|
|
46
55
|
onError?: (error: Error) => void;
|
|
47
56
|
}
|
|
57
|
+
/** @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */
|
|
48
58
|
export interface UseFieldSyncReturn<T> {
|
|
49
59
|
/** The draft — bind this to the input, not the `value` option. */
|
|
50
60
|
value: T;
|
|
@@ -78,8 +88,11 @@ export interface UseFieldSyncReturn<T> {
|
|
|
78
88
|
* may be gone — a row scrolled out of a virtualised table, a closed dialog.
|
|
79
89
|
* 4. **`onSave` is read through a ref**, so an inline arrow — which every call
|
|
80
90
|
* site will pass — does not restart the debounce on every render.
|
|
91
|
+
*
|
|
92
|
+
* @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53.
|
|
81
93
|
*/
|
|
82
94
|
export declare function useFieldSync<T>({ value, onSave, debounceMs, equals, onError, }: UseFieldSyncOptions<T>): UseFieldSyncReturn<T>;
|
|
95
|
+
/** @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */
|
|
83
96
|
export interface FieldSyncIndicatorProps {
|
|
84
97
|
state: FieldSyncState;
|
|
85
98
|
/** The failure. Its message becomes the tooltip when `state === "error"`. */
|
|
@@ -108,6 +121,8 @@ export interface FieldSyncIndicatorProps {
|
|
|
108
121
|
* The state is also announced: the wrapper is a polite live region, so a screen
|
|
109
122
|
* reader hears "Saving…" then "Saved" without the user going looking. `error` is
|
|
110
123
|
* assertive instead — a failed write is worth interrupting for.
|
|
124
|
+
*
|
|
125
|
+
* @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53.
|
|
111
126
|
*/
|
|
112
127
|
export declare function FieldSyncIndicator({ state, error, labels, showLabel, onRetry, className, }: FieldSyncIndicatorProps): import("react").JSX.Element;
|
|
113
128
|
/**
|
|
@@ -126,10 +141,15 @@ export declare function FieldSyncIndicator({ state, error, labels, showLabel, on
|
|
|
126
141
|
* colour does not.
|
|
127
142
|
*
|
|
128
143
|
* Every class is a literal so Tailwind's scanner can see it.
|
|
144
|
+
*
|
|
145
|
+
* @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53.
|
|
129
146
|
*/
|
|
130
147
|
export declare const FIELD_SYNC_FRAME: Record<FieldSyncState, string>;
|
|
131
|
-
/** How long the green "saved" frame and check stay after a save lands, in ms.
|
|
148
|
+
/** How long the green "saved" frame and check stay after a save lands, in ms.
|
|
149
|
+
*
|
|
150
|
+
* @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */
|
|
132
151
|
export declare const FIELD_SYNC_SAVED_MS = 1500;
|
|
152
|
+
/** @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53. */
|
|
133
153
|
export interface FieldSyncRowProps<T> extends Omit<FieldSyncIndicatorProps, "state" | "error" | "showLabel"> {
|
|
134
154
|
sync: UseFieldSyncReturn<T>;
|
|
135
155
|
children: ReactNode;
|
|
@@ -160,5 +180,7 @@ export interface FieldSyncRowProps<T> extends Omit<FieldSyncIndicatorProps, "sta
|
|
|
160
180
|
* always in the DOM as a live region — polite for the ordinary states, assertive for
|
|
161
181
|
* a failure. The input gets end padding for the icon whether or not one is showing,
|
|
162
182
|
* so the text never reflows when the state changes.
|
|
183
|
+
*
|
|
184
|
+
* @deprecated 0.52 — none: no app uses the FieldSync family (MOD-5); removed in 0.53.
|
|
163
185
|
*/
|
|
164
186
|
export declare function FieldSyncRow<T>({ sync, children, className, labels, onRetry, saveOnBlur, savedMs, }: FieldSyncRowProps<T>): import("react").JSX.Element;
|