@eifi1/ui-kit 0.51.3 → 0.51.5
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 +6 -6
- package/dist/account/account-settings-labels.js.map +1 -1
- package/dist/account/account-settings.js +11 -9
- package/dist/account/account-settings.js.map +1 -1
- package/dist/account/delete-account-setting.js +56 -65
- package/dist/account/delete-account-setting.js.map +1 -1
- package/dist/account/email-change-setting-labels.js.map +1 -1
- package/dist/account/email-change-setting.js.map +1 -1
- package/dist/account/passkeys-setting.js.map +1 -1
- 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-action-log.js.map +1 -1
- package/dist/admin/admin-area-labels.js +4 -1
- package/dist/admin/admin-area-labels.js.map +1 -1
- package/dist/admin/admin-overview.js +19 -11
- package/dist/admin/admin-overview.js.map +1 -1
- package/dist/admin/admin-sections.js.map +1 -1
- package/dist/admin/admin-tool-links.d.ts +1 -1
- package/dist/admin/admin-tool-links.js +7 -1
- package/dist/admin/admin-tool-links.js.map +1 -1
- package/dist/admin/invitations-panel.js +2 -13
- package/dist/admin/invitations-panel.js.map +1 -1
- package/dist/admin/mail-test-card.js.map +1 -1
- package/dist/admin/reviewer-scope-editor.js +4 -11
- package/dist/admin/reviewer-scope-editor.js.map +1 -1
- package/dist/admin/role-select.js.map +1 -1
- package/dist/admin/user-roster.js +1 -9
- package/dist/admin/user-roster.js.map +1 -1
- package/dist/auth/accept-invitation.js.map +1 -1
- package/dist/auth/auth-errors.js.map +1 -1
- package/dist/auth/forgot-password-form.js +23 -31
- package/dist/auth/forgot-password-form.js.map +1 -1
- package/dist/auth/register-form.js.map +1 -1
- package/dist/auth/reset-password-form.js.map +1 -1
- package/dist/auth/sign-in-form.js +13 -5
- package/dist/auth/sign-in-form.js.map +1 -1
- package/dist/auth/verify-email.js +1 -8
- package/dist/auth/verify-email.js.map +1 -1
- package/dist/billing/billing-banner.js.map +1 -1
- package/dist/billing/billing-labels.js.map +1 -1
- package/dist/billing/checkout-processing.js.map +1 -1
- package/dist/billing/plan-card.js +91 -85
- package/dist/billing/plan-card.js.map +1 -1
- package/dist/billing/plan-limit-toast.js.map +1 -1
- package/dist/billing/plan-limit.js.map +1 -1
- package/dist/billing/plan-price.js.map +1 -1
- package/dist/billing/plan-switch.js.map +1 -1
- package/dist/billing/subscription-actions.js.map +1 -1
- package/dist/bin/eifi1-pay-page.mjs +6 -1
- package/dist/components/account-chips.js.map +1 -1
- package/dist/components/alert-banner.js +1 -5
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.js +29 -12
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/authed-image.js.map +1 -1
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/bulk-action-bar.js +1 -4
- package/dist/components/bulk-action-bar.js.map +1 -1
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/button-look.js.map +1 -1
- package/dist/components/button.js +1 -7
- package/dist/components/button.js.map +1 -1
- package/dist/components/calculator.js +5 -5
- package/dist/components/calculator.js.map +1 -1
- package/dist/components/calendar-heatmap.js +4 -10
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/card.js +1 -8
- package/dist/components/card.js.map +1 -1
- package/dist/components/chart-zoom-core.js +3 -17
- package/dist/components/chart-zoom-core.js.map +1 -1
- package/dist/components/chart.d.ts +1 -1
- package/dist/components/chart.js +4 -22
- package/dist/components/chart.js.map +1 -1
- package/dist/components/checkbox-group.js +1 -4
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/chip-input.js +4 -1
- package/dist/components/chip-input.js.map +1 -1
- package/dist/components/chip.js +10 -5
- package/dist/components/chip.js.map +1 -1
- package/dist/components/choice-card.js +58 -74
- package/dist/components/choice-card.js.map +1 -1
- package/dist/components/column-mapper-labels.js.map +1 -1
- package/dist/components/column-mapper.js +167 -227
- package/dist/components/column-mapper.js.map +1 -1
- package/dist/components/combobox-core.js +5 -9
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.js +1 -4
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/country-select.d.ts +5 -4
- package/dist/components/country-select.js +3 -19
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/currency-option-list.js +13 -11
- package/dist/components/currency-option-list.js.map +1 -1
- package/dist/components/currency-select.js +1 -6
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-cells.js.map +1 -1
- package/dist/components/data-table-column-settings.js.map +1 -1
- package/dist/components/data-table-filter-popover.js +2 -18
- package/dist/components/data-table-filter-popover.js.map +1 -1
- package/dist/components/data-table-filters.js.map +1 -1
- package/dist/components/data-table-fit.js +7 -5
- package/dist/components/data-table-fit.js.map +1 -1
- package/dist/components/data-table-groups.js +3 -1
- package/dist/components/data-table-groups.js.map +1 -1
- package/dist/components/data-table-head.js +49 -57
- package/dist/components/data-table-head.js.map +1 -1
- package/dist/components/data-table-mobile.js +31 -44
- package/dist/components/data-table-mobile.js.map +1 -1
- package/dist/components/data-table-pagination.js.map +1 -1
- package/dist/components/data-table-row-actions.js +19 -16
- package/dist/components/data-table-row-actions.js.map +1 -1
- package/dist/components/data-table-row.js.map +1 -1
- package/dist/components/data-table-shared.js.map +1 -1
- package/dist/components/data-table-sort.js.map +1 -1
- package/dist/components/data-table-virtual.js +4 -1
- package/dist/components/data-table-virtual.js.map +1 -1
- package/dist/components/data-table.d.ts +8 -0
- package/dist/components/data-table.js +30 -39
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.js +1 -6
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/description-list.js +10 -10
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog-frame.js +9 -2
- package/dist/components/dialog-frame.js.map +1 -1
- package/dist/components/disclosure.js +17 -27
- package/dist/components/disclosure.js.map +1 -1
- package/dist/components/dropdown.js +25 -35
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/empty-state.js.map +1 -1
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/error-boundary.js.map +1 -1
- package/dist/components/field-base.js +5 -5
- package/dist/components/field-base.js.map +1 -1
- package/dist/components/field-parts.d.ts +1 -1
- package/dist/components/field-parts.js +10 -14
- package/dist/components/field-parts.js.map +1 -1
- package/dist/components/field-sync.js +8 -10
- package/dist/components/field-sync.js.map +1 -1
- package/dist/components/file-button.js.map +1 -1
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/floating-panel.js +4 -1
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/focus-ring.js.map +1 -1
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/grouped-picker.js +11 -12
- package/dist/components/grouped-picker.js.map +1 -1
- package/dist/components/hover-menu.js +1 -4
- package/dist/components/hover-menu.js.map +1 -1
- package/dist/components/iban-input-labels.js.map +1 -1
- package/dist/components/icon-button.js +4 -1
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/icon-picker.js +6 -10
- package/dist/components/icon-picker.js.map +1 -1
- package/dist/components/image-grid.js +41 -50
- package/dist/components/image-grid.js.map +1 -1
- package/dist/components/inline-edit-field.js.map +1 -1
- package/dist/components/inline-entity-combobox.js +6 -12
- package/dist/components/inline-entity-combobox.js.map +1 -1
- package/dist/components/input.js +14 -2
- package/dist/components/input.js.map +1 -1
- package/dist/components/jump-calendar.js +1 -7
- package/dist/components/jump-calendar.js.map +1 -1
- package/dist/components/legal-labels.js +8 -2
- package/dist/components/legal-labels.js.map +1 -1
- package/dist/components/legal-page.d.ts +18 -1
- package/dist/components/legal-page.js +27 -2
- package/dist/components/legal-page.js.map +1 -1
- package/dist/components/legal.d.ts +40 -5
- package/dist/components/legal.js +41 -5
- package/dist/components/legal.js.map +1 -1
- package/dist/components/lightbox.js.map +1 -1
- package/dist/components/line-items.js +26 -36
- package/dist/components/line-items.js.map +1 -1
- package/dist/components/list-labels.js +3 -1
- package/dist/components/list-labels.js.map +1 -1
- package/dist/components/list.d.ts +18 -1
- package/dist/components/list.js +54 -13
- package/dist/components/list.js.map +1 -1
- package/dist/components/measured-grid.js +29 -53
- package/dist/components/measured-grid.js.map +1 -1
- package/dist/components/menu-item.js.map +1 -1
- package/dist/components/mini-calendar.js +13 -31
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/money-field.js.map +1 -1
- package/dist/components/month-picker.js +10 -21
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.js +3 -16
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/nav-pills.js +10 -1
- package/dist/components/nav-pills.js.map +1 -1
- package/dist/components/number-field.js.map +1 -1
- package/dist/components/number-input.js +1 -7
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.js +1 -4
- package/dist/components/numpad-sheet.js.map +1 -1
- package/dist/components/one-time-code-input.js +1 -7
- package/dist/components/one-time-code-input.js.map +1 -1
- package/dist/components/page-contents.js +13 -22
- package/dist/components/page-contents.js.map +1 -1
- package/dist/components/page-header.js +1 -11
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/password-strength-labels.js.map +1 -1
- package/dist/components/password-strength.js +2 -8
- package/dist/components/password-strength.js.map +1 -1
- package/dist/components/phone-input.js +42 -57
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/picker-sheet.js.map +1 -1
- package/dist/components/pie-chart.js +1 -8
- package/dist/components/pie-chart.js.map +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress-bar.js +16 -9
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/qr-code.js +1 -8
- package/dist/components/qr-code.js.map +1 -1
- package/dist/components/row-actions.js +5 -1
- package/dist/components/row-actions.js.map +1 -1
- package/dist/components/search-field.js.map +1 -1
- package/dist/components/select.js +28 -38
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.js +1 -5
- package/dist/components/separator.js.map +1 -1
- package/dist/components/series-chart-axes.js +4 -1
- package/dist/components/series-chart-axes.js.map +1 -1
- package/dist/components/series-chart-budget.js.map +1 -1
- package/dist/components/series-chart-ticks.js.map +1 -1
- package/dist/components/series-chart.js +29 -45
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/settings-fields.js +21 -17
- package/dist/components/settings-fields.js.map +1 -1
- package/dist/components/share-card.js +4 -9
- package/dist/components/share-card.js.map +1 -1
- package/dist/components/sign-chip.js.map +1 -1
- package/dist/components/signature-pad.js +4 -13
- package/dist/components/signature-pad.js.map +1 -1
- package/dist/components/signed-amount.js +12 -5
- package/dist/components/signed-amount.js.map +1 -1
- package/dist/components/skeleton.js +2 -17
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/slider.js +13 -36
- package/dist/components/slider.js.map +1 -1
- package/dist/components/sparkline.js.map +1 -1
- package/dist/components/stat-tile.js +14 -10
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/swatch-picker.js +14 -4
- package/dist/components/swatch-picker.js.map +1 -1
- package/dist/components/swipeable-row.d.ts +1 -1
- package/dist/components/swipeable-row.js +1 -8
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/table-skeleton.js +4 -1
- package/dist/components/table-skeleton.js.map +1 -1
- package/dist/components/table.js +12 -9
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js +5 -24
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/text-link.js.map +1 -1
- package/dist/components/text.js.map +1 -1
- package/dist/components/tile-radio.js +1 -7
- package/dist/components/tile-radio.js.map +1 -1
- package/dist/components/time-input.js.map +1 -1
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.js +6 -1
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle-legend.js +2 -11
- package/dist/components/toggle-legend.js.map +1 -1
- package/dist/components/tooltip.js +2 -22
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/translation-review-editor.js +1 -4
- package/dist/components/translation-review-editor.js.map +1 -1
- package/dist/components/translation-review-parts.d.ts +1 -1
- package/dist/components/translation-review-parts.js +7 -1
- package/dist/components/translation-review-parts.js.map +1 -1
- package/dist/components/translation-review.js +18 -7
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/tree-view.js +14 -10
- package/dist/components/tree-view.js.map +1 -1
- package/dist/components/treemap.js +1 -13
- package/dist/components/treemap.js.map +1 -1
- package/dist/components/trigger-aria.js.map +1 -1
- package/dist/components/use-table-state.js +14 -11
- package/dist/components/use-table-state.js.map +1 -1
- package/dist/components/user-avatar.js +3 -26
- package/dist/components/user-avatar.js.map +1 -1
- package/dist/demo/demo-start.js +8 -4
- package/dist/demo/demo-start.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/feedback/feedback-attachment-labels.js.map +1 -1
- package/dist/feedback/feedback-attachment.js +1 -8
- package/dist/feedback/feedback-attachment.js.map +1 -1
- package/dist/feedback/feedback-capture.d.ts +1 -1
- package/dist/feedback/feedback-capture.js +3 -1
- package/dist/feedback/feedback-capture.js.map +1 -1
- package/dist/feedback/feedback-comment-thread.js +27 -13
- package/dist/feedback/feedback-comment-thread.js.map +1 -1
- package/dist/feedback/feedback-context.js +1 -4
- package/dist/feedback/feedback-context.js.map +1 -1
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback/feedback-public-list.js +7 -1
- package/dist/feedback/feedback-public-list.js.map +1 -1
- package/dist/feedback/feedback-record.js +1 -5
- package/dist/feedback/feedback-record.js.map +1 -1
- package/dist/feedback/feedback-replies.js +25 -10
- package/dist/feedback/feedback-replies.js.map +1 -1
- package/dist/feedback/feedback-row-detail.js.map +1 -1
- package/dist/feedback/feedback-status-undo.js.map +1 -1
- package/dist/feedback/feedback-submit-dialog.js.map +1 -1
- package/dist/feedback/feedback-table.d.ts +3 -1
- package/dist/feedback/feedback-table.js +22 -5
- package/dist/feedback/feedback-table.js.map +1 -1
- package/dist/feedback/feedback-thread.js +2 -13
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/feedback/feedback-vocabulary.js.map +1 -1
- package/dist/feedback/feedback-vote-button.js.map +1 -1
- package/dist/hooks/use-anchored-rect.js.map +1 -1
- package/dist/hooks/use-document-title.js.map +1 -1
- package/dist/hooks/use-file-drop.js.map +1 -1
- package/dist/hooks/use-file-picker-labels.js.map +1 -1
- package/dist/hooks/use-file-picker.js.map +1 -1
- package/dist/hooks/use-focus-trap.js.map +1 -1
- package/dist/hooks/use-overlay-history.js +10 -5
- package/dist/hooks/use-overlay-history.js.map +1 -1
- package/dist/hooks/use-row-swipe.d.ts +1 -1
- package/dist/hooks/use-row-swipe.js +1 -6
- package/dist/hooks/use-row-swipe.js.map +1 -1
- package/dist/i18n/defaults.js +1 -4
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.js +15 -4
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.js +2 -8
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/languages.js.map +1 -1
- package/dist/i18n/locales/en.js +19 -4
- package/dist/i18n/locales/en.js.map +2 -2
- package/dist/i18n/locales/es.js +15 -4
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +15 -4
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +15 -4
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +15 -4
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +11 -3
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/plurals.js.map +1 -1
- package/dist/i18n/review.js +15 -7
- package/dist/i18n/review.js.map +1 -1
- package/dist/i18n/shared-labels.js.map +1 -1
- package/dist/index.d.ts +17 -17
- package/dist/index.js +40 -23
- package/dist/index.js.map +1 -1
- package/dist/landing/access.js +1 -4
- package/dist/landing/access.js.map +1 -1
- package/dist/landing/landing-sections.js +35 -38
- package/dist/landing/landing-sections.js.map +1 -1
- package/dist/landing/page-seo.js.map +1 -1
- package/dist/lib/calc.js.map +1 -1
- package/dist/lib/clipboard-minus.js.map +1 -1
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/decimal-marks.js.map +1 -1
- package/dist/lib/device-settings.js +2 -1
- package/dist/lib/device-settings.js.map +1 -1
- package/dist/lib/direction.js.map +1 -1
- package/dist/lib/iban.js.map +1 -1
- package/dist/lib/logger.js +1 -5
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/person-name.js.map +1 -1
- package/dist/lib/phone.js.map +1 -1
- package/dist/lib/qr-encode.js +344 -8
- package/dist/lib/qr-encode.js.map +1 -1
- package/dist/lib/session-refresh.js.map +1 -1
- package/dist/lib/table-text.js +15 -3
- package/dist/lib/table-text.js.map +1 -1
- package/dist/lib/text-match.d.ts +20 -0
- package/dist/lib/text-match.js +11 -1
- package/dist/lib/text-match.js.map +1 -1
- package/dist/lib/translation-review.js.map +1 -1
- package/dist/notifications/notification-inbox.js +63 -44
- package/dist/notifications/notification-inbox.js.map +1 -1
- package/dist/notifications/notification-parts.js.map +1 -1
- package/dist/notifications/notification-types-setting.js.map +1 -1
- package/dist/notifications/notifications-labels.js.map +1 -1
- package/dist/notifications/push-device-setting.js +6 -1
- package/dist/notifications/push-device-setting.js.map +1 -1
- package/dist/notifications/push-devices-setting.js.map +1 -1
- package/dist/notifications/push-worker.js.map +1 -1
- package/dist/notifications/quiet-hours-setting.js.map +1 -1
- package/dist/notifications/use-push-device.js +4 -1
- package/dist/notifications/use-push-device.js.map +1 -1
- package/dist/offline/pwa-update-prompt.d.ts +1 -1
- package/dist/offline/pwa-update-prompt.js +7 -1
- package/dist/offline/pwa-update-prompt.js.map +1 -1
- package/dist/offline/query-persistence.js.map +1 -1
- package/dist/offline.d.ts +1 -1
- package/dist/offline.js +6 -1
- package/dist/offline.js.map +1 -1
- package/dist/pay/pay.css +8 -1
- package/dist/rhf/fields.d.ts +1 -2
- package/dist/rhf/fields.js +1 -10
- package/dist/rhf/fields.js.map +1 -1
- package/dist/rhf/form-core.js +1 -4
- package/dist/rhf/form-core.js.map +1 -1
- package/dist/rhf/line-items.js.map +1 -1
- package/dist/rhf/use-rhf-wizard-step.js.map +1 -1
- package/dist/search/command-palette.js +71 -62
- package/dist/search/command-palette.js.map +1 -1
- package/dist/search/global-search.js +34 -5
- package/dist/search/global-search.js.map +1 -1
- package/dist/search/search-index.js.map +1 -1
- package/dist/settings/device-reset-setting.js +1 -6
- package/dist/settings/device-reset-setting.js.map +1 -1
- package/dist/settings/settings-heading.js.map +1 -1
- package/dist/settings/settings-layout.js +9 -20
- package/dist/settings/settings-layout.js.map +1 -1
- package/dist/settings/use-settings-focus.d.ts +7 -0
- package/dist/settings/use-settings-focus.js +2 -0
- package/dist/settings/use-settings-focus.js.map +1 -1
- package/dist/settings/use-settings-route.js.map +1 -1
- package/dist/shell/app-shell.js +62 -31
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/auth-layout.js +1 -10
- package/dist/shell/auth-layout.js.map +1 -1
- package/dist/shell/dev-menu.d.ts +5 -0
- package/dist/shell/dev-menu.js +14 -7
- package/dist/shell/dev-menu.js.map +1 -1
- package/dist/shell/option-switcher-menu.js.map +1 -1
- package/dist/shell/sync-status-indicator.js +7 -6
- package/dist/shell/sync-status-indicator.js.map +1 -1
- package/dist/shell/top-bar-parts-labels.js.map +1 -1
- package/dist/shell/topbar-action-menu.d.ts +14 -1
- package/dist/shell/topbar-action-menu.js +85 -34
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell/topbar-controls.js +1 -10
- package/dist/shell/topbar-controls.js.map +1 -1
- package/dist/shell/tour-menu.js +9 -1
- package/dist/shell/tour-menu.js.map +1 -1
- package/dist/shell.d.ts +1 -1
- package/dist/shell.js +2 -1
- package/dist/shell.js.map +1 -1
- package/dist/sync/db.js.map +1 -1
- package/dist/sync/engine.js +24 -6
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync.d.ts +2 -2
- package/dist/sync.js +7 -1
- package/dist/sync.js.map +1 -1
- package/dist/testing/css-variables.js.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +1 -3
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/react.js.map +1 -1
- package/dist/testing/viewport.js +7 -4
- package/dist/testing/viewport.js.map +1 -1
- package/dist/theme/contrast-tokens.js +13 -2
- package/dist/theme/contrast-tokens.js.map +1 -1
- package/dist/theme/palette-derive.d.ts +1 -1
- package/dist/theme/palette-derive.js +18 -29
- package/dist/theme/palette-derive.js.map +1 -1
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/theme/palette-store.js.map +1 -1
- package/dist/theme/text-size.js.map +1 -1
- package/dist/theme/theme-store.js +1 -3
- package/dist/theme/theme-store.js.map +1 -1
- package/dist/tour/tour-catalogue.js.map +1 -1
- package/dist/tour/tour-dock.js +5 -1
- package/dist/tour/tour-dock.js.map +1 -1
- package/dist/tour/tour-engine.js +1 -4
- package/dist/tour/tour-engine.js.map +1 -1
- package/dist/tour/tour.js +21 -12
- package/dist/tour/tour.js.map +1 -1
- package/dist/tour/use-tour-progress.js.map +1 -1
- package/dist/tour/use-tour-url-sync.js.map +1 -1
- package/dist/wizard/stepper-nav.js +3 -24
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard/types.js.map +1 -1
- package/dist/wizard/use-wizard.js +24 -28
- package/dist/wizard/use-wizard.js.map +1 -1
- package/dist/wizard/validation.js.map +1 -1
- package/dist/wizard/wizard-context.js.map +1 -1
- package/dist/wizard/wizard-step.d.ts +1 -1
- package/dist/wizard/wizard-step.js +1 -8
- package/dist/wizard/wizard-step.js.map +1 -1
- package/dist/wizard/wizard-summary.js.map +1 -1
- package/package.json +5 -2
- package/src/account/account-settings-labels.ts +1 -2
- package/src/account/account-settings.tsx +11 -17
- package/src/account/delete-account-setting.tsx +1 -6
- package/src/account/email-change-setting-labels.ts +1 -2
- package/src/account/email-change-setting.tsx +3 -1
- package/src/account/passkeys-setting.tsx +1 -3
- package/src/account/sessions-setting.tsx +4 -2
- package/src/admin/admin-action-confirm.tsx +4 -7
- package/src/admin/admin-action-log.tsx +29 -29
- package/src/admin/admin-area-labels.ts +4 -1
- package/src/admin/admin-overview.tsx +8 -2
- package/src/admin/admin-sections.tsx +3 -1
- package/src/admin/admin-tool-links.tsx +7 -1
- package/src/admin/invitations-panel.tsx +5 -11
- package/src/admin/mail-test-card.tsx +1 -2
- package/src/admin/reviewer-scope-editor.tsx +4 -9
- package/src/admin/role-select.tsx +4 -2
- package/src/admin/user-roster.tsx +2 -11
- package/src/auth/accept-invitation.tsx +1 -7
- package/src/auth/auth-errors.ts +1 -6
- package/src/auth/forgot-password-form.tsx +2 -7
- package/src/auth/register-form.tsx +7 -8
- package/src/auth/reset-password-form.tsx +2 -5
- package/src/auth/sign-in-form.tsx +15 -14
- package/src/auth/verify-email.tsx +2 -7
- package/src/billing/billing-banner.tsx +3 -7
- package/src/billing/billing-labels.ts +6 -4
- package/src/billing/checkout-processing.ts +0 -1
- package/src/billing/plan-card.tsx +9 -8
- package/src/billing/plan-limit-toast.tsx +1 -2
- package/src/billing/plan-limit.ts +1 -2
- package/src/billing/plan-price.ts +1 -4
- package/src/billing/plan-switch.tsx +1 -2
- package/src/billing/subscription-actions.tsx +5 -2
- package/src/components/account-chips.tsx +1 -7
- package/src/components/alert-banner.tsx +2 -8
- package/src/components/amount-input.tsx +206 -178
- package/src/components/authed-image.tsx +7 -4
- package/src/components/autocomplete.tsx +7 -9
- package/src/components/bulk-action-bar.tsx +2 -7
- package/src/components/button-group.tsx +1 -2
- package/src/components/button-look.ts +6 -17
- package/src/components/button.tsx +1 -4
- package/src/components/calculator.tsx +6 -9
- package/src/components/calendar-heatmap.tsx +5 -10
- package/src/components/card.tsx +9 -13
- package/src/components/chart-zoom-core.tsx +6 -33
- package/src/components/chart.tsx +8 -31
- package/src/components/checkbox-group.tsx +1 -4
- package/src/components/chip-input.tsx +6 -6
- package/src/components/chip.tsx +14 -26
- package/src/components/choice-card.tsx +4 -18
- package/src/components/column-mapper-labels.ts +3 -10
- package/src/components/column-mapper.tsx +33 -122
- package/src/components/combobox-core.tsx +17 -47
- package/src/components/combobox.tsx +2 -6
- package/src/components/confirm-dialog.tsx +1 -3
- package/src/components/copy-button.tsx +2 -4
- package/src/components/country-select.tsx +9 -21
- package/src/components/currency-option-list.tsx +16 -18
- package/src/components/currency-select.tsx +2 -7
- package/src/components/danger-confirm.tsx +8 -9
- package/src/components/data-table-cells.tsx +1 -2
- package/src/components/data-table-column-settings.tsx +1 -3
- package/src/components/data-table-filter-popover.tsx +5 -19
- package/src/components/data-table-filters.ts +1 -6
- package/src/components/data-table-fit.ts +7 -7
- package/src/components/data-table-groups.tsx +3 -1
- package/src/components/data-table-head.tsx +32 -46
- package/src/components/data-table-mobile.tsx +99 -108
- package/src/components/data-table-pagination.tsx +2 -6
- package/src/components/data-table-row-actions.tsx +25 -24
- package/src/components/data-table-row.tsx +16 -17
- package/src/components/data-table-shared.tsx +10 -16
- package/src/components/data-table-sort.ts +1 -2
- package/src/components/data-table-virtual.ts +9 -4
- package/src/components/data-table.tsx +497 -501
- package/src/components/date-picker.tsx +1 -7
- package/src/components/date-range-picker.tsx +3 -13
- package/src/components/description-list.tsx +7 -13
- package/src/components/dialog-frame.tsx +12 -3
- package/src/components/disclosure.tsx +8 -12
- package/src/components/dropdown.tsx +3 -11
- package/src/components/empty-state.tsx +1 -3
- package/src/components/entity-combobox.tsx +2 -6
- package/src/components/error-boundary.tsx +7 -7
- package/src/components/field-base.tsx +8 -14
- package/src/components/field-parts.tsx +12 -23
- package/src/components/field-sync.tsx +7 -11
- package/src/components/file-button.tsx +7 -3
- package/src/components/file-dropzone.tsx +7 -12
- package/src/components/floating-panel.tsx +44 -51
- package/src/components/focus-ring.ts +1 -2
- package/src/components/form-actions.tsx +1 -4
- package/src/components/grouped-picker.tsx +21 -16
- package/src/components/hover-menu.tsx +1 -4
- package/src/components/iban-input-labels.ts +1 -2
- package/src/components/icon-button.tsx +46 -48
- package/src/components/icon-picker.tsx +9 -20
- package/src/components/image-grid.tsx +1 -6
- package/src/components/inline-edit-field.tsx +1 -5
- package/src/components/inline-entity-combobox.tsx +11 -25
- package/src/components/input.tsx +14 -2
- package/src/components/jump-calendar.tsx +2 -6
- package/src/components/legal-labels.ts +8 -3
- package/src/components/legal-page.tsx +56 -6
- package/src/components/legal.tsx +83 -10
- package/src/components/lightbox.tsx +1 -3
- package/src/components/line-items.tsx +7 -15
- package/src/components/list-labels.ts +2 -0
- package/src/components/list.tsx +81 -27
- package/src/components/measured-grid.tsx +8 -30
- package/src/components/menu-item.tsx +1 -3
- package/src/components/mini-calendar.tsx +129 -159
- package/src/components/money-field.tsx +4 -2
- package/src/components/month-picker.tsx +14 -21
- package/src/components/multi-entity-combobox.tsx +6 -26
- package/src/components/multi-select.tsx +5 -9
- package/src/components/nav-pills.tsx +10 -2
- package/src/components/number-field.tsx +18 -15
- package/src/components/number-input.tsx +3 -19
- package/src/components/numpad-sheet.tsx +9 -13
- package/src/components/one-time-code-input.tsx +6 -11
- package/src/components/page-contents.tsx +2 -9
- package/src/components/page-header.tsx +5 -10
- package/src/components/password-strength-labels.ts +1 -2
- package/src/components/password-strength.tsx +6 -9
- package/src/components/phone-input.tsx +2 -13
- package/src/components/picker-sheet.tsx +2 -5
- package/src/components/pie-chart.tsx +6 -12
- package/src/components/popover.tsx +2 -1
- package/src/components/progress-bar.tsx +16 -25
- package/src/components/qr-code.tsx +2 -9
- package/src/components/row-actions.tsx +9 -1
- package/src/components/search-field.tsx +4 -5
- package/src/components/select.tsx +2 -10
- package/src/components/separator.tsx +1 -5
- package/src/components/series-chart-axes.ts +5 -5
- package/src/components/series-chart-budget.ts +1 -4
- package/src/components/series-chart-ticks.ts +1 -4
- package/src/components/series-chart.tsx +43 -83
- package/src/components/settings-fields.tsx +20 -15
- package/src/components/share-card.tsx +6 -14
- package/src/components/sign-chip.tsx +16 -16
- package/src/components/signature-pad.tsx +21 -13
- package/src/components/signed-amount.tsx +6 -14
- package/src/components/skeleton.tsx +2 -13
- package/src/components/slider.tsx +9 -20
- package/src/components/sparkline.tsx +2 -13
- package/src/components/stat-tile.tsx +13 -24
- package/src/components/swatch-picker.tsx +8 -3
- package/src/components/swipeable-row.tsx +2 -11
- package/src/components/table-skeleton.tsx +4 -1
- package/src/components/table.tsx +12 -8
- package/src/components/tabs.tsx +24 -39
- package/src/components/text-link.tsx +6 -6
- package/src/components/text.tsx +1 -2
- package/src/components/tile-radio.tsx +6 -19
- package/src/components/time-input.tsx +4 -5
- package/src/components/toast.tsx +3 -12
- package/src/components/toggle-group.tsx +9 -9
- package/src/components/toggle-legend.tsx +4 -16
- package/src/components/tooltip.tsx +9 -48
- package/src/components/translation-review-editor.tsx +4 -4
- package/src/components/translation-review-parts.tsx +7 -1
- package/src/components/translation-review.tsx +15 -16
- package/src/components/tree-view.tsx +17 -20
- package/src/components/treemap.tsx +3 -15
- package/src/components/trigger-aria.ts +1 -4
- package/src/components/use-table-state.ts +16 -17
- package/src/components/user-avatar.tsx +4 -21
- package/src/demo/demo-start.tsx +8 -4
- package/src/feedback/feedback-attachment-labels.ts +2 -1
- package/src/feedback/feedback-attachment.tsx +16 -29
- package/src/feedback/feedback-capture.ts +3 -1
- package/src/feedback/feedback-comment-thread.tsx +9 -6
- package/src/feedback/feedback-context.tsx +1 -4
- package/src/feedback/feedback-dialog.tsx +3 -4
- package/src/feedback/feedback-inbox.tsx +3 -9
- package/src/feedback/feedback-public-list.tsx +7 -1
- package/src/feedback/feedback-record.ts +6 -14
- package/src/feedback/feedback-replies.tsx +10 -5
- package/src/feedback/feedback-row-detail.tsx +2 -5
- package/src/feedback/feedback-status-undo.ts +1 -4
- package/src/feedback/feedback-submit-dialog.tsx +4 -4
- package/src/feedback/feedback-table.tsx +29 -9
- package/src/feedback/feedback-thread.tsx +4 -16
- package/src/feedback/feedback-vocabulary.ts +72 -82
- package/src/feedback/feedback-vote-button.tsx +9 -8
- package/src/hooks/use-anchored-rect.ts +1 -4
- package/src/hooks/use-document-title.ts +3 -1
- package/src/hooks/use-file-drop.ts +1 -3
- package/src/hooks/use-file-picker-labels.ts +1 -2
- package/src/hooks/use-file-picker.tsx +1 -5
- package/src/hooks/use-focus-trap.ts +1 -2
- package/src/hooks/use-overlay-history.ts +10 -5
- package/src/hooks/use-row-swipe.ts +1 -6
- package/src/i18n/defaults.ts +1 -4
- package/src/i18n/german.ts +42 -50
- package/src/i18n/kit-labels.tsx +5 -20
- package/src/i18n/languages.ts +2 -8
- package/src/i18n/locales/en.ts +15 -31
- package/src/i18n/locales/es.ts +44 -50
- package/src/i18n/locales/fr.ts +43 -52
- package/src/i18n/locales/hu.ts +35 -38
- package/src/i18n/locales/it.ts +44 -53
- package/src/i18n/locales/zh.ts +23 -33
- package/src/i18n/plurals.ts +4 -1
- package/src/i18n/review.ts +20 -7
- package/src/i18n/shared-labels.ts +1 -2
- package/src/index.ts +107 -32
- package/src/landing/access.ts +2 -7
- package/src/landing/landing-sections.tsx +14 -15
- package/src/landing/page-seo.ts +1 -3
- package/src/lib/calc.ts +4 -1
- package/src/lib/clipboard-minus.ts +4 -1
- package/src/lib/dates.ts +2 -10
- package/src/lib/decimal-marks.ts +1 -3
- package/src/lib/device-settings.ts +2 -1
- package/src/lib/direction.ts +1 -3
- package/src/lib/iban.ts +89 -9
- package/src/lib/logger.ts +1 -5
- package/src/lib/person-name.ts +1 -3
- package/src/lib/phone.ts +5 -8
- package/src/lib/qr-encode.ts +32 -8
- package/src/lib/session-refresh.ts +5 -6
- package/src/lib/table-text.ts +24 -6
- package/src/lib/text-match.ts +43 -1
- package/src/lib/translation-review.ts +1 -3
- package/src/notifications/notification-inbox.tsx +17 -4
- package/src/notifications/notification-parts.tsx +1 -2
- package/src/notifications/notification-types-setting.tsx +19 -18
- package/src/notifications/notifications-labels.ts +1 -2
- package/src/notifications/push-device-setting.tsx +7 -1
- package/src/notifications/push-devices-setting.tsx +7 -3
- package/src/notifications/push-worker.ts +10 -2
- package/src/notifications/quiet-hours-setting.tsx +4 -1
- package/src/notifications/use-push-device.ts +4 -1
- package/src/offline/pwa-update-prompt.tsx +7 -1
- package/src/offline/query-persistence.ts +9 -6
- package/src/offline.ts +6 -1
- package/src/rhf/fields.tsx +50 -19
- package/src/rhf/form-core.tsx +2 -6
- package/src/rhf/line-items.tsx +5 -7
- package/src/rhf/use-rhf-wizard-step.ts +3 -12
- package/src/search/command-palette.tsx +15 -23
- package/src/search/global-search.tsx +38 -8
- package/src/search/search-index.ts +5 -1
- package/src/settings/device-reset-setting.tsx +5 -8
- package/src/settings/settings-heading.tsx +3 -1
- package/src/settings/settings-layout.tsx +6 -13
- package/src/settings/use-settings-focus.ts +8 -0
- package/src/settings/use-settings-route.ts +4 -3
- package/src/shell/app-shell.tsx +48 -24
- package/src/shell/auth-layout.tsx +1 -6
- package/src/shell/dev-menu.tsx +18 -6
- package/src/shell/option-switcher-menu.tsx +1 -3
- package/src/shell/sync-status-indicator.tsx +14 -12
- package/src/shell/top-bar-parts-labels.ts +1 -3
- package/src/shell/topbar-action-menu.tsx +130 -45
- package/src/shell/topbar-controls.tsx +5 -19
- package/src/shell/tour-menu.tsx +9 -1
- package/src/shell.ts +1 -1
- package/src/sync/db.ts +5 -1
- package/src/sync/engine.ts +44 -12
- package/src/sync.ts +16 -2
- package/src/testing/css-variables.ts +1 -2
- package/src/testing/index.ts +1 -6
- package/src/testing/react.ts +1 -2
- package/src/testing/viewport.ts +9 -9
- package/src/theme/contrast-tokens.ts +13 -2
- package/src/theme/palette-derive.ts +24 -50
- package/src/theme/palette-presets.ts +0 -1
- package/src/theme/palette-store.ts +1 -4
- package/src/theme/text-size.ts +1 -1
- package/src/theme/theme-store.ts +2 -6
- package/src/tour/tour-catalogue.tsx +4 -2
- package/src/tour/tour-dock.ts +5 -1
- package/src/tour/tour-engine.ts +2 -6
- package/src/tour/tour.tsx +28 -12
- package/src/tour/use-tour-progress.ts +8 -2
- package/src/tour/use-tour-url-sync.ts +3 -1
- package/src/vite-env.d.ts +1 -4
- package/src/wizard/stepper-nav.tsx +10 -35
- package/src/wizard/types.ts +1 -4
- package/src/wizard/use-wizard.ts +28 -43
- package/src/wizard/validation.ts +1 -5
- package/src/wizard/wizard-context.tsx +2 -6
- package/src/wizard/wizard-step.tsx +1 -8
- package/src/wizard/wizard-summary.tsx +2 -6
- package/tokens.css +393 -152
package/README.md
CHANGED
|
@@ -568,16 +568,16 @@ columns, strings and permissions (see the note at the top of `src/feedback/feedb
|
|
|
568
568
|
|
|
569
569
|
<!-- BEGIN GENERATED: exports — node scripts/gen-export-inventory.mjs -->
|
|
570
570
|
|
|
571
|
-
**
|
|
571
|
+
**2197 names from 363 modules** — 1017 values and 1180 types. _Italic_ is a type-only export.
|
|
572
572
|
|
|
573
573
|
Generated from `dist/index.d.ts` by `node scripts/gen-export-inventory.mjs`; the count
|
|
574
574
|
is pinned by `src/__tests__/public-surface.test.ts`. Do not edit between the markers.
|
|
575
575
|
|
|
576
576
|
| Entry point | Names |
|
|
577
577
|
|---|---|
|
|
578
|
-
| `@eifi1/ui-kit` |
|
|
578
|
+
| `@eifi1/ui-kit` | 2197 |
|
|
579
579
|
| `@eifi1/ui-kit/chart` | 100 |
|
|
580
|
-
| `@eifi1/ui-kit/shell` |
|
|
580
|
+
| `@eifi1/ui-kit/shell` | 120 |
|
|
581
581
|
| `@eifi1/ui-kit/data-table` | 56 |
|
|
582
582
|
| `@eifi1/ui-kit/wizard` | 25 |
|
|
583
583
|
| `@eifi1/ui-kit/tour` | 49 |
|
|
@@ -608,7 +608,7 @@ re-slicing of it, never a second API.
|
|
|
608
608
|
| `lib/format` | `currencyMinorDigits`, `EMPTY_FORMATTED_VALUE`, `formatDate`, `formatMoney`, `formatNumber`, `formatPercent`, `formatRelativeTime`, `roundToCurrency`, `toDate`, `useKitFormat`, _`DateInput`_, _`FormatDateOptions`_, _`FormatDateStyle`_, _`FormatDigits`_, _`FormatMoneyOptions`_, _`FormatNumberBaseOptions`_, _`FormatNumberOptions`_, _`FormatPercentOptions`_, _`FormatRelativeTimeOptions`_, _`FormattableNumber`_, _`KitFormat`_, _`RoundToCurrencyOptions`_ |
|
|
609
609
|
| `lib/safe-storage` | `readStored`, `writeStored` |
|
|
610
610
|
| `lib/download` | `filenameFromDisposition`, `saveBlob` |
|
|
611
|
-
| `lib/text-match` | `foldForSearch`, `rankMatch`, _`MatchRank`_ |
|
|
611
|
+
| `lib/text-match` | `foldForSearch`, `matchesSearch`, `rankMatch`, `searchWords`, _`MatchRank`_ |
|
|
612
612
|
| `lib/qr-encode` | `encodeQr`, _`QrEncodeOptions`_, _`QrErrorCorrection`_, _`QrMatrix`_ |
|
|
613
613
|
| `lib/server-wake` | `attachServerWake`, `createServerWake`, `serverWake`, `watchReadsAnd`, `wrapFetch`, _`AxiosLikeInstance`_, _`ServerWakeAxiosConfig`_, _`ServerWakeFilter`_, _`ServerWakeOptions`_, _`ServerWakeRequest`_, _`ServerWakeStage`_, _`ServerWakeWatcher`_ |
|
|
614
614
|
| `lib/session-refresh` | `attachSessionRefresh`, `createSessionRefresh`, `isSignedOutStep`, `isTransientRefreshFailure`, _`SessionRefresh`_, _`SessionRefreshOptions`_, _`SessionRefreshOutcome`_, _`SessionRenewal`_ |
|
|
@@ -797,7 +797,7 @@ re-slicing of it, never a second API.
|
|
|
797
797
|
| `components/text-link` | `TextLink`, _`TextLinkCurrent`_, _`TextLinkProps`_, _`TextLinkRenderProps`_, _`TextLinkTone`_, _`TextLinkUnderline`_ |
|
|
798
798
|
| `components/toast` | `DEFAULT_TOAST_LABELS`, `toast`, `TOAST_ACTION_DURATION`, `Toaster`, `TOASTER_OFFSET_BOTTOM`, `TOASTER_OFFSET_TOP`, _`ToastAction`_, _`ToasterOffset`_, _`ToasterProps`_, _`ToastId`_, _`ToastLabels`_, _`ToastOptions`_, _`ToastPosition`_, _`ToastPromiseOptions`_, _`ToastRedoOptions`_, _`ToastSwipeDirection`_, _`ToastUndoOptions`_ |
|
|
799
799
|
| `components/translation-review` | `TranslationReviewPanel`, _`TranslationReviewGroupBy`_, _`TranslationReviewOrigin`_, _`TranslationReviewPanelProps`_, _`TranslationReviewSaveInfo`_ |
|
|
800
|
-
| `components/legal` | `DEFAULT_LEGAL_LABELS`, `LEGAL_HREFS`, `LegalFooter`, `LegalLayout`, `LegalLinks`, `legalOperatorText`, `LegalSection`, `useLegalLabels`, _`LegalDisclaimerSectionLabels`_, _`LegalFooterProps`_, _`LegalFramedSectionLabels`_, _`LegalLabels`_, _`LegalLayoutProps`_, _`LegalLink`_, _`LegalLinksProps`_, _`LegalOperator`_, _`LegalOperatorSectionLabels`_, _`LegalOperatorText`_, _`LegalPageKey`_, _`LegalSectionProps`_, _`LegalTextSectionLabels`_ |
|
|
800
|
+
| `components/legal` | `DEFAULT_LEGAL_LABELS`, `LEGAL_HREFS`, `LegalFooter`, `LegalLayout`, `LegalLinks`, `legalOperatorText`, `LegalSection`, `useLegalLabels`, _`LegalDisclaimerSectionLabels`_, _`LegalFooterProps`_, _`LegalFramedSectionLabels`_, _`LegalInfoPageKey`_, _`LegalLabels`_, _`LegalLayoutProps`_, _`LegalLink`_, _`LegalLinksProps`_, _`LegalOperator`_, _`LegalOperatorSectionLabels`_, _`LegalOperatorText`_, _`LegalPageKey`_, _`LegalSectionProps`_, _`LegalTextSectionLabels`_ |
|
|
801
801
|
| `components/legal-page` | `LEGAL_SKELETON`, `LegalAcceptCheckbox`, `LegalKitSection`, `LegalPage`, _`LegalAcceptCheckboxProps`_, _`LegalDisclaimerVariant`_, _`LegalKitSectionKey`_, _`LegalKitSectionProps`_, _`LegalPageProps`_, _`LegalSectionOwner`_, _`LegalSkeletonEntry`_, _`LegalSkeletonPage`_ |
|
|
802
802
|
| `components/appearance-labels` | `DEFAULT_APPEARANCE_LABELS`, `useAppearanceLabels`, _`AppearanceLabels`_ |
|
|
803
803
|
| `components/date-format-setting` | `DateFormatSetting`, _`DateFormatSettingProps`_ |
|
|
@@ -865,7 +865,7 @@ re-slicing of it, never a second API.
|
|
|
865
865
|
|---|---|
|
|
866
866
|
| `settings/settings-layout` | `SETTINGS_SEARCH_THRESHOLD`, `SettingsLayout`, _`SettingsDocumentTitleParts`_, _`SettingsLayoutProps`_, _`SettingsLayoutWidth`_ |
|
|
867
867
|
| `settings/use-settings-route` | `resolveSettingsLocation`, `SETTINGS_FROM_LIST_STATE`, `settingsFromListState`, `useSettingsRoute`, _`SettingsLayoutMode`_, _`SettingsLocation`_, _`SettingsLocationResult`_, _`SettingsLocationRules`_, _`SettingsRoute`_, _`UseSettingsRouteOptions`_ |
|
|
868
|
-
| `settings/use-settings-focus` | `SETTINGS_FOCUS_MS`, `SETTINGS_FOCUS_RING`, `useSettingsFocus` |
|
|
868
|
+
| `settings/use-settings-focus` | `SETTINGS_FOCUS_MS`, `SETTINGS_FOCUS_RING`, `useFocusParam`, `useSettingsFocus` |
|
|
869
869
|
| `settings/settings-section` | `SettingsSection`, _`SettingsSectionProps`_ |
|
|
870
870
|
| `settings/settings-context` | `useSettingsLayout`, _`SettingsLayoutContextValue`_ |
|
|
871
871
|
| `settings/settings-heading` | `SettingsHeadingLevel`, `useSettingsHeadingLevel`, _`SettingsHeadingLevelProps`_, _`SettingsHeadingTag`_ |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/account-settings-labels.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useKitLabelOverrides } from \"../i18n/kit-labels\";\n\n/**\n * The `accountSettings` namespace of `<UiKitProvider labels>`: one record per section —\n * `profile`, `password`, `twoFactor`, `passkeys` — each merged key by key, so an app\n * can translate `accountSettings.twoFactor.scanHint` alone.\n *\n * Before 0.12.0 every section took a REQUIRED `labels` prop and had no English of its\n * own, so each app spelled out 30-odd keys at the call site and still hard-coded some\n * (kastlan's profile page passed `email: \"Email\"` in English to a German page). The\n * prop stays, now partial, and wins over the provider as everywhere else in the kit.\n *\n * Its own module, beside the components rather than in them, so `PasskeysSetting`\n * (its own file) and the older three read one tree without importing each other.\n */\n\nexport interface ProfileSettingLabels {\n title: string;\n email: string;\n role: string;\n memberSince: string;\n /** The single name field — the card without `firstName` / `lastName`. */\n displayName: string;\n save: string;\n /**\n * 0.30.0 (docs/user-admin-harmonization.md §6.1): the two fields that replace\n * `displayName` once the card is given `firstName` / `lastName`. OPTIONAL, like\n * `TwoFactorSettingLabels.qrAlt` and for its reason — this interface is annotated at\n * call sites — and filled from the provider's `accountSettings.profile`, then English.\n */\n firstName?: string;\n lastName?: string;\n /** Why Save is held while a name is blank: both are required (§3.1). */\n nameRequired?: string;\n}\n\nexport interface PasswordSettingLabels {\n title: string;\n current: string;\n next: string;\n confirm: string;\n submit: string;\n tooShort: string;\n mismatch: string;\n /**\n * 0.34 (KS U3): `password_incorrect` — server-kit's `400` for a wrong current\n * password — under the current-password field, in the words `EmailChangeSetting`\n * and `DeleteAccountSetting` say it with. OPTIONAL, like\n * `TwoFactorSettingLabels.qrAlt` and for its reason — this interface is annotated at\n * call sites — and filled from the provider's `accountSettings.password`, then English.\n */\n wrongPassword?: string;\n}\n\nexport interface TwoFactorSettingLabels {\n /**\n * Before 0.31 the card's one line, \"<status>: On\". Since 0.31 the setting's name is the\n * card's {@link title} and the state stands beside it, so this is read only where no\n * `title` is given at the same level — an app that translated `status` keeps its word\n * as the title.\n */\n status: string;\n enabledText: string;\n disabledText: string;\n enable: string;\n scanHint: string;\n codeLabel: string;\n verify: string;\n disableSection: string;\n password: string;\n disable: string;\n /**\n * Alt text for the setup QR code, which shipped as a hardcoded `alt=\"QR\"`.\n *\n * OPTIONAL, like the two keys below, and not because it matters less: this interface\n * is annotated at consumer call sites (`const LABELS: TwoFactorSettingLabels = {…}`),\n * so a new REQUIRED key is a compile error in every app on the next `npm update` —\n * the additive-API rule in the README. Each falls back to the provider's\n * `accountSettings.twoFactor`, then English.\n */\n qrAlt?: string;\n /** The line over the manual-entry key, for a phone that cannot scan its own screen. */\n secretHint?: string;\n /** The copy button beside that key. */\n copySecret?: string;\n /**\n * 0.31.0 (docs/settings-harmonization.md §3.7): the card's title, a heading inside a\n * `SettingsLayout`. OPTIONAL for the reason `qrAlt` is. Unset, the same source's\n * `status` stands in for it, then English.\n */\n title?: string;\n}\n\nexport interface PasskeysSettingLabels {\n title: string;\n /** The line under the title saying what a passkey is for — `mode=\"instead\"` (the\n * default): the passkey stands in for the password. */\n description: string;\n /**\n * The same line for `mode=\"alongside\"` (0.18.0): the password keeps working and the\n * passkey is a second way in. OPTIONAL for the reason `TwoFactorSettingLabels.qrAlt`\n * is — this interface is annotated at call sites — and filled from the provider's\n * `accountSettings.passkeys`, then English.\n */\n descriptionAlongside?: string;\n empty: string;\n loading: string;\n /** Accessible name of the list. */\n list: string;\n nameLabel: string;\n namePlaceholder: string;\n add: string;\n /** The add button while the app's WebAuthn ceremony runs — the OS prompt is open. */\n adding: string;\n rename: string;\n /** The row's rename button, named for its passkey — it starts with `rename`, the\n * visible text, so voice control finds it by what it says. */\n renameItem: (name: string) => string;\n /** Accessible name of the inline rename field. */\n renameField: (name: string) => string;\n save: string;\n cancel: string;\n delete: string;\n /** The row's delete button, named for its passkey (see `renameItem`). */\n deleteItem: (name: string) => string;\n /** The inline question a delete asks first. */\n deleteConfirm: (name: string) => string;\n /** The destructive button that answers it. */\n confirmDelete: string;\n /** `date` arrives formatted in the provider's locale. */\n created: (date: string) => string;\n lastUsed: (date: string) => string;\n neverUsed: string;\n}\n\nexport interface AccountSettingsLabels {\n profile: Required<ProfileSettingLabels>;\n password: Required<PasswordSettingLabels>;\n // `Required` here, optional on the section interfaces: the namespace is what a full\n // catalogue (`@eifi1/ui-kit/i18n/<code>`, `missingKitLabels`) is written against, so\n // it must name the late keys; the section interfaces are annotated at call sites.\n twoFactor: Required<TwoFactorSettingLabels>;\n passkeys: Required<PasskeysSettingLabels>;\n}\n\nexport const DEFAULT_ACCOUNT_SETTINGS_LABELS: AccountSettingsLabels = {\n profile: {\n title: \"Profile\",\n email: \"Email\",\n role: \"Role\",\n memberSince: \"Member since\",\n displayName: \"Display name\",\n save: \"Save\",\n firstName: \"First name\",\n lastName: \"Last name\",\n nameRequired: \"Enter both a first and a last name.\",\n },\n password: {\n title: \"Change password\",\n current: \"Current password\",\n next: \"New password\",\n confirm: \"Confirm new password\",\n submit: \"Change password\",\n tooShort: \"The new password is too short.\",\n mismatch: \"The passwords don’t match.\",\n // The siblings' sentence (emailChange, deleteAccount), under the current password.\n wrongPassword: \"The password is incorrect.\",\n },\n twoFactor: {\n status: \"Two-factor authentication\",\n enabledText: \"On\",\n disabledText: \"Off\",\n enable: \"Set up two-factor authentication\",\n scanHint: \"Scan this code with your authenticator app, then enter the code it shows.\",\n codeLabel: \"Verification code\",\n verify: \"Verify and turn on\",\n disableSection: \"Turn off two-factor authentication\",\n password: \"Current password\",\n disable: \"Turn off\",\n // Unchanged from the fallback it had before the namespace (i18n-labels.test pins it).\n qrAlt: \"QR code\",\n secretHint: \"Can’t scan it? Enter this key in the app instead:\",\n copySecret: \"Copy key\",\n title: \"Two-factor authentication\",\n },\n passkeys: {\n title: \"Passkeys\",\n description: \"Sign in with your fingerprint, face or device PIN instead of a password.\",\n // Kurvenschmiede overrode `description` because \"instead of\" is false where the\n // password stays; this is the sentence for those apps, picked by `mode`.\n descriptionAlongside: \"Sign in with your fingerprint, face or device PIN. Your password keeps working too.\",\n empty: \"No passkeys yet\",\n loading: \"Loading passkeys…\",\n list: \"Your passkeys\",\n nameLabel: \"Name (optional)\",\n namePlaceholder: \"e.g. Laptop, Phone\",\n add: \"Add passkey\",\n adding: \"Waiting for your device…\",\n rename: \"Rename\",\n renameItem: (name) => `Rename ${name}`,\n renameField: (name) => `New name for ${name}`,\n save: \"Save\",\n cancel: \"Cancel\",\n delete: \"Delete\",\n deleteItem: (name) => `Delete ${name}`,\n deleteConfirm: (name) => `Delete “${name}”? It can no longer be used to sign in.`,\n confirmDelete: \"Delete passkey\",\n created: (date) => `Added ${date}`,\n lastUsed: (date) => `Last used ${date}`,\n neverUsed: \"Never used\",\n },\n};\n\n/**\n * One section of the namespace, resolved: English, then the provider's\n * `accountSettings.<section>`, then the component's own `labels` prop. An `undefined`\n * in either source is skipped, so a prop object built from optional values cannot\n * blank out a default.\n */\nexport function useAccountSettingsLabels<K extends keyof AccountSettingsLabels>(\n section: K,\n prop?: Partial<AccountSettingsLabels[K]>,\n): AccountSettingsLabels[K] {\n const fromProvider = useKitLabelOverrides(\"accountSettings\")?.[section] as\n | Partial<AccountSettingsLabels[K]>\n | undefined;\n return useMemo(\n () => ({\n ...DEFAULT_ACCOUNT_SETTINGS_LABELS[section],\n ...definedOnly(fromProvider),\n ...definedOnly(prop),\n }),\n [section, fromProvider, prop],\n );\n}\n\nfunction definedOnly<T extends object>(value: T | undefined): Partial<T> {\n if (!value) return {};\n return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== undefined)) as Partial<T>;\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,4BAA4B;AAiJ9B,MAAM,kCAAyD;AAAA,EACpE,SAAS;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,MAAM;AAAA,IACN,WAAW;AAAA,IACX,UAAU;AAAA,IACV,cAAc;AAAA,EAChB;AAAA,EACA,UAAU;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,UAAU;AAAA;AAAA,IAEV,eAAe;AAAA,EACjB;AAAA,EACA,WAAW;AAAA,IACT,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,cAAc;AAAA,IACd,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,SAAS;AAAA;AAAA,IAET,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACT;AAAA,EACA,UAAU;AAAA,IACR,OAAO;AAAA,IACP,aAAa;AAAA;AAAA;AAAA,IAGb,sBAAsB;AAAA,IACtB,OAAO;AAAA,IACP,SAAS;AAAA,IACT,MAAM;AAAA,IACN,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,YAAY,CAAC,SAAS,UAAU,IAAI;AAAA,IACpC,aAAa,CAAC,SAAS,gBAAgB,IAAI;AAAA,IAC3C,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,YAAY,CAAC,SAAS,UAAU,IAAI;AAAA,IACpC,eAAe,CAAC,SAAS,gBAAW,IAAI;AAAA,IACxC,eAAe;AAAA,IACf,SAAS,CAAC,SAAS,SAAS,IAAI;AAAA,IAChC,UAAU,CAAC,SAAS,aAAa,IAAI;AAAA,IACrC,WAAW;AAAA,EACb;AACF;AAQO,SAAS,yBACd,SACA,MAC0B;AAC1B,QAAM,eAAe,qBAAqB,iBAAiB,IAAI,OAAO;AAGtE,SAAO;AAAA,IACL,OAAO;AAAA,MACL,GAAG,gCAAgC,OAAO;AAAA,MAC1C,GAAG,YAAY,YAAY;AAAA,MAC3B,GAAG,YAAY,IAAI;AAAA,IACrB;AAAA,IACA,CAAC,SAAS,cAAc,IAAI;AAAA,EAC9B;AACF;AAEA,SAAS,YAA8B,OAAkC;AACvE,MAAI,CAAC,MAAO,QAAO,CAAC;AACpB,SAAO,OAAO,YAAY,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,MAAM,MAAM,MAAS,CAAC;AACpF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/account/account-settings-labels.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport { useKitLabelOverrides } from \"../i18n/kit-labels\";\n\n/**\n * The `accountSettings` namespace of `<UiKitProvider labels>`: one record per section —\n * `profile`, `password`, `twoFactor`, `passkeys` — each merged key by key, so an app\n * can translate `accountSettings.twoFactor.scanHint` alone.\n *\n * Before 0.12.0 every section took a REQUIRED `labels` prop and had no English of its\n * own, so each app spelled out 30-odd keys at the call site and still hard-coded some\n * (kastlan's profile page passed `email: \"Email\"` in English to a German page). The\n * prop stays, now partial, and wins over the provider as everywhere else in the kit.\n *\n * Its own module, beside the components rather than in them, so `PasskeysSetting`\n * (its own file) and the older three read one tree without importing each other.\n */\n\nexport interface ProfileSettingLabels {\n title: string;\n email: string;\n role: string;\n memberSince: string;\n /** The single name field — the card without `firstName` / `lastName`. */\n displayName: string;\n save: string;\n /**\n * 0.30.0 (docs/user-admin-harmonization.md §6.1): the two fields that replace\n * `displayName` once the card is given `firstName` / `lastName`. OPTIONAL, like\n * `TwoFactorSettingLabels.qrAlt` and for its reason — this interface is annotated at\n * call sites — and filled from the provider's `accountSettings.profile`, then English.\n */\n firstName?: string;\n lastName?: string;\n /** Why Save is held while a name is blank: both are required (§3.1). */\n nameRequired?: string;\n}\n\nexport interface PasswordSettingLabels {\n title: string;\n current: string;\n next: string;\n confirm: string;\n submit: string;\n tooShort: string;\n mismatch: string;\n /**\n * 0.34 (KS U3): `password_incorrect` — server-kit's `400` for a wrong current\n * password — under the current-password field, in the words `EmailChangeSetting`\n * and `DeleteAccountSetting` say it with. OPTIONAL, like\n * `TwoFactorSettingLabels.qrAlt` and for its reason — this interface is annotated at\n * call sites — and filled from the provider's `accountSettings.password`, then English.\n */\n wrongPassword?: string;\n}\n\nexport interface TwoFactorSettingLabels {\n /**\n * Before 0.31 the card's one line, \"<status>: On\". Since 0.31 the setting's name is the\n * card's {@link title} and the state stands beside it, so this is read only where no\n * `title` is given at the same level — an app that translated `status` keeps its word\n * as the title.\n */\n status: string;\n enabledText: string;\n disabledText: string;\n enable: string;\n scanHint: string;\n codeLabel: string;\n verify: string;\n disableSection: string;\n password: string;\n disable: string;\n /**\n * Alt text for the setup QR code, which shipped as a hardcoded `alt=\"QR\"`.\n *\n * OPTIONAL, like the two keys below, and not because it matters less: this interface\n * is annotated at consumer call sites (`const LABELS: TwoFactorSettingLabels = {…}`),\n * so a new REQUIRED key is a compile error in every app on the next `npm update` —\n * the additive-API rule in the README. Each falls back to the provider's\n * `accountSettings.twoFactor`, then English.\n */\n qrAlt?: string;\n /** The line over the manual-entry key, for a phone that cannot scan its own screen. */\n secretHint?: string;\n /** The copy button beside that key. */\n copySecret?: string;\n /**\n * 0.31.0 (docs/settings-harmonization.md §3.7): the card's title, a heading inside a\n * `SettingsLayout`. OPTIONAL for the reason `qrAlt` is. Unset, the same source's\n * `status` stands in for it, then English.\n */\n title?: string;\n}\n\nexport interface PasskeysSettingLabels {\n title: string;\n /** The line under the title saying what a passkey is for — `mode=\"instead\"` (the\n * default): the passkey stands in for the password. */\n description: string;\n /**\n * The same line for `mode=\"alongside\"` (0.18.0): the password keeps working and the\n * passkey is a second way in. OPTIONAL for the reason `TwoFactorSettingLabels.qrAlt`\n * is — this interface is annotated at call sites — and filled from the provider's\n * `accountSettings.passkeys`, then English.\n */\n descriptionAlongside?: string;\n empty: string;\n loading: string;\n /** Accessible name of the list. */\n list: string;\n nameLabel: string;\n namePlaceholder: string;\n add: string;\n /** The add button while the app's WebAuthn ceremony runs — the OS prompt is open. */\n adding: string;\n rename: string;\n /** The row's rename button, named for its passkey — it starts with `rename`, the\n * visible text, so voice control finds it by what it says. */\n renameItem: (name: string) => string;\n /** Accessible name of the inline rename field. */\n renameField: (name: string) => string;\n save: string;\n cancel: string;\n delete: string;\n /** The row's delete button, named for its passkey (see `renameItem`). */\n deleteItem: (name: string) => string;\n /** The inline question a delete asks first. */\n deleteConfirm: (name: string) => string;\n /** The destructive button that answers it. */\n confirmDelete: string;\n /** `date` arrives formatted in the provider's locale. */\n created: (date: string) => string;\n lastUsed: (date: string) => string;\n neverUsed: string;\n}\n\nexport interface AccountSettingsLabels {\n profile: Required<ProfileSettingLabels>;\n password: Required<PasswordSettingLabels>;\n // `Required` here, optional on the section interfaces: the namespace is what a full\n // catalogue (`@eifi1/ui-kit/i18n/<code>`, `missingKitLabels`) is written against, so\n // it must name the late keys; the section interfaces are annotated at call sites.\n twoFactor: Required<TwoFactorSettingLabels>;\n passkeys: Required<PasskeysSettingLabels>;\n}\n\nexport const DEFAULT_ACCOUNT_SETTINGS_LABELS: AccountSettingsLabels = {\n profile: {\n title: \"Profile\",\n email: \"Email\",\n role: \"Role\",\n memberSince: \"Member since\",\n displayName: \"Display name\",\n save: \"Save\",\n firstName: \"First name\",\n lastName: \"Last name\",\n nameRequired: \"Enter both a first and a last name.\",\n },\n password: {\n title: \"Change password\",\n current: \"Current password\",\n next: \"New password\",\n confirm: \"Confirm new password\",\n submit: \"Change password\",\n tooShort: \"The new password is too short.\",\n mismatch: \"The passwords don’t match.\",\n // The siblings' sentence (emailChange, deleteAccount), under the current password.\n wrongPassword: \"The password is incorrect.\",\n },\n twoFactor: {\n status: \"Two-factor authentication\",\n enabledText: \"On\",\n disabledText: \"Off\",\n enable: \"Set up two-factor authentication\",\n scanHint: \"Scan this code with your authenticator app, then enter the code it shows.\",\n codeLabel: \"Verification code\",\n verify: \"Verify and turn on\",\n disableSection: \"Turn off two-factor authentication\",\n password: \"Current password\",\n disable: \"Turn off\",\n // Unchanged from the fallback it had before the namespace (i18n-labels.test pins it).\n qrAlt: \"QR code\",\n secretHint: \"Can’t scan it? Enter this key in the app instead:\",\n copySecret: \"Copy key\",\n title: \"Two-factor authentication\",\n },\n passkeys: {\n title: \"Passkeys\",\n description: \"Sign in with your fingerprint, face or device PIN instead of a password.\",\n // Kurvenschmiede overrode `description` because \"instead of\" is false where the\n // password stays; this is the sentence for those apps, picked by `mode`.\n descriptionAlongside: \"Sign in with your fingerprint, face or device PIN. Your password keeps working too.\",\n empty: \"No passkeys yet\",\n loading: \"Loading passkeys…\",\n list: \"Your passkeys\",\n nameLabel: \"Name (optional)\",\n namePlaceholder: \"e.g. Laptop, Phone\",\n add: \"Add passkey\",\n adding: \"Waiting for your device…\",\n rename: \"Rename\",\n renameItem: (name) => `Rename ${name}`,\n renameField: (name) => `New name for ${name}`,\n save: \"Save\",\n cancel: \"Cancel\",\n delete: \"Delete\",\n deleteItem: (name) => `Delete ${name}`,\n deleteConfirm: (name) => `Delete “${name}”? It can no longer be used to sign in.`,\n confirmDelete: \"Delete passkey\",\n created: (date) => `Added ${date}`,\n lastUsed: (date) => `Last used ${date}`,\n neverUsed: \"Never used\",\n },\n};\n\n/**\n * One section of the namespace, resolved: English, then the provider's\n * `accountSettings.<section>`, then the component's own `labels` prop. An `undefined`\n * in either source is skipped, so a prop object built from optional values cannot\n * blank out a default.\n */\nexport function useAccountSettingsLabels<K extends keyof AccountSettingsLabels>(\n section: K,\n prop?: Partial<AccountSettingsLabels[K]>,\n): AccountSettingsLabels[K] {\n const fromProvider = useKitLabelOverrides(\"accountSettings\")?.[section] as\n Partial<AccountSettingsLabels[K]> | undefined;\n return useMemo(\n () => ({\n ...DEFAULT_ACCOUNT_SETTINGS_LABELS[section],\n ...definedOnly(fromProvider),\n ...definedOnly(prop),\n }),\n [section, fromProvider, prop],\n );\n}\n\nfunction definedOnly<T extends object>(value: T | undefined): Partial<T> {\n if (!value) return {};\n return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== undefined)) as Partial<T>;\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,4BAA4B;AAiJ9B,MAAM,kCAAyD;AAAA,EACpE,SAAS;AAAA,IACP,OAAO;AAAA,IACP,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,MAAM;AAAA,IACN,WAAW;AAAA,IACX,UAAU;AAAA,IACV,cAAc;AAAA,EAChB;AAAA,EACA,UAAU;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,UAAU;A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,QAAO,CAAC;AACpB,SAAO,OAAO,YAAY,OAAO,QAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,MAAM,MAAM,MAAS,CAAC;AACpF;","names":[]}
|
|
@@ -340,14 +340,7 @@ function TwoFactorSetting({
|
|
|
340
340
|
"otpauthUri" in setup ? (
|
|
341
341
|
// No backing of its own: QrCode draws its quiet zone white inside the SVG.
|
|
342
342
|
/* @__PURE__ */ jsx("div", { "data-private": true, className: "inline-block overflow-hidden rounded-md", children: renderQr ? renderQr(setup.otpauthUri) : /* @__PURE__ */ jsx(QrCode, { value: setup.otpauthUri, label: labels.qrAlt, className: "size-48" }) })
|
|
343
|
-
) : /* @__PURE__ */ jsx("div", { "data-private": true, className: "inline-block rounded-md bg-white p-2", children: /* @__PURE__ */ jsx(
|
|
344
|
-
"img",
|
|
345
|
-
{
|
|
346
|
-
alt: labels.qrAlt,
|
|
347
|
-
src: `data:image/svg+xml;base64,${setup.qrSvg}`,
|
|
348
|
-
className: "h-48 w-48"
|
|
349
|
-
}
|
|
350
|
-
) }),
|
|
343
|
+
) : /* @__PURE__ */ jsx("div", { "data-private": true, className: "inline-block rounded-md bg-white p-2", children: /* @__PURE__ */ jsx("img", { alt: labels.qrAlt, src: `data:image/svg+xml;base64,${setup.qrSvg}`, className: "h-48 w-48" }) }),
|
|
351
344
|
secret && /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
352
345
|
/* @__PURE__ */ jsx("div", { className: "text-xs text-secondary", children: labels.secretHint }),
|
|
353
346
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
@@ -375,7 +368,16 @@ function TwoFactorSetting({
|
|
|
375
368
|
] }),
|
|
376
369
|
enabled && /* @__PURE__ */ jsxs("div", { className: "space-y-3 border-t border-subtle pt-3", children: [
|
|
377
370
|
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: labels.disableSection }),
|
|
378
|
-
/* @__PURE__ */ jsx(
|
|
371
|
+
/* @__PURE__ */ jsx(
|
|
372
|
+
Input,
|
|
373
|
+
{
|
|
374
|
+
type: "password",
|
|
375
|
+
autoComplete: "current-password",
|
|
376
|
+
label: labels.password,
|
|
377
|
+
value: password,
|
|
378
|
+
onChange: (e) => setPassword(e.target.value)
|
|
379
|
+
}
|
|
380
|
+
),
|
|
379
381
|
/* @__PURE__ */ jsx(
|
|
380
382
|
OneTimeCodeInput,
|
|
381
383
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/account-settings.tsx"],"sourcesContent":["import { useId, useRef, useState } from \"react\";\nimport type { ChangeEvent, FormEvent, KeyboardEvent, ReactNode, RefObject } from \"react\";\nimport { Button } from \"../components/button\";\nimport { Card } from \"../components/card\";\nimport { Input } from \"../components/input\";\nimport { UserAvatar } from \"../components/user-avatar\";\nimport { CopyButton } from \"../components/copy-button\";\nimport { QrCode } from \"../components/qr-code\";\nimport { OneTimeCodeInput } from \"../components/one-time-code-input\";\nimport { usePromisePending } from \"../components/danger-confirm\";\nimport { personNameOk, PERSON_NAME_MAX_LENGTH } from \"../auth/form-rules\";\nimport {\n DEFAULT_PASSWORD_STRENGTH_LABELS,\n passwordByteLength,\n PasswordStrengthMeter,\n} from \"../components/password-strength\";\nimport type { PasswordStrengthMeterProps } from \"../components/password-strength\";\nimport { useKitLabelOverrides, useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { Chip } from \"../components/chip\";\nimport { useAccountSettingsLabels } from \"./account-settings-labels\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport type {\n PasswordSettingLabels,\n ProfileSettingLabels,\n TwoFactorSettingLabels,\n} from \"./account-settings-labels\";\nimport { COMMIT_EXCEPT_BILLING } from \"../components/write-lock\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { hasContent } from \"../lib/presence\";\nimport { authErrorCode } from \"../auth/auth-errors\";\n\n// The label types moved beside the namespace's defaults (0.12.0); re-exported here so\n// every existing `import type { ProfileSettingLabels }` keeps resolving.\nexport type {\n AccountSettingsLabels,\n PasskeysSettingLabels,\n PasswordSettingLabels,\n ProfileSettingLabels,\n TwoFactorSettingLabels,\n} from \"./account-settings-labels\";\nexport { DEFAULT_ACCOUNT_SETTINGS_LABELS } from \"./account-settings-labels\";\n\n/**\n * App-agnostic account-settings SECTIONS (feedback #333). The presentation lives\n * in @hb/ui; each app injects its own auth-API handlers + translated labels and\n * arranges these next to its own app-specific cards (appearance, budgets, …).\n * Every section is a self-contained <Card> owning its transient form state.\n *\n * Every `labels` prop is optional since 0.12.0: the strings come from the provider's\n * `accountSettings` namespace, then English (see account-settings-labels.ts).\n */\n\n/** What {@link ProfileSetting} hands `onSave` in its two-field form (0.30.0): both\n * trimmed, 1–120 characters each — the `PATCH /auth/me` body's `first_name` /\n * `last_name` (docs/user-admin-harmonization.md §6.1). */\nexport interface ProfileNameValues {\n firstName: string;\n lastName: string;\n}\n\n/** What both forms of {@link ProfileSetting} take. */\ninterface ProfileSettingCommonProps {\n name?: string | null;\n email?: string | null;\n role?: ReactNode;\n memberSince?: ReactNode;\n saving?: boolean;\n /** Prop > `<UiKitProvider labels={{ accountSettings: { profile } }}>` > English. */\n labels?: LabelOverride<ProfileSettingLabels>;\n /** The card's DOM id — a settings catalogue `anchor`, so `?focus=` can ring it (0.31). */\n id?: string;\n}\n\n/**\n * The single display name, as before 0.30.0 — controlled through `value` / `onChange`,\n * saved by `onSave()`. Kept unchanged for an app that has not moved to first and last\n * name yet.\n */\nexport interface ProfileSettingDisplayNameProps extends ProfileSettingCommonProps {\n value: string;\n onChange: (value: string) => void;\n onSave: () => void;\n firstName?: undefined;\n lastName?: undefined;\n}\n\n/**\n * First and last name (0.30.0, docs/user-admin-harmonization.md §6.1): the saved\n * values in, the edited ones out through `onSave`. The card keeps the drafts itself.\n */\nexport interface ProfileSettingNamesProps extends ProfileSettingCommonProps {\n /** The saved given name — `first_name`. `null` reads as empty. */\n firstName: string | null;\n /** The saved family name — `last_name`. `null` (a migrated account, §3.3) reads as\n * empty, and Save then waits for one. */\n lastName: string | null;\n /**\n * Save the two names (`PATCH /auth/me`, which also clears `name_incomplete`). Return\n * a promise and Save is busy until it settles. Refresh `firstName` / `lastName` from\n * the answer: the card compares its drafts with them, so Save turns off once the new\n * names come back. A rejection keeps what was typed — the app says why (a toast), as\n * for `PasswordSetting`.\n */\n onSave: (values: ProfileNameValues) => void | Promise<unknown>;\n value?: undefined;\n onChange?: undefined;\n}\n\nexport type ProfileSettingProps = ProfileSettingDisplayNameProps | ProfileSettingNamesProps;\n\n/**\n * The profile section: avatar, address, role, member since, and the name.\n *\n * **Two forms.** Given `firstName` / `lastName` (0.30.0, §6.1) it edits first and last\n * name in two fields, side by side where the card is wide enough — the order and the\n * 1–120-character rule of `RegisterForm` (auth §3.1), so the name a person signed up\n * with is edited the way it was typed. Without them it is the single `displayName`\n * field it always was, `value` / `onChange` / `onSave()` unchanged, for an app that has\n * not moved yet (kastlan split the one name at its first space on save; Kurvenschmiede\n * built its own card instead).\n *\n * The two-field form owns its drafts, starting from the saved names and following them\n * when they change; Save waits for a change, holds — saying why — while a name is\n * blank, and is a `commit` (a {@link WriteLockProvider} locks it, keksdose's demo) —\n * every lock but a lapsed plan's (`COMMIT_EXCEPT_BILLING`, 0.33): a profile is the\n * account's own settings, which billing never locks (docs/billing-harmonization.md §3.3,\n * §12.36).\n */\nexport function ProfileSetting(props: ProfileSettingProps) {\n const { name, email, role, memberSince, labels: labelsProp, id } = props;\n const labels = useAccountSettingsLabels(\"profile\", labelsProp);\n const names = props.firstName !== undefined || props.lastName !== undefined;\n return (\n <Card id={id} className=\"p-4 space-y-3\">\n <div className=\"flex items-center gap-3\">\n <UserAvatar\n name={name}\n email={email}\n person={names ? { first: props.firstName, last: props.lastName } : undefined}\n size=\"lg\"\n />\n <div className=\"min-w-0\">\n {/* A heading inside a SettingsLayout (0.31, docs/settings-harmonization.md\n §3.7), the plain div it always was outside one. */}\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <div className=\"truncate-until-large font-mono text-xs text-muted\">\n {/* `email` was a required key that nothing rendered; it names the address\n for a screen reader, which otherwise hears a bare string under a title. */}\n <span className=\"sr-only\">{labels.email}: </span>\n {email ?? \"—\"}\n </div>\n </div>\n </div>\n <div className=\"grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1 text-sm\">\n <span className=\"text-muted\">{labels.role}</span>\n <span>{role ?? \"—\"}</span>\n <span className=\"text-muted\">{labels.memberSince}</span>\n <span>{memberSince ?? \"—\"}</span>\n </div>\n {names ? (\n <PersonNameFields\n firstName={props.firstName ?? \"\"}\n lastName={props.lastName ?? \"\"}\n onSave={(props as ProfileSettingNamesProps).onSave}\n saving={props.saving}\n labels={labels}\n />\n ) : (\n <DisplayNameField\n name={name}\n value={(props as ProfileSettingDisplayNameProps).value}\n onChange={(props as ProfileSettingDisplayNameProps).onChange}\n onSave={(props as ProfileSettingDisplayNameProps).onSave}\n saving={props.saving}\n labels={labels}\n />\n )}\n </Card>\n );\n}\n\n/** The single-name form — exactly the 0.29 card's field and button. */\nfunction DisplayNameField({\n name,\n value,\n onChange,\n onSave,\n saving,\n labels,\n}: {\n name?: string | null;\n value: string;\n onChange: (value: string) => void;\n onSave: () => void;\n saving?: boolean;\n labels: Required<ProfileSettingLabels>;\n}) {\n const dirty = value.trim().length > 0 && value.trim() !== (name ?? \"\");\n // Generated, not the literal \"display-name\" it was: two of these on one page (an\n // admin editing someone else's profile beside their own) shared an id, and the\n // second label pointed at the first field.\n const inputId = useId();\n return (\n <>\n <Input\n id={inputId}\n label={labels.displayName}\n value={value}\n onChange={(e) => onChange(e.target.value)}\n maxLength={120}\n />\n <Button onClick={onSave} disabled={!dirty || saving}>\n {labels.save}\n </Button>\n </>\n );\n}\n\n/** The first-and-last form (0.30.0, §6.1). */\nfunction PersonNameFields({\n firstName,\n lastName,\n onSave,\n saving,\n labels,\n}: {\n firstName: string;\n lastName: string;\n onSave: (values: ProfileNameValues) => void | Promise<unknown>;\n saving?: boolean;\n labels: Required<ProfileSettingLabels>;\n}) {\n const [first, setFirst] = useState(firstName);\n const [last, setLast] = useState(lastName);\n // The saved names moved (the save came back, another tab renamed): the drafts follow\n // them. During render, as DangerConfirm resets its fields, so no frame shows the old\n // draft beside the new name.\n const [saved, setSaved] = useState({ firstName, lastName });\n if (saved.firstName !== firstName || saved.lastName !== lastName) {\n setSaved({ firstName, lastName });\n setFirst(firstName);\n setLast(lastName);\n }\n const { pending, run } = usePromisePending();\n const busy = Boolean(saving) || pending;\n const valid = personNameOk(first) && personNameOk(last);\n const dirty = first.trim() !== firstName.trim() || last.trim() !== lastName.trim();\n\n const submit = (e: FormEvent) => {\n e.preventDefault();\n if (!valid || !dirty || busy) return;\n // A rejection keeps the drafts; the app reports it, as PasswordSetting's does.\n run(onSave({ firstName: first.trim(), lastName: last.trim() }), () => {});\n };\n\n return (\n <form className=\"@container space-y-3\" onSubmit={submit} noValidate>\n {/* The order and the rule of RegisterForm's two fields (auth §3.1). */}\n <div className=\"grid gap-3 @xs:grid-cols-2\">\n <Input\n name=\"given-name\"\n autoComplete=\"given-name\"\n label={labels.firstName}\n value={first}\n onChange={(e) => setFirst(e.target.value)}\n maxLength={PERSON_NAME_MAX_LENGTH}\n readOnly={busy}\n required\n />\n <Input\n name=\"family-name\"\n autoComplete=\"family-name\"\n label={labels.lastName}\n value={last}\n onChange={(e) => setLast(e.target.value)}\n maxLength={PERSON_NAME_MAX_LENGTH}\n readOnly={busy}\n required\n />\n </div>\n <Button\n type=\"submit\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={busy}\n // A blank name is a reason the person can act on; an unchanged one is not —\n // there is nothing to save, and the button is simply off.\n disabled={valid && !dirty}\n disabledReason={valid ? undefined : labels.nameRequired}\n >\n {labels.save}\n </Button>\n </form>\n );\n}\n\n/**\n * What {@link PasswordSetting}'s `strength` takes besides `true`: the meter's own options,\n * minus the ones the card owns — `value` (the new password), `minLength` (the card's, so\n * the checklist's length rule and the submit's check are one number) and `maxBytes`\n * (the card's own prop, which the submit enforces as well).\n */\nexport type PasswordSettingStrength = Pick<PasswordStrengthMeterProps, \"score\" | \"showRequirements\" | \"labels\">;\n\n/**\n * Changing the account's password: the current one, the new one twice, then the app's\n * `onSubmit`.\n *\n * **Refusals under their fields** (0.34, KS U3). The card's own checks say why under the\n * field they are about — too short or too long under the new password, a mismatch under\n * the confirmation — and a server's `password_incorrect` (server-kit's `400` for a wrong\n * current password; an older `invalid_credentials` too) is read from `onSubmit`'s\n * rejection by code ({@link authErrorCode}) and said under the current password, in\n * `EmailChangeSetting`'s and `DeleteAccountSetting`'s words. The field in error takes\n * the focus, so its message is read with it. Until 0.34 the card swallowed every\n * rejection and each app toasted the wrong password itself, in three spellings.\n *\n * **Anything else** is the app's: `describeError` puts its words in the card (a banner\n * over the button), and without it the card shows nothing — the app's own toast, as\n * before. The fields keep what was typed for a retry; a resolved `onSubmit` empties\n * them.\n */\nexport function PasswordSetting({\n onSubmit,\n pending,\n minLength = 8,\n strength,\n maxBytes,\n describeError,\n labels: labelsProp,\n id,\n}: {\n /**\n * Called with the validated (current, new) pair; return a promise to auto-clear on\n * success. Reject with the client's error: `password_incorrect` is said under the\n * current password; anything else goes through `describeError`, else stays the app's\n * to say (a toast).\n */\n onSubmit: (currentPassword: string, newPassword: string) => void | Promise<unknown>;\n pending?: boolean;\n /** The shortest new password the card submits, in characters as a person counts them\n * (an emoji is one). Keep it in step with the server's own minimum. Default 8. */\n minLength?: number;\n /**\n * Show the {@link PasswordStrengthMeter} under the new-password field (0.22.0,\n * kastlan's input audit): the bar, the level in words and the checklist, with the\n * length rule drawn from `minLength`. `true` for the meter as it comes; an object for\n * its `score` (zxcvbn's, say), `showRequirements` or `labels`.\n *\n * Off by default, so a card that never asked for it does not grow one. The meter is\n * advisory, as everywhere in the kit: it blocks nothing — the card's own checks do\n * (`minLength`, the confirmation, `maxBytes`).\n */\n strength?: boolean | PasswordSettingStrength;\n /**\n * A byte ceiling on the new password — bcrypt reads at most 72 BYTES and ignores the\n * rest, which is kastlan's case: `maxBytes={72}`. A new password over it is refused\n * on submit with the meter's own \"too long\" sentence (the `passwordStrength`\n * namespace's `tooLong`), and the meter, when shown, warns while it is typed.\n *\n * Unset by default, and leave it unset for a secret with no ceiling: an invented one\n * talks people out of the long passphrase they chose.\n */\n maxBytes?: number;\n /**\n * The app's own words for a failure of `onSubmit`, said IN the card (a banner over the\n * button), or `undefined` for the kit's handling. Asked first, for every failure — as\n * `EmailChangeSetting`'s and `DeleteAccountSetting`'s are (0.34, KS U3): a demo's\n * refusal, the device offline, a `422` whose sentence the app has. Without it, or when\n * it answers `undefined`, the card says `password_incorrect` under the current password\n * and nothing else: the rest stays the app's own toast.\n */\n describeError?: (error: unknown) => ReactNode | undefined;\n /** Prop > `<UiKitProvider labels={{ accountSettings: { password } }}>` > English. */\n labels?: LabelOverride<PasswordSettingLabels>;\n /** The card's DOM id — a settings catalogue `anchor`, so `?focus=` can ring it (0.31). */\n id?: string;\n}) {\n const labels = useAccountSettingsLabels(\"password\", labelsProp);\n const strengthOptions = typeof strength === \"object\" ? strength : undefined;\n // Only for `tooLong`: the sentence the meter shows is the one the refusal says.\n const strengthLabels = useKitLabels(\"passwordStrength\", DEFAULT_PASSWORD_STRENGTH_LABELS, strengthOptions?.labels);\n const [current, setCurrent] = useState(\"\");\n const [next, setNext] = useState(\"\");\n const [confirm, setConfirm] = useState(\"\");\n // One refusal at a time, under the field it is about; the app's words in the banner.\n const [fieldError, setFieldError] = useState<{ field: PasswordField; message: string } | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const currentRef = useRef<HTMLInputElement>(null);\n const nextRef = useRef<HTMLInputElement>(null);\n const confirmRef = useRef<HTMLInputElement>(null);\n const refs: Record<PasswordField, RefObject<HTMLInputElement | null>> = {\n current: currentRef,\n next: nextRef,\n confirm: confirmRef,\n };\n\n // The field in error takes the focus, so its message (its description) is read with it.\n const refuse = (field: PasswordField, message: string) => {\n setFieldError({ field, message });\n refs[field].current?.focus();\n };\n const errorOf = (field: PasswordField) => (fieldError?.field === field ? fieldError.message : undefined);\n // Typing in a field answers its refusal, and the banner's: both go.\n const edit = (field: PasswordField, set: (value: string) => void) => (e: ChangeEvent<HTMLInputElement>) => {\n set(e.target.value);\n if (fieldError?.field === field) setFieldError(null);\n if (failure !== null) setFailure(null);\n };\n\n const present = (error: unknown) => {\n const own = describeError?.(error);\n if (hasContent(own)) {\n setFailure(own);\n return;\n }\n const code = authErrorCode(error);\n // `invalid_credentials` too, for a server that answered a wrong password so before\n // server-kit 0.4.0 named `password_incorrect` — the siblings' rule.\n if (code === \"password_incorrect\" || code === \"invalid_credentials\") {\n refuse(\"current\", labels.wrongPassword);\n }\n // Anything else is the app's to say (a toast), as before 0.34.\n };\n\n const submit = async () => {\n setFailure(null);\n // Code points, not UTF-16 units — the count the meter's checklist and a server's\n // `len()` use. `next.length` counted an emoji as two, so four of them passed a\n // minimum of eight that the meter beside the field said they missed.\n if ([...next].length < minLength) {\n refuse(\"next\", labels.tooShort);\n return;\n }\n if (maxBytes !== undefined && passwordByteLength(next) > maxBytes) {\n refuse(\"next\", strengthLabels.tooLong(maxBytes));\n return;\n }\n if (next !== confirm) {\n refuse(\"confirm\", labels.mismatch);\n return;\n }\n setFieldError(null);\n try {\n await onSubmit(current, next);\n setCurrent(\"\");\n setNext(\"\");\n setConfirm(\"\");\n } catch (error) {\n // Keep the fields for a retry, and say what the card can.\n present(error);\n }\n };\n\n // `error` passed on all three from the first render, so a message coming and going\n // never remounts a field and takes the caret with it (Input's `FieldGroup`).\n const nextField = (\n <Input\n ref={nextRef}\n type=\"password\"\n autoComplete=\"new-password\"\n label={labels.next}\n value={next}\n onChange={edit(\"next\", setNext)}\n error={errorOf(\"next\")}\n />\n );\n\n return (\n <Card id={id} className=\"p-4 space-y-3\">\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <Input\n ref={currentRef}\n type=\"password\"\n autoComplete=\"current-password\"\n label={labels.current}\n value={current}\n onChange={edit(\"current\", setCurrent)}\n error={errorOf(\"current\")}\n />\n {strength ? (\n // One box for the field and its meter, so the card's `space-y-3` spaces the pair\n // from its neighbours and the meter keeps its own small gap under the field.\n <div>\n {nextField}\n <PasswordStrengthMeter\n value={next}\n minLength={minLength}\n maxBytes={maxBytes}\n score={strengthOptions?.score}\n showRequirements={strengthOptions?.showRequirements}\n labels={strengthOptions?.labels}\n />\n </div>\n ) : (\n nextField\n )}\n <Input\n ref={confirmRef}\n type=\"password\"\n autoComplete=\"new-password\"\n label={labels.confirm}\n value={confirm}\n onChange={edit(\"confirm\", setConfirm)}\n error={errorOf(\"confirm\")}\n />\n {hasContent(failure) && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure}\n </AlertBanner>\n )}\n <Button onClick={() => void submit()} disabled={!current || !next || !confirm || pending}>\n {labels.submit}\n </Button>\n </Card>\n );\n}\n\n/** The three fields of {@link PasswordSetting}, for the refusal that names one. */\ntype PasswordField = \"current\" | \"next\" | \"confirm\";\n\n/**\n * What the app's setup call returned.\n *\n * `otpauthUri` (0.12.0) is what an authenticator backend actually hands out; the kit\n * draws the QR code itself ({@link QrCode}) and reads the manual-entry key out of the\n * URI's `secret` parameter when `secret` is not given. The `qrSvg` shape — a\n * base64-encoded SVG image — is what the section took before, which made every app\n * render a QR library to a static string and base64 it only for the kit to draw it back.\n */\nexport type TwoFactorSetupData =\n | { qrSvg: string; secret: string }\n | { otpauthUri: string; secret?: string };\n\n/** The `secret` parameter of an `otpauth://` URI, or null. */\nfunction otpauthSecret(uri: string): string | null {\n const match = /[?&]secret=([^&#]*)/i.exec(uri);\n if (!match) return null;\n try {\n return decodeURIComponent(match[1]) || null;\n } catch {\n return match[1] || null;\n }\n}\n\n/** \"JBSW Y3DP EHPK 3PXP\": the key in groups of four, which is how an authenticator's\n * manual-entry screen shows it and how a person copies it by eye. */\nfunction groupSecret(secret: string): string {\n return secret.replace(/\\s+/g, \"\").replace(/(.{4})(?=.)/g, \"$1 \");\n}\n\nexport function TwoFactorSetting({\n enabled,\n setup,\n onStartSetup,\n onEnable,\n onDisable,\n busy,\n renderQr,\n labels: labelsProp,\n id,\n}: {\n enabled: boolean;\n /** What the app's setup call returned; null before setup starts. */\n setup: TwoFactorSetupData | null;\n onStartSetup: () => void;\n onEnable: (code: string) => void;\n onDisable: (password: string, code: string) => void;\n busy?: boolean;\n /** Draw the code yourself (a branded QR, a library you already ship). Given the\n * `otpauthUri`; the kit's own {@link QrCode} otherwise. Unused with `qrSvg`. */\n renderQr?: (otpauthUri: string) => ReactNode;\n /** Prop > `<UiKitProvider labels={{ accountSettings: { twoFactor } }}>` > English. */\n labels?: LabelOverride<TwoFactorSettingLabels>;\n /** The card's DOM id — a settings catalogue `anchor`, so `?focus=` can ring it (0.31). */\n id?: string;\n}) {\n const labels = useAccountSettingsLabels(\"twoFactor\", labelsProp);\n // The title (0.31, docs/settings-harmonization.md §3.7) is new, and an app that\n // translated this card before it named the setting in `status` — \"2FA\",\n // \"Zwei-Faktor-Authentifizierung\". Each source's `title` first, then its `status`, so\n // that app keeps its own word instead of meeting the English title.\n const overrides = useKitLabelOverrides(\"accountSettings\")?.twoFactor;\n const title = labelsProp?.title ?? overrides?.title ?? labelsProp?.status ?? overrides?.status ?? labels.title;\n const [code, setCode] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n // Both code fields are a OneTimeCodeInput (0.22.0) — the field this card wrote by hand\n // twice — and keep what they did:\n // - `readOnlyUntilFocus`: browsers autofill a one-time-code field with the saved\n // username (the disable form has a current-password field right above it), and a\n // read-only field is never autofilled. The guard drops on focus, and the field\n // keeps the look of an editable one meanwhile (FIELD_WRITABLE_LOOK) — see the prop.\n // - `length={8}`: the `maxLength={8}` they had, so an authenticator issuing eight\n // digits still fits. What changed is that they now take digits only: \"123 456\"\n // pasted from an authenticator that groups its digits used to reach `onEnable`\n // with the space in it.\n // - one `code` state for both, as before.\n const secret = setup\n ? (setup.secret ?? (\"otpauthUri\" in setup ? otpauthSecret(setup.otpauthUri) : null))\n : null;\n\n return (\n <Card id={id} className=\"p-4 space-y-3\">\n {/* The card had only \"Two-factor authentication: Off\". A settings page outlines its\n cards by their titles (§3.7), so the setting's name is the title now, and the\n state stands beside it as a chip instead of repeating the name. */}\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <SettingsCardTitle>{title}</SettingsCardTitle>\n <Chip size=\"sm\" tone={enabled ? \"success\" : \"neutral\"}>\n {enabled ? labels.enabledText : labels.disabledText}\n </Chip>\n </div>\n\n {!enabled && !setup && (\n <Button onClick={onStartSetup} disabled={busy}>\n {labels.enable}\n </Button>\n )}\n\n {setup && (\n <div className=\"space-y-2\">\n <div className=\"text-xs text-secondary\">{labels.scanHint}</div>\n {/* `bg-white`, NOT `--bg-surface`, and it must stay that way: a QR code is\n read by a camera looking for maximum contrast between the modules and\n their quiet zone. On the dark theme a surface-coloured backing makes it\n slow to acquire, and on a warm light preset it lowers the contrast ratio\n the spec is written against. This is the one place in the kit where a\n literal colour is the correct answer. `data-private`: the code IS the\n second factor, and demo mode blurs it like any other secret. */}\n {\"otpauthUri\" in setup ? (\n // No backing of its own: QrCode draws its quiet zone white inside the SVG.\n <div data-private className=\"inline-block overflow-hidden rounded-md\">\n {renderQr ? (\n renderQr(setup.otpauthUri)\n ) : (\n <QrCode value={setup.otpauthUri} label={labels.qrAlt} className=\"size-48\" />\n )}\n </div>\n ) : (\n <div data-private className=\"inline-block rounded-md bg-white p-2\">\n <img\n alt={labels.qrAlt}\n src={`data:image/svg+xml;base64,${setup.qrSvg}`}\n className=\"h-48 w-48\"\n />\n </div>\n )}\n {secret && (\n <div className=\"space-y-1\">\n <div className=\"text-xs text-secondary\">{labels.secretHint}</div>\n <div className=\"flex items-center gap-1\">\n {/* `dir=\"ltr\"`: a base32 key is Latin letters and digits in a fixed\n order, and in an RTL page the groups would otherwise be laid out\n right to left. */}\n <code data-private dir=\"ltr\" className=\"break-all font-mono text-xs select-all\">\n {groupSecret(secret)}\n </code>\n <CopyButton text={secret} label={labels.copySecret} size=\"xs\" tone=\"muted\" />\n </div>\n </div>\n )}\n <OneTimeCodeInput\n readOnlyUntilFocus\n length={8}\n label={labels.codeLabel}\n value={code}\n onChange={setCode}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && code && !busy) {\n e.preventDefault();\n onEnable(code);\n }\n }}\n />\n <Button onClick={() => onEnable(code)} disabled={!code || busy}>\n {labels.verify}\n </Button>\n </div>\n )}\n\n {enabled && (\n <div className=\"space-y-3 border-t border-subtle pt-3\">\n <div className=\"text-sm font-medium\">{labels.disableSection}</div>\n <Input type=\"password\" autoComplete=\"current-password\" label={labels.password} value={password} onChange={(e) => setPassword(e.target.value)} />\n <OneTimeCodeInput\n readOnlyUntilFocus\n length={8}\n label={labels.codeLabel}\n value={code}\n onChange={setCode}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && password && code && !busy) {\n e.preventDefault();\n onDisable(password, code);\n }\n }}\n />\n <Button variant=\"danger\" onClick={() => onDisable(password, code)} disabled={!password || !code || busy}>\n {labels.disable}\n </Button>\n </div>\n )}\n </Card>\n );\n}\n"],"mappings":";AAuIQ,SAoEJ,UApEI,KAaI,YAbJ;AAvIR,SAAS,OAAO,QAAQ,gBAAgB;AAExC,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,cAAc,8BAA8B;AACrD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,sBAAsB,oBAAwC;AACvE,SAAS,YAAY;AACrB,SAAS,gCAAgC;AACzC,SAAS,yBAAyB;AAMlC,SAAS,6BAA6B;AACtC,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAW9B,SAAS,uCAAuC;AAwFzC,S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AO,UAAU,OAAO,UAAU,UAAU,CAAC,MAAM,YAAY,EAAE,OAAO,KAAK,GAAG;AAAA,MAC9I;AAAA,QAAC;AAAA;AAAA,UACC,oBAAkB;AAAA,UAClB,QAAQ;AAAA,UACR,OAAO,OAAO;AAAA,UACd,OAAO;AAAA,UACP,UAAU;AAAA,UACV,WAAW,CAAC,MAAuC;AACjD,gBAAI,EAAE,QAAQ,WAAW,YAAY,QAAQ,CAAC,MAAM;AAClD,gBAAE,eAAe;AACjB,wBAAU,UAAU,IAAI;AAAA,YAC1B;AAAA,UACF;AAAA;AAAA,MACF;AAAA,MACA,oBAAC,UAAO,SAAQ,UAAS,SAAS,MAAM,UAAU,UAAU,IAAI,GAAG,UAAU,CAAC,YAAY,CAAC,QAAQ,MAChG,iBAAO,SACV;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/account/account-settings.tsx"],"sourcesContent":["import { useId, useRef, useState } from \"react\";\nimport type { ChangeEvent, FormEvent, KeyboardEvent, ReactNode, RefObject } from \"react\";\nimport { Button } from \"../components/button\";\nimport { Card } from \"../components/card\";\nimport { Input } from \"../components/input\";\nimport { UserAvatar } from \"../components/user-avatar\";\nimport { CopyButton } from \"../components/copy-button\";\nimport { QrCode } from \"../components/qr-code\";\nimport { OneTimeCodeInput } from \"../components/one-time-code-input\";\nimport { usePromisePending } from \"../components/danger-confirm\";\nimport { personNameOk, PERSON_NAME_MAX_LENGTH } from \"../auth/form-rules\";\nimport {\n DEFAULT_PASSWORD_STRENGTH_LABELS,\n passwordByteLength,\n PasswordStrengthMeter,\n} from \"../components/password-strength\";\nimport type { PasswordStrengthMeterProps } from \"../components/password-strength\";\nimport { useKitLabelOverrides, useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { Chip } from \"../components/chip\";\nimport { useAccountSettingsLabels } from \"./account-settings-labels\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport type { PasswordSettingLabels, ProfileSettingLabels, TwoFactorSettingLabels } from \"./account-settings-labels\";\nimport { COMMIT_EXCEPT_BILLING } from \"../components/write-lock\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { hasContent } from \"../lib/presence\";\nimport { authErrorCode } from \"../auth/auth-errors\";\n\n// The label types moved beside the namespace's defaults (0.12.0); re-exported here so\n// every existing `import type { ProfileSettingLabels }` keeps resolving.\nexport type {\n AccountSettingsLabels,\n PasskeysSettingLabels,\n PasswordSettingLabels,\n ProfileSettingLabels,\n TwoFactorSettingLabels,\n} from \"./account-settings-labels\";\nexport { DEFAULT_ACCOUNT_SETTINGS_LABELS } from \"./account-settings-labels\";\n\n/**\n * App-agnostic account-settings SECTIONS (feedback #333). The presentation lives\n * in @hb/ui; each app injects its own auth-API handlers + translated labels and\n * arranges these next to its own app-specific cards (appearance, budgets, …).\n * Every section is a self-contained <Card> owning its transient form state.\n *\n * Every `labels` prop is optional since 0.12.0: the strings come from the provider's\n * `accountSettings` namespace, then English (see account-settings-labels.ts).\n */\n\n/** What {@link ProfileSetting} hands `onSave` in its two-field form (0.30.0): both\n * trimmed, 1–120 characters each — the `PATCH /auth/me` body's `first_name` /\n * `last_name` (docs/user-admin-harmonization.md §6.1). */\nexport interface ProfileNameValues {\n firstName: string;\n lastName: string;\n}\n\n/** What both forms of {@link ProfileSetting} take. */\ninterface ProfileSettingCommonProps {\n name?: string | null;\n email?: string | null;\n role?: ReactNode;\n memberSince?: ReactNode;\n saving?: boolean;\n /** Prop > `<UiKitProvider labels={{ accountSettings: { profile } }}>` > English. */\n labels?: LabelOverride<ProfileSettingLabels>;\n /** The card's DOM id — a settings catalogue `anchor`, so `?focus=` can ring it (0.31). */\n id?: string;\n}\n\n/**\n * The single display name, as before 0.30.0 — controlled through `value` / `onChange`,\n * saved by `onSave()`. Kept unchanged for an app that has not moved to first and last\n * name yet.\n */\nexport interface ProfileSettingDisplayNameProps extends ProfileSettingCommonProps {\n value: string;\n onChange: (value: string) => void;\n onSave: () => void;\n firstName?: undefined;\n lastName?: undefined;\n}\n\n/**\n * First and last name (0.30.0, docs/user-admin-harmonization.md §6.1): the saved\n * values in, the edited ones out through `onSave`. The card keeps the drafts itself.\n */\nexport interface ProfileSettingNamesProps extends ProfileSettingCommonProps {\n /** The saved given name — `first_name`. `null` reads as empty. */\n firstName: string | null;\n /** The saved family name — `last_name`. `null` (a migrated account, §3.3) reads as\n * empty, and Save then waits for one. */\n lastName: string | null;\n /**\n * Save the two names (`PATCH /auth/me`, which also clears `name_incomplete`). Return\n * a promise and Save is busy until it settles. Refresh `firstName` / `lastName` from\n * the answer: the card compares its drafts with them, so Save turns off once the new\n * names come back. A rejection keeps what was typed — the app says why (a toast), as\n * for `PasswordSetting`.\n */\n onSave: (values: ProfileNameValues) => void | Promise<unknown>;\n value?: undefined;\n onChange?: undefined;\n}\n\nexport type ProfileSettingProps = ProfileSettingDisplayNameProps | ProfileSettingNamesProps;\n\n/**\n * The profile section: avatar, address, role, member since, and the name.\n *\n * **Two forms.** Given `firstName` / `lastName` (0.30.0, §6.1) it edits first and last\n * name in two fields, side by side where the card is wide enough — the order and the\n * 1–120-character rule of `RegisterForm` (auth §3.1), so the name a person signed up\n * with is edited the way it was typed. Without them it is the single `displayName`\n * field it always was, `value` / `onChange` / `onSave()` unchanged, for an app that has\n * not moved yet (kastlan split the one name at its first space on save; Kurvenschmiede\n * built its own card instead).\n *\n * The two-field form owns its drafts, starting from the saved names and following them\n * when they change; Save waits for a change, holds — saying why — while a name is\n * blank, and is a `commit` (a {@link WriteLockProvider} locks it, keksdose's demo) —\n * every lock but a lapsed plan's (`COMMIT_EXCEPT_BILLING`, 0.33): a profile is the\n * account's own settings, which billing never locks (docs/billing-harmonization.md §3.3,\n * §12.36).\n */\nexport function ProfileSetting(props: ProfileSettingProps) {\n const { name, email, role, memberSince, labels: labelsProp, id } = props;\n const labels = useAccountSettingsLabels(\"profile\", labelsProp);\n const names = props.firstName !== undefined || props.lastName !== undefined;\n return (\n <Card id={id} className=\"p-4 space-y-3\">\n <div className=\"flex items-center gap-3\">\n <UserAvatar\n name={name}\n email={email}\n person={names ? { first: props.firstName, last: props.lastName } : undefined}\n size=\"lg\"\n />\n <div className=\"min-w-0\">\n {/* A heading inside a SettingsLayout (0.31, docs/settings-harmonization.md\n §3.7), the plain div it always was outside one. */}\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <div className=\"truncate-until-large font-mono text-xs text-muted\">\n {/* `email` was a required key that nothing rendered; it names the address\n for a screen reader, which otherwise hears a bare string under a title. */}\n <span className=\"sr-only\">{labels.email}: </span>\n {email ?? \"—\"}\n </div>\n </div>\n </div>\n <div className=\"grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1 text-sm\">\n <span className=\"text-muted\">{labels.role}</span>\n <span>{role ?? \"—\"}</span>\n <span className=\"text-muted\">{labels.memberSince}</span>\n <span>{memberSince ?? \"—\"}</span>\n </div>\n {names ? (\n <PersonNameFields\n firstName={props.firstName ?? \"\"}\n lastName={props.lastName ?? \"\"}\n onSave={(props as ProfileSettingNamesProps).onSave}\n saving={props.saving}\n labels={labels}\n />\n ) : (\n <DisplayNameField\n name={name}\n value={(props as ProfileSettingDisplayNameProps).value}\n onChange={(props as ProfileSettingDisplayNameProps).onChange}\n onSave={(props as ProfileSettingDisplayNameProps).onSave}\n saving={props.saving}\n labels={labels}\n />\n )}\n </Card>\n );\n}\n\n/** The single-name form — exactly the 0.29 card's field and button. */\nfunction DisplayNameField({\n name,\n value,\n onChange,\n onSave,\n saving,\n labels,\n}: {\n name?: string | null;\n value: string;\n onChange: (value: string) => void;\n onSave: () => void;\n saving?: boolean;\n labels: Required<ProfileSettingLabels>;\n}) {\n const dirty = value.trim().length > 0 && value.trim() !== (name ?? \"\");\n // Generated, not the literal \"display-name\" it was: two of these on one page (an\n // admin editing someone else's profile beside their own) shared an id, and the\n // second label pointed at the first field.\n const inputId = useId();\n return (\n <>\n <Input\n id={inputId}\n label={labels.displayName}\n value={value}\n onChange={(e) => onChange(e.target.value)}\n maxLength={120}\n />\n <Button onClick={onSave} disabled={!dirty || saving}>\n {labels.save}\n </Button>\n </>\n );\n}\n\n/** The first-and-last form (0.30.0, §6.1). */\nfunction PersonNameFields({\n firstName,\n lastName,\n onSave,\n saving,\n labels,\n}: {\n firstName: string;\n lastName: string;\n onSave: (values: ProfileNameValues) => void | Promise<unknown>;\n saving?: boolean;\n labels: Required<ProfileSettingLabels>;\n}) {\n const [first, setFirst] = useState(firstName);\n const [last, setLast] = useState(lastName);\n // The saved names moved (the save came back, another tab renamed): the drafts follow\n // them. During render, as DangerConfirm resets its fields, so no frame shows the old\n // draft beside the new name.\n const [saved, setSaved] = useState({ firstName, lastName });\n if (saved.firstName !== firstName || saved.lastName !== lastName) {\n setSaved({ firstName, lastName });\n setFirst(firstName);\n setLast(lastName);\n }\n const { pending, run } = usePromisePending();\n const busy = Boolean(saving) || pending;\n const valid = personNameOk(first) && personNameOk(last);\n const dirty = first.trim() !== firstName.trim() || last.trim() !== lastName.trim();\n\n const submit = (e: FormEvent) => {\n e.preventDefault();\n if (!valid || !dirty || busy) return;\n // A rejection keeps the drafts; the app reports it, as PasswordSetting's does.\n run(onSave({ firstName: first.trim(), lastName: last.trim() }), () => {});\n };\n\n return (\n <form className=\"@container space-y-3\" onSubmit={submit} noValidate>\n {/* The order and the rule of RegisterForm's two fields (auth §3.1). */}\n <div className=\"grid gap-3 @xs:grid-cols-2\">\n <Input\n name=\"given-name\"\n autoComplete=\"given-name\"\n label={labels.firstName}\n value={first}\n onChange={(e) => setFirst(e.target.value)}\n maxLength={PERSON_NAME_MAX_LENGTH}\n readOnly={busy}\n required\n />\n <Input\n name=\"family-name\"\n autoComplete=\"family-name\"\n label={labels.lastName}\n value={last}\n onChange={(e) => setLast(e.target.value)}\n maxLength={PERSON_NAME_MAX_LENGTH}\n readOnly={busy}\n required\n />\n </div>\n <Button\n type=\"submit\"\n commit={COMMIT_EXCEPT_BILLING}\n pending={busy}\n // A blank name is a reason the person can act on; an unchanged one is not —\n // there is nothing to save, and the button is simply off.\n disabled={valid && !dirty}\n disabledReason={valid ? undefined : labels.nameRequired}\n >\n {labels.save}\n </Button>\n </form>\n );\n}\n\n/**\n * What {@link PasswordSetting}'s `strength` takes besides `true`: the meter's own options,\n * minus the ones the card owns — `value` (the new password), `minLength` (the card's, so\n * the checklist's length rule and the submit's check are one number) and `maxBytes`\n * (the card's own prop, which the submit enforces as well).\n */\nexport type PasswordSettingStrength = Pick<PasswordStrengthMeterProps, \"score\" | \"showRequirements\" | \"labels\">;\n\n/**\n * Changing the account's password: the current one, the new one twice, then the app's\n * `onSubmit`.\n *\n * **Refusals under their fields** (0.34, KS U3). The card's own checks say why under the\n * field they are about — too short or too long under the new password, a mismatch under\n * the confirmation — and a server's `password_incorrect` (server-kit's `400` for a wrong\n * current password; an older `invalid_credentials` too) is read from `onSubmit`'s\n * rejection by code ({@link authErrorCode}) and said under the current password, in\n * `EmailChangeSetting`'s and `DeleteAccountSetting`'s words. The field in error takes\n * the focus, so its message is read with it. Until 0.34 the card swallowed every\n * rejection and each app toasted the wrong password itself, in three spellings.\n *\n * **Anything else** is the app's: `describeError` puts its words in the card (a banner\n * over the button), and without it the card shows nothing — the app's own toast, as\n * before. The fields keep what was typed for a retry; a resolved `onSubmit` empties\n * them.\n */\nexport function PasswordSetting({\n onSubmit,\n pending,\n minLength = 8,\n strength,\n maxBytes,\n describeError,\n labels: labelsProp,\n id,\n}: {\n /**\n * Called with the validated (current, new) pair; return a promise to auto-clear on\n * success. Reject with the client's error: `password_incorrect` is said under the\n * current password; anything else goes through `describeError`, else stays the app's\n * to say (a toast).\n */\n onSubmit: (currentPassword: string, newPassword: string) => void | Promise<unknown>;\n pending?: boolean;\n /** The shortest new password the card submits, in characters as a person counts them\n * (an emoji is one). Keep it in step with the server's own minimum. Default 8. */\n minLength?: number;\n /**\n * Show the {@link PasswordStrengthMeter} under the new-password field (0.22.0,\n * kastlan's input audit): the bar, the level in words and the checklist, with the\n * length rule drawn from `minLength`. `true` for the meter as it comes; an object for\n * its `score` (zxcvbn's, say), `showRequirements` or `labels`.\n *\n * Off by default, so a card that never asked for it does not grow one. The meter is\n * advisory, as everywhere in the kit: it blocks nothing — the card's own checks do\n * (`minLength`, the confirmation, `maxBytes`).\n */\n strength?: boolean | PasswordSettingStrength;\n /**\n * A byte ceiling on the new password — bcrypt reads at most 72 BYTES and ignores the\n * rest, which is kastlan's case: `maxBytes={72}`. A new password over it is refused\n * on submit with the meter's own \"too long\" sentence (the `passwordStrength`\n * namespace's `tooLong`), and the meter, when shown, warns while it is typed.\n *\n * Unset by default, and leave it unset for a secret with no ceiling: an invented one\n * talks people out of the long passphrase they chose.\n */\n maxBytes?: number;\n /**\n * The app's own words for a failure of `onSubmit`, said IN the card (a banner over the\n * button), or `undefined` for the kit's handling. Asked first, for every failure — as\n * `EmailChangeSetting`'s and `DeleteAccountSetting`'s are (0.34, KS U3): a demo's\n * refusal, the device offline, a `422` whose sentence the app has. Without it, or when\n * it answers `undefined`, the card says `password_incorrect` under the current password\n * and nothing else: the rest stays the app's own toast.\n */\n describeError?: (error: unknown) => ReactNode | undefined;\n /** Prop > `<UiKitProvider labels={{ accountSettings: { password } }}>` > English. */\n labels?: LabelOverride<PasswordSettingLabels>;\n /** The card's DOM id — a settings catalogue `anchor`, so `?focus=` can ring it (0.31). */\n id?: string;\n}) {\n const labels = useAccountSettingsLabels(\"password\", labelsProp);\n const strengthOptions = typeof strength === \"object\" ? strength : undefined;\n // Only for `tooLong`: the sentence the meter shows is the one the refusal says.\n const strengthLabels = useKitLabels(\"passwordStrength\", DEFAULT_PASSWORD_STRENGTH_LABELS, strengthOptions?.labels);\n const [current, setCurrent] = useState(\"\");\n const [next, setNext] = useState(\"\");\n const [confirm, setConfirm] = useState(\"\");\n // One refusal at a time, under the field it is about; the app's words in the banner.\n const [fieldError, setFieldError] = useState<{ field: PasswordField; message: string } | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const currentRef = useRef<HTMLInputElement>(null);\n const nextRef = useRef<HTMLInputElement>(null);\n const confirmRef = useRef<HTMLInputElement>(null);\n const refs: Record<PasswordField, RefObject<HTMLInputElement | null>> = {\n current: currentRef,\n next: nextRef,\n confirm: confirmRef,\n };\n\n // The field in error takes the focus, so its message (its description) is read with it.\n const refuse = (field: PasswordField, message: string) => {\n setFieldError({ field, message });\n refs[field].current?.focus();\n };\n const errorOf = (field: PasswordField) => (fieldError?.field === field ? fieldError.message : undefined);\n // Typing in a field answers its refusal, and the banner's: both go.\n const edit = (field: PasswordField, set: (value: string) => void) => (e: ChangeEvent<HTMLInputElement>) => {\n set(e.target.value);\n if (fieldError?.field === field) setFieldError(null);\n if (failure !== null) setFailure(null);\n };\n\n const present = (error: unknown) => {\n const own = describeError?.(error);\n if (hasContent(own)) {\n setFailure(own);\n return;\n }\n const code = authErrorCode(error);\n // `invalid_credentials` too, for a server that answered a wrong password so before\n // server-kit 0.4.0 named `password_incorrect` — the siblings' rule.\n if (code === \"password_incorrect\" || code === \"invalid_credentials\") {\n refuse(\"current\", labels.wrongPassword);\n }\n // Anything else is the app's to say (a toast), as before 0.34.\n };\n\n const submit = async () => {\n setFailure(null);\n // Code points, not UTF-16 units — the count the meter's checklist and a server's\n // `len()` use. `next.length` counted an emoji as two, so four of them passed a\n // minimum of eight that the meter beside the field said they missed.\n if ([...next].length < minLength) {\n refuse(\"next\", labels.tooShort);\n return;\n }\n if (maxBytes !== undefined && passwordByteLength(next) > maxBytes) {\n refuse(\"next\", strengthLabels.tooLong(maxBytes));\n return;\n }\n if (next !== confirm) {\n refuse(\"confirm\", labels.mismatch);\n return;\n }\n setFieldError(null);\n try {\n await onSubmit(current, next);\n setCurrent(\"\");\n setNext(\"\");\n setConfirm(\"\");\n } catch (error) {\n // Keep the fields for a retry, and say what the card can.\n present(error);\n }\n };\n\n // `error` passed on all three from the first render, so a message coming and going\n // never remounts a field and takes the caret with it (Input's `FieldGroup`).\n const nextField = (\n <Input\n ref={nextRef}\n type=\"password\"\n autoComplete=\"new-password\"\n label={labels.next}\n value={next}\n onChange={edit(\"next\", setNext)}\n error={errorOf(\"next\")}\n />\n );\n\n return (\n <Card id={id} className=\"p-4 space-y-3\">\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <Input\n ref={currentRef}\n type=\"password\"\n autoComplete=\"current-password\"\n label={labels.current}\n value={current}\n onChange={edit(\"current\", setCurrent)}\n error={errorOf(\"current\")}\n />\n {strength ? (\n // One box for the field and its meter, so the card's `space-y-3` spaces the pair\n // from its neighbours and the meter keeps its own small gap under the field.\n <div>\n {nextField}\n <PasswordStrengthMeter\n value={next}\n minLength={minLength}\n maxBytes={maxBytes}\n score={strengthOptions?.score}\n showRequirements={strengthOptions?.showRequirements}\n labels={strengthOptions?.labels}\n />\n </div>\n ) : (\n nextField\n )}\n <Input\n ref={confirmRef}\n type=\"password\"\n autoComplete=\"new-password\"\n label={labels.confirm}\n value={confirm}\n onChange={edit(\"confirm\", setConfirm)}\n error={errorOf(\"confirm\")}\n />\n {hasContent(failure) && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure}\n </AlertBanner>\n )}\n <Button onClick={() => void submit()} disabled={!current || !next || !confirm || pending}>\n {labels.submit}\n </Button>\n </Card>\n );\n}\n\n/** The three fields of {@link PasswordSetting}, for the refusal that names one. */\ntype PasswordField = \"current\" | \"next\" | \"confirm\";\n\n/**\n * What the app's setup call returned.\n *\n * `otpauthUri` (0.12.0) is what an authenticator backend actually hands out; the kit\n * draws the QR code itself ({@link QrCode}) and reads the manual-entry key out of the\n * URI's `secret` parameter when `secret` is not given. The `qrSvg` shape — a\n * base64-encoded SVG image — is what the section took before, which made every app\n * render a QR library to a static string and base64 it only for the kit to draw it back.\n */\nexport type TwoFactorSetupData = { qrSvg: string; secret: string } | { otpauthUri: string; secret?: string };\n\n/** The `secret` parameter of an `otpauth://` URI, or null. */\nfunction otpauthSecret(uri: string): string | null {\n const match = /[?&]secret=([^&#]*)/i.exec(uri);\n if (!match) return null;\n try {\n return decodeURIComponent(match[1]) || null;\n } catch {\n return match[1] || null;\n }\n}\n\n/** \"JBSW Y3DP EHPK 3PXP\": the key in groups of four, which is how an authenticator's\n * manual-entry screen shows it and how a person copies it by eye. */\nfunction groupSecret(secret: string): string {\n return secret.replace(/\\s+/g, \"\").replace(/(.{4})(?=.)/g, \"$1 \");\n}\n\nexport function TwoFactorSetting({\n enabled,\n setup,\n onStartSetup,\n onEnable,\n onDisable,\n busy,\n renderQr,\n labels: labelsProp,\n id,\n}: {\n enabled: boolean;\n /** What the app's setup call returned; null before setup starts. */\n setup: TwoFactorSetupData | null;\n onStartSetup: () => void;\n onEnable: (code: string) => void;\n onDisable: (password: string, code: string) => void;\n busy?: boolean;\n /** Draw the code yourself (a branded QR, a library you already ship). Given the\n * `otpauthUri`; the kit's own {@link QrCode} otherwise. Unused with `qrSvg`. */\n renderQr?: (otpauthUri: string) => ReactNode;\n /** Prop > `<UiKitProvider labels={{ accountSettings: { twoFactor } }}>` > English. */\n labels?: LabelOverride<TwoFactorSettingLabels>;\n /** The card's DOM id — a settings catalogue `anchor`, so `?focus=` can ring it (0.31). */\n id?: string;\n}) {\n const labels = useAccountSettingsLabels(\"twoFactor\", labelsProp);\n // The title (0.31, docs/settings-harmonization.md §3.7) is new, and an app that\n // translated this card before it named the setting in `status` — \"2FA\",\n // \"Zwei-Faktor-Authentifizierung\". Each source's `title` first, then its `status`, so\n // that app keeps its own word instead of meeting the English title.\n const overrides = useKitLabelOverrides(\"accountSettings\")?.twoFactor;\n const title = labelsProp?.title ?? overrides?.title ?? labelsProp?.status ?? overrides?.status ?? labels.title;\n const [code, setCode] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n // Both code fields are a OneTimeCodeInput (0.22.0) — the field this card wrote by hand\n // twice — and keep what they did:\n // - `readOnlyUntilFocus`: browsers autofill a one-time-code field with the saved\n // username (the disable form has a current-password field right above it), and a\n // read-only field is never autofilled. The guard drops on focus, and the field\n // keeps the look of an editable one meanwhile (FIELD_WRITABLE_LOOK) — see the prop.\n // - `length={8}`: the `maxLength={8}` they had, so an authenticator issuing eight\n // digits still fits. What changed is that they now take digits only: \"123 456\"\n // pasted from an authenticator that groups its digits used to reach `onEnable`\n // with the space in it.\n // - one `code` state for both, as before.\n const secret = setup ? (setup.secret ?? (\"otpauthUri\" in setup ? otpauthSecret(setup.otpauthUri) : null)) : null;\n\n return (\n <Card id={id} className=\"p-4 space-y-3\">\n {/* The card had only \"Two-factor authentication: Off\". A settings page outlines its\n cards by their titles (§3.7), so the setting's name is the title now, and the\n state stands beside it as a chip instead of repeating the name. */}\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <SettingsCardTitle>{title}</SettingsCardTitle>\n <Chip size=\"sm\" tone={enabled ? \"success\" : \"neutral\"}>\n {enabled ? labels.enabledText : labels.disabledText}\n </Chip>\n </div>\n\n {!enabled && !setup && (\n <Button onClick={onStartSetup} disabled={busy}>\n {labels.enable}\n </Button>\n )}\n\n {setup && (\n <div className=\"space-y-2\">\n <div className=\"text-xs text-secondary\">{labels.scanHint}</div>\n {/* `bg-white`, NOT `--bg-surface`, and it must stay that way: a QR code is\n read by a camera looking for maximum contrast between the modules and\n their quiet zone. On the dark theme a surface-coloured backing makes it\n slow to acquire, and on a warm light preset it lowers the contrast ratio\n the spec is written against. This is the one place in the kit where a\n literal colour is the correct answer. `data-private`: the code IS the\n second factor, and demo mode blurs it like any other secret. */}\n {\"otpauthUri\" in setup ? (\n // No backing of its own: QrCode draws its quiet zone white inside the SVG.\n <div data-private className=\"inline-block overflow-hidden rounded-md\">\n {renderQr ? (\n renderQr(setup.otpauthUri)\n ) : (\n <QrCode value={setup.otpauthUri} label={labels.qrAlt} className=\"size-48\" />\n )}\n </div>\n ) : (\n <div data-private className=\"inline-block rounded-md bg-white p-2\">\n <img alt={labels.qrAlt} src={`data:image/svg+xml;base64,${setup.qrSvg}`} className=\"h-48 w-48\" />\n </div>\n )}\n {secret && (\n <div className=\"space-y-1\">\n <div className=\"text-xs text-secondary\">{labels.secretHint}</div>\n <div className=\"flex items-center gap-1\">\n {/* `dir=\"ltr\"`: a base32 key is Latin letters and digits in a fixed\n order, and in an RTL page the groups would otherwise be laid out\n right to left. */}\n <code data-private dir=\"ltr\" className=\"break-all font-mono text-xs select-all\">\n {groupSecret(secret)}\n </code>\n <CopyButton text={secret} label={labels.copySecret} size=\"xs\" tone=\"muted\" />\n </div>\n </div>\n )}\n <OneTimeCodeInput\n readOnlyUntilFocus\n length={8}\n label={labels.codeLabel}\n value={code}\n onChange={setCode}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && code && !busy) {\n e.preventDefault();\n onEnable(code);\n }\n }}\n />\n <Button onClick={() => onEnable(code)} disabled={!code || busy}>\n {labels.verify}\n </Button>\n </div>\n )}\n\n {enabled && (\n <div className=\"space-y-3 border-t border-subtle pt-3\">\n <div className=\"text-sm font-medium\">{labels.disableSection}</div>\n <Input\n type=\"password\"\n autoComplete=\"current-password\"\n label={labels.password}\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n />\n <OneTimeCodeInput\n readOnlyUntilFocus\n length={8}\n label={labels.codeLabel}\n value={code}\n onChange={setCode}\n onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {\n if (e.key === \"Enter\" && password && code && !busy) {\n e.preventDefault();\n onDisable(password, code);\n }\n }}\n />\n <Button variant=\"danger\" onClick={() => onDisable(password, code)} disabled={!password || !code || busy}>\n {labels.disable}\n </Button>\n </div>\n )}\n </Card>\n );\n}\n"],"mappings":";AAmIQ,SAoEJ,UApEI,KAaI,YAbJ;AAnIR,SAAS,OAAO,QAAQ,gBAAgB;AAExC,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,cAAc,8BAA8B;AACrD;AAAA,EACE;AAAA,EACA;AAAA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MACvD,iBAAO,QACV;AAAA,OACF;AAAA,IAGD,WACC,qBAAC,SAAI,WAAU,yCACb;AAAA,0BAAC,SAAI,WAAU,uBAAuB,iBAAO,gBAAe;AAAA,MAC5D;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,cAAa;AAAA,UACb,OAAO,OAAO;AAAA,UACd,OAAO;AAAA,UACP,UAAU,CAAC,MAAM,YAAY,EAAE,OAAO,KAAK;AAAA;AAAA,MAC7C;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,oBAAkB;AAAA,UAClB,QAAQ;AAAA,UACR,OAAO,OAAO;AAAA,UACd,OAAO;AAAA,UACP,UAAU;AAAA,UACV,WAAW,CAAC,MAAuC;AACjD,gBAAI,EAAE,QAAQ,WAAW,YAAY,QAAQ,CAAC,MAAM;AAClD,gBAAE,eAAe;AACjB,wBAAU,UAAU,IAAI;AAAA,YAC1B;AAAA,UACF;AAAA;AAAA,MACF;AAAA,MACA,oBAAC,UAAO,SAAQ,UAAS,SAAS,MAAM,UAAU,UAAU,IAAI,GAAG,UAAU,CAAC,YAAY,CAAC,QAAQ,MAChG,iBAAO,SACV;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -112,71 +112,62 @@ function DeleteAccountSetting({
|
|
|
112
112
|
setFieldError(null);
|
|
113
113
|
setFailure(null);
|
|
114
114
|
};
|
|
115
|
-
return /* @__PURE__ */ jsxs(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
className:
|
|
122
|
-
children:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
)
|
|
172
|
-
]
|
|
173
|
-
}
|
|
174
|
-
),
|
|
175
|
-
hasContent(failure) && /* @__PURE__ */ jsx(AlertBanner, { tone: "danger", size: "sm", role: "alert", children: failure })
|
|
176
|
-
] })
|
|
177
|
-
]
|
|
178
|
-
}
|
|
179
|
-
);
|
|
115
|
+
return /* @__PURE__ */ jsxs(Card, { ...rest, "data-state": done ? "done" : "form", tone: "danger", className: cn("p-4 space-y-3", className), children: [
|
|
116
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
117
|
+
/* @__PURE__ */ jsx(SettingsCardTitle, { children: labels.title }),
|
|
118
|
+
/* @__PURE__ */ jsx("div", { className: CARD_DESCRIPTION_CLASS, children: modeSentence })
|
|
119
|
+
] }),
|
|
120
|
+
done ? /* @__PURE__ */ jsxs("div", { ref: doneRef, tabIndex: -1, role: "status", className: "flex items-start gap-2 text-sm outline-none", children: [
|
|
121
|
+
/* @__PURE__ */ jsx(UserX, { "aria-hidden": true, className: "mt-0.5 size-4 shrink-0 text-muted" }),
|
|
122
|
+
/* @__PURE__ */ jsx("span", { children: labels.done })
|
|
123
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
124
|
+
/* @__PURE__ */ jsxs(
|
|
125
|
+
DangerConfirm,
|
|
126
|
+
{
|
|
127
|
+
commit: COMMIT_EXCEPT_BILLING,
|
|
128
|
+
armLabel: labels.arm,
|
|
129
|
+
prompt: labels.prompt,
|
|
130
|
+
consequences: lines,
|
|
131
|
+
confirmLabel: labels.confirm,
|
|
132
|
+
confirmDisabledReason: held,
|
|
133
|
+
busy,
|
|
134
|
+
onArmedChange: disarmed,
|
|
135
|
+
onConfirm: confirm,
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsx(
|
|
138
|
+
TypedConfirmField,
|
|
139
|
+
{
|
|
140
|
+
ref: typedRef,
|
|
141
|
+
target: email,
|
|
142
|
+
match: "caseless",
|
|
143
|
+
value: typed,
|
|
144
|
+
onValueChange: (next) => {
|
|
145
|
+
setTyped(next);
|
|
146
|
+
if (fieldError === "email") setFieldError(null);
|
|
147
|
+
},
|
|
148
|
+
error: fieldError === "email" ? labels.confirmationMismatch : void 0,
|
|
149
|
+
busy
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
/* @__PURE__ */ jsx(
|
|
153
|
+
CurrentPasswordInput,
|
|
154
|
+
{
|
|
155
|
+
ref: passwordRef,
|
|
156
|
+
value: password,
|
|
157
|
+
onValueChange: (next) => {
|
|
158
|
+
setPassword(next);
|
|
159
|
+
if (fieldError === "password") setFieldError(null);
|
|
160
|
+
},
|
|
161
|
+
error: fieldError === "password" ? labels.wrongPassword : void 0,
|
|
162
|
+
busy
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
hasContent(failure) && /* @__PURE__ */ jsx(AlertBanner, { tone: "danger", size: "sm", role: "alert", children: failure })
|
|
169
|
+
] })
|
|
170
|
+
] });
|
|
180
171
|
}
|
|
181
172
|
export {
|
|
182
173
|
DEFAULT_DELETE_ACCOUNT_LABELS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/delete-account-setting.tsx"],"sourcesContent":["import { isValidElement, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { UserX } from \"lucide-react\";\n\nimport { useKitLabels, useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { hasContent } from \"../lib/presence\";\nimport {\n CurrentPasswordInput,\n DangerConfirm,\n DEFAULT_DANGER_CONFIRM_LABELS,\n TypedConfirmField,\n typedMatches,\n} from \"../components/danger-confirm\";\nimport type { DangerConsequence } from \"../components/danger-confirm\";\nimport { Card } from \"../components/card\";\nimport { authErrorCode, isRateLimited, retryAfterSeconds } from \"../auth/auth-errors\";\nimport { useFocusWhen } from \"../auth/status-parts\";\nimport { CARD_DESCRIPTION_CLASS, refusalCompanies, settle, useMounted } from \"./account-parts\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport { COMMIT_EXCEPT_BILLING } from \"../components/write-lock\";\nimport { DEFAULT_DELETE_ACCOUNT_LABELS } from \"./delete-account-setting-labels\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/**\n * Every string {@link DeleteAccountSetting} renders — the `deleteAccount` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`. The confirm's\n * Cancel, \"Password\" and \"Type … to confirm\" are `dangerConfirm`'s.\n */\nexport interface DeleteAccountLabels {\n /** The card's title. */\n title: string;\n /** Mode `after_days`, given the days: what happens and when. */\n afterDays: (days: number) => string;\n /** Mode `operator`: what happens, and who erases it. */\n operator: string;\n /** The button that opens the confirm. */\n arm: string;\n /** The confirm's warning, over the consequences. */\n prompt: string;\n /** The line in the consequences when `handOverCount` is given (Kurvenschmiede, §2.7),\n * given the count. */\n handOver: (count: number) => string;\n /** The button that sends it. */\n confirm: string;\n /** Said once the request is accepted — the app signs out next. */\n done: string;\n /** `password_incorrect` (server-kit's `400` for a wrong current password), under the\n * password field. */\n wrongPassword: string;\n /** `confirmation_mismatch` — the server did not take the typed address as the\n * account's — under the address field. */\n confirmationMismatch: string;\n /** `last_admin` — the account is the last active admin. */\n lastAdmin: string;\n /** `last_admin` naming the companies (kastlan checks per company), given them as one\n * list in the reader's language (\"Example AG and Sample GmbH\"). */\n lastAdminOf: (companies: string) => string;\n /** `household_has_members` — keksdose's guard (§6.4). */\n householdHasMembers: string;\n /** A request was throttled — HTTP 429 — given its `Retry-After` wait in seconds, or\n * `undefined` without one. */\n rateLimited: (seconds?: number) => string;\n /** Any other failure. */\n failed: string;\n}\n\n// Defined in ./delete-account-setting-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_DELETE_ACCOUNT_LABELS };\n\n/* ── Props ───────────────────────────────────────────────────────────────── */\n\n/** What happens after the deactivation (§2.1, §6.4) — the app's setting. */\nexport type DeletionMode = \"after_days\" | \"operator\";\n\n/** What {@link DeleteAccountSettingProps.onRequest} gets: the `POST /auth/me/deletion`\n * body. */\nexport interface DeleteAccountValues {\n /** As typed. */\n password: string;\n /** The address as TYPED, trimmed — the server re-checks it against the account\n * (server-kit's `confirm_email_matches`), as keksdose's admin actions do. */\n confirmEmail: string;\n}\n\n/** One line of the consequences: a node of the app's, or a {@link DangerConsequence}\n * for a key of its own and the `severe` mark. */\nexport type DeleteAccountConsequence = ReactNode | DangerConsequence;\n\nexport interface DeleteAccountSettingProps extends Omit<ComponentPropsWithRef<\"div\">, \"children\"> {\n /** The account's address — the text to type. */\n email: string;\n /** `\"after_days\"` (keksdose, Kurvenschmiede: erased by a scheduled job) or\n * `\"operator\"` (kastlan: company data is involved, an operator erases it). */\n mode: DeletionMode;\n /** With `after_days`: how many. Default 30 (§2.1). */\n days?: number;\n /**\n * What goes, in the app's words (§6.4: \"the app's own list\") — derived from the\n * account's own facts where it can be: keksdose's \"Budget X will be deleted; its 2\n * guests are told\", rather than the worst case for everybody.\n */\n consequences?: readonly DeleteAccountConsequence[];\n /** Kurvenschmiede (§2.7): how many owned items others can see — they pass to the\n * first active admin at erasure. A line of its own in the consequences; 0 or left\n * out, none. */\n handOverCount?: number;\n /**\n * The confirm was answered: send `POST /auth/me/deletion {password, confirm_email}`.\n * Resolve once it is accepted — the card says \"You are being signed out\" — and then\n * sign the user out: the server ended every session with the deactivation. Reject\n * with the client's error: `password_incorrect` under the password,\n * `confirmation_mismatch` under the address, `last_admin` (with kastlan's\n * `companies`) and `household_has_members` above the buttons, a 429 as\n * `rateLimited`, anything else (a demo account's 403, an app's own code) through\n * `describeError`, else `failed`. The confirm stays open with what was typed, for a\n * retry.\n */\n onRequest: (values: DeleteAccountValues) => Promise<unknown> | void;\n /** The app's own words for a failure, or `undefined` for the kit's. Asked first, for\n * every failure — kastlan's `last_admin` names the companies. */\n describeError?: (error: unknown) => ReactNode | undefined;\n labels?: LabelOverride<DeleteAccountLabels>;\n}\n\n/** Whether an item is a `{ text }` line rather than a node — a React element is an\n * object too, and so would a `{ text }` lookalike be, so the element test comes first. */\nfunction isConsequence(item: DeleteAccountConsequence): item is DangerConsequence {\n return typeof item === \"object\" && item !== null && !isValidElement(item) && \"text\" in item;\n}\n\n/**\n * Deleting one's own account (docs/user-admin-harmonization.md §6.4, §2.1): what it does,\n * the password, the typed address — then the app signs out.\n *\n * **Two stages, said before the button.** The request DEACTIVATES the account at once\n * (no sign-in, every session ended, marked for deletion); the erasure follows per the\n * app's `mode` — \"erased for good 30 days later\" (`after_days`, a scheduled job) or \"an\n * operator will erase it\" (`operator`, kastlan, where company records are involved).\n * The sentence is under the title, so it is read before anything is pressed.\n *\n * **The confirm is a {@link DangerConfirm}** with the two guards of every \"type the\n * address\" rule in the apps: the address typed (compared caseless, as in all of them)\n * and the password. They are the tile's own {@link TypedConfirmField} and\n * {@link CurrentPasswordInput}, drawn in its fields slot and held by\n * `confirmDisabledReason` with the tile's own sentences, rather than its built-in\n * `phrase` / `requirePassword` — those have no error of their own, and a wrong password\n * belongs under the password. Its consequences are the app's list, plus\n * Kurvenschmiede's hand-over line (`handOverCount`, §2.7: shared work goes to an\n * administrator, never a refusal). The typed address goes to `onRequest` as typed, so\n * the server re-checks it (`confirm_email_matches`).\n *\n * **Refusals** (§6.4) are read by code ({@link authErrorCode}): `password_incorrect` (a\n * `400`, so an app's 401 handling never signs the person out over a typo) under the\n * password, `confirmation_mismatch` under the address, `last_admin` — naming kastlan's\n * companies when the answer lists them — and keksdose's `household_has_members` guard\n * above the buttons; a 429; and the rest in the app's words. The confirm stays open with\n * what was typed, for a retry; Cancel wipes it.\n *\n * **After success** the card says the account is deactivated and the person is being\n * signed out — the app's to do, since the kit sends nothing (auth §8).\n *\n * **Under a write lock** the confirm is a `commit` exempt from billing\n * (`COMMIT_EXCEPT_BILLING`, 0.33): leaving never depends on paying\n * (docs/billing-harmonization.md decision 14, §12.36); a demo's lock still holds it.\n */\nexport function DeleteAccountSetting({\n email,\n mode,\n days = 30,\n consequences,\n handOverCount,\n onRequest,\n describeError,\n labels: labelsProp,\n className,\n ...rest\n}: DeleteAccountSettingProps) {\n const labels = useKitLabels(\"deleteAccount\", DEFAULT_DELETE_ACCOUNT_LABELS, labelsProp);\n // The guards speak the tile's words, so \"Type “…” to confirm\" and \"Enter your password\n // to confirm\" are translated once, in `dangerConfirm`.\n const guardLabels = useKitLabels(\"dangerConfirm\", DEFAULT_DANGER_CONFIRM_LABELS);\n const locale = useKitLocale();\n const [typed, setTyped] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n const [busy, setBusy] = useState(false);\n const [fieldError, setFieldError] = useState<\"email\" | \"password\" | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const [done, setDone] = useState(false);\n const mounted = useMounted();\n const typedRef = useRef<HTMLInputElement>(null);\n const passwordRef = useRef<HTMLInputElement>(null);\n const doneRef = useRef<HTMLDivElement>(null);\n // The tile went with the press; the answer takes the focus, so it is read out.\n useFocusWhen(done, doneRef);\n\n const modeSentence = mode === \"operator\" ? labels.operator : labels.afterDays(days);\n\n const lines: (string | DangerConsequence)[] = (consequences ?? [])\n // `{cond && \"…\"}` lines that came out empty are no lines.\n .filter((item) => item !== null && item !== undefined && item !== false && item !== \"\")\n .map((item, index) => (isConsequence(item) ? item : { key: `app-${index}`, text: item }));\n if (handOverCount !== undefined && handOverCount > 0) {\n lines.push({ key: \"hand-over\", text: labels.handOver(handOverCount) });\n }\n\n // The first guard still open, in the order the fields are drawn — DangerConfirm's rule.\n const held = !typedMatches(typed, email, \"caseless\")\n ? typeof guardLabels.needsPhrase === \"function\"\n ? guardLabels.needsPhrase(email)\n : guardLabels.needsPhrase\n : password === \"\"\n ? guardLabels.needsPassword\n : undefined;\n\n const present = (error: unknown) => {\n const own = describeError?.(error);\n if (hasContent(own)) {\n setFailure(own);\n return;\n }\n if (isRateLimited(error)) {\n setFailure(labels.rateLimited(retryAfterSeconds(error)));\n return;\n }\n const code = authErrorCode(error);\n // `invalid_credentials` too, for a server that answered a wrong password so before\n // server-kit 0.4.0 named `password_incorrect`.\n if (code === \"password_incorrect\" || code === \"invalid_credentials\") {\n setFieldError(\"password\");\n passwordRef.current?.focus();\n return;\n }\n if (code === \"confirmation_mismatch\" || code === \"confirmation_required\") {\n setFieldError(\"email\");\n typedRef.current?.focus();\n return;\n }\n if (code === \"last_admin\") {\n const companies = refusalCompanies(error);\n setFailure(\n companies\n ? labels.lastAdminOf(new Intl.ListFormat(locale, { type: \"conjunction\" }).format(companies))\n : labels.lastAdmin,\n );\n return;\n }\n setFailure(code === \"household_has_members\" ? labels.householdHasMembers : labels.failed);\n };\n\n const confirm = () => {\n setFailure(null);\n setFieldError(null);\n setBusy(true);\n const values: DeleteAccountValues = { password, confirmEmail: typed.trim() };\n return settle(() => onRequest(values)).then(\n () => {\n if (!mounted.current) return;\n setBusy(false);\n setDone(true);\n },\n (error: unknown) => {\n if (mounted.current) {\n setBusy(false);\n present(error);\n }\n // Rejected again, so DangerConfirm stays armed with what was typed.\n throw error;\n },\n );\n };\n\n // A disarmed tile holds no password — DangerConfirm's own rule, for the fields it\n // does not own here.\n const disarmed = (armed: boolean) => {\n if (armed) return;\n setTyped(\"\");\n setPassword(\"\");\n setFieldError(null);\n setFailure(null);\n };\n\n return (\n <Card\n {...rest}\n data-state={done ? \"done\" : \"form\"}\n tone=\"danger\"\n className={cn(\"p-4 space-y-3\", className)}\n >\n <div>\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{modeSentence}</div>\n </div>\n {done ? (\n <div ref={doneRef} tabIndex={-1} role=\"status\" className=\"flex items-start gap-2 text-sm outline-none\">\n <UserX aria-hidden className=\"mt-0.5 size-4 shrink-0 text-muted\" />\n <span>{labels.done}</span>\n </div>\n ) : (\n <>\n <DangerConfirm\n commit={COMMIT_EXCEPT_BILLING}\n armLabel={labels.arm}\n prompt={labels.prompt}\n consequences={lines}\n confirmLabel={labels.confirm}\n confirmDisabledReason={held}\n busy={busy}\n onArmedChange={disarmed}\n onConfirm={confirm}\n >\n <TypedConfirmField\n ref={typedRef}\n target={email}\n match=\"caseless\"\n value={typed}\n onValueChange={(next) => {\n setTyped(next);\n if (fieldError === \"email\") setFieldError(null);\n }}\n error={fieldError === \"email\" ? labels.confirmationMismatch : undefined}\n busy={busy}\n />\n <CurrentPasswordInput\n ref={passwordRef}\n value={password}\n onValueChange={(next) => {\n setPassword(next);\n if (fieldError === \"password\") setFieldError(null);\n }}\n error={fieldError === \"password\" ? labels.wrongPassword : undefined}\n busy={busy}\n />\n </DangerConfirm>\n {hasContent(failure) && (\n <AlertBanner tone=\"danger\" size=\"sm\" role=\"alert\">\n {failure}\n </AlertBanner>\n )}\n </>\n )}\n </Card>\n );\n}\n"],"mappings":";AAmSM,SAUE,UATA,KADF;AAnSN,SAAS,gBAAgB,QAAQ,gBAAgB;AAEjD,SAAS,aAAa;AAEtB,SAAS,cAAc,oBAAwC;AAC/D,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,YAAY;AACrB,SAAS,eAAe,eAAe,yBAAyB;AAChE,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB,kBAAkB,QAAQ,kBAAkB;AAC7E,SAAS,yBAAyB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ACP,eAAe,CAAC,SAAS;AACvB,kCAAY,IAAI;AAChB,0BAAI,eAAe,WAAY,eAAc,IAAI;AAAA,oBACnD;AAAA,oBACA,OAAO,eAAe,aAAa,OAAO,gBAAgB;AAAA,oBAC1D;AAAA;AAAA,gBACF;AAAA;AAAA;AAAA,UACF;AAAA,UACC,WAAW,OAAO,KACjB,oBAAC,eAAY,MAAK,UAAS,MAAK,MAAK,MAAK,SACvC,mBACH;AAAA,WAEJ;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/account/delete-account-setting.tsx"],"sourcesContent":["import { isValidElement, useRef, useState } from \"react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { UserX } from \"lucide-react\";\n\nimport { useKitLabels, useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { hasContent } from \"../lib/presence\";\nimport {\n CurrentPasswordInput,\n DangerConfirm,\n DEFAULT_DANGER_CONFIRM_LABELS,\n TypedConfirmField,\n typedMatches,\n} from \"../components/danger-confirm\";\nimport type { DangerConsequence } from \"../components/danger-confirm\";\nimport { Card } from \"../components/card\";\nimport { authErrorCode, isRateLimited, retryAfterSeconds } from \"../auth/auth-errors\";\nimport { useFocusWhen } from \"../auth/status-parts\";\nimport { CARD_DESCRIPTION_CLASS, refusalCompanies, settle, useMounted } from \"./account-parts\";\nimport { SettingsCardTitle } from \"../settings/settings-heading\";\nimport { COMMIT_EXCEPT_BILLING } from \"../components/write-lock\";\nimport { DEFAULT_DELETE_ACCOUNT_LABELS } from \"./delete-account-setting-labels\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/**\n * Every string {@link DeleteAccountSetting} renders — the `deleteAccount` namespace of\n * `<UiKitProvider labels>`, overridable per instance through `labels`. The confirm's\n * Cancel, \"Password\" and \"Type … to confirm\" are `dangerConfirm`'s.\n */\nexport interface DeleteAccountLabels {\n /** The card's title. */\n title: string;\n /** Mode `after_days`, given the days: what happens and when. */\n afterDays: (days: number) => string;\n /** Mode `operator`: what happens, and who erases it. */\n operator: string;\n /** The button that opens the confirm. */\n arm: string;\n /** The confirm's warning, over the consequences. */\n prompt: string;\n /** The line in the consequences when `handOverCount` is given (Kurvenschmiede, §2.7),\n * given the count. */\n handOver: (count: number) => string;\n /** The button that sends it. */\n confirm: string;\n /** Said once the request is accepted — the app signs out next. */\n done: string;\n /** `password_incorrect` (server-kit's `400` for a wrong current password), under the\n * password field. */\n wrongPassword: string;\n /** `confirmation_mismatch` — the server did not take the typed address as the\n * account's — under the address field. */\n confirmationMismatch: string;\n /** `last_admin` — the account is the last active admin. */\n lastAdmin: string;\n /** `last_admin` naming the companies (kastlan checks per company), given them as one\n * list in the reader's language (\"Example AG and Sample GmbH\"). */\n lastAdminOf: (companies: string) => string;\n /** `household_has_members` — keksdose's guard (§6.4). */\n householdHasMembers: string;\n /** A request was throttled — HTTP 429 — given its `Retry-After` wait in seconds, or\n * `undefined` without one. */\n rateLimited: (seconds?: number) => string;\n /** Any other failure. */\n failed: string;\n}\n\n// Defined in ./delete-account-setting-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_DELETE_ACCOUNT_LABELS };\n\n/* ── Props ───────────────────────────────────────────────────────────────── */\n\n/** What happens after the deactivation (§2.1, §6.4) — the app's setting. */\nexport type DeletionMode = \"after_days\" | \"operator\";\n\n/** What {@link DeleteAccountSettingProps.onRequest} gets: the `POST /auth/me/deletion`\n * body. */\nexport interface DeleteAccountValues {\n /** As typed. */\n password: string;\n /** The address as TYPED, trimmed — the server re-checks it against the account\n * (server-kit's `confirm_email_matches`), as keksdose's admin actions do. */\n confirmEmail: string;\n}\n\n/** One line of the consequences: a node of the app's, or a {@link DangerConsequence}\n * for a key of its own and the `severe` mark. */\nexport type DeleteAccountConsequence = ReactNode | DangerConsequence;\n\nexport interface DeleteAccountSettingProps extends Omit<ComponentPropsWithRef<\"div\">, \"children\"> {\n /** The account's address — the text to type. */\n email: string;\n /** `\"after_days\"` (keksdose, Kurvenschmiede: erased by a scheduled job) or\n * `\"operator\"` (kastlan: company data is involved, an operator erases it). */\n mode: DeletionMode;\n /** With `after_days`: how many. Default 30 (§2.1). */\n days?: number;\n /**\n * What goes, in the app's words (§6.4: \"the app's own list\") — derived from the\n * account's own facts where it can be: keksdose's \"Budget X will be deleted; its 2\n * guests are told\", rather than the worst case for everybody.\n */\n consequences?: readonly DeleteAccountConsequence[];\n /** Kurvenschmiede (§2.7): how many owned items others can see — they pass to the\n * first active admin at erasure. A line of its own in the consequences; 0 or left\n * out, none. */\n handOverCount?: number;\n /**\n * The confirm was answered: send `POST /auth/me/deletion {password, confirm_email}`.\n * Resolve once it is accepted — the card says \"You are being signed out\" — and then\n * sign the user out: the server ended every session with the deactivation. Reject\n * with the client's error: `password_incorrect` under the password,\n * `confirmation_mismatch` under the address, `last_admin` (with kastlan's\n * `companies`) and `household_has_members` above the buttons, a 429 as\n * `rateLimited`, anything else (a demo account's 403, an app's own code) through\n * `describeError`, else `failed`. The confirm stays open with what was typed, for a\n * retry.\n */\n onRequest: (values: DeleteAccountValues) => Promise<unknown> | void;\n /** The app's own words for a failure, or `undefined` for the kit's. Asked first, for\n * every failure — kastlan's `last_admin` names the companies. */\n describeError?: (error: unknown) => ReactNode | undefined;\n labels?: LabelOverride<DeleteAccountLabels>;\n}\n\n/** Whether an item is a `{ text }` line rather than a node — a React element is an\n * object too, and so would a `{ text }` lookalike be, so the element test comes first. */\nfunction isConsequence(item: DeleteAccountConsequence): item is DangerConsequence {\n return typeof item === \"object\" && item !== null && !isValidElement(item) && \"text\" in item;\n}\n\n/**\n * Deleting one's own account (docs/user-admin-harmonization.md §6.4, §2.1): what it does,\n * the password, the typed address — then the app signs out.\n *\n * **Two stages, said before the button.** The request DEACTIVATES the account at once\n * (no sign-in, every session ended, marked for deletion); the erasure follows per the\n * app's `mode` — \"erased for good 30 days later\" (`after_days`, a scheduled job) or \"an\n * operator will erase it\" (`operator`, kastlan, where company records are involved).\n * The sentence is under the title, so it is read before anything is pressed.\n *\n * **The confirm is a {@link DangerConfirm}** with the two guards of every \"type the\n * address\" rule in the apps: the address typed (compared caseless, as in all of them)\n * and the password. They are the tile's own {@link TypedConfirmField} and\n * {@link CurrentPasswordInput}, drawn in its fields slot and held by\n * `confirmDisabledReason` with the tile's own sentences, rather than its built-in\n * `phrase` / `requirePassword` — those have no error of their own, and a wrong password\n * belongs under the password. Its consequences are the app's list, plus\n * Kurvenschmiede's hand-over line (`handOverCount`, §2.7: shared work goes to an\n * administrator, never a refusal). The typed address goes to `onRequest` as typed, so\n * the server re-checks it (`confirm_email_matches`).\n *\n * **Refusals** (§6.4) are read by code ({@link authErrorCode}): `password_incorrect` (a\n * `400`, so an app's 401 handling never signs the person out over a typo) under the\n * password, `confirmation_mismatch` under the address, `last_admin` — naming kastlan's\n * companies when the answer lists them — and keksdose's `household_has_members` guard\n * above the buttons; a 429; and the rest in the app's words. The confirm stays open with\n * what was typed, for a retry; Cancel wipes it.\n *\n * **After success** the card says the account is deactivated and the person is being\n * signed out — the app's to do, since the kit sends nothing (auth §8).\n *\n * **Under a write lock** the confirm is a `commit` exempt from billing\n * (`COMMIT_EXCEPT_BILLING`, 0.33): leaving never depends on paying\n * (docs/billing-harmonization.md decision 14, §12.36); a demo's lock still holds it.\n */\nexport function DeleteAccountSetting({\n email,\n mode,\n days = 30,\n consequences,\n handOverCount,\n onRequest,\n describeError,\n labels: labelsProp,\n className,\n ...rest\n}: DeleteAccountSettingProps) {\n const labels = useKitLabels(\"deleteAccount\", DEFAULT_DELETE_ACCOUNT_LABELS, labelsProp);\n // The guards speak the tile's words, so \"Type “…” to confirm\" and \"Enter your password\n // to confirm\" are translated once, in `dangerConfirm`.\n const guardLabels = useKitLabels(\"dangerConfirm\", DEFAULT_DANGER_CONFIRM_LABELS);\n const locale = useKitLocale();\n const [typed, setTyped] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n const [busy, setBusy] = useState(false);\n const [fieldError, setFieldError] = useState<\"email\" | \"password\" | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const [done, setDone] = useState(false);\n const mounted = useMounted();\n const typedRef = useRef<HTMLInputElement>(null);\n const passwordRef = useRef<HTMLInputElement>(null);\n const doneRef = useRef<HTMLDivElement>(null);\n // The tile went with the press; the answer takes the focus, so it is read out.\n useFocusWhen(done, doneRef);\n\n const modeSentence = mode === \"operator\" ? labels.operator : labels.afterDays(days);\n\n const lines: (string | DangerConsequence)[] = (consequences ?? [])\n // `{cond && \"…\"}` lines that came out empty are no lines.\n .filter((item) => item !== null && item !== undefined && item !== false && item !== \"\")\n .map((item, index) => (isConsequence(item) ? item : { key: `app-${index}`, text: item }));\n if (handOverCount !== undefined && handOverCount > 0) {\n lines.push({ key: \"hand-over\", text: labels.handOver(handOverCount) });\n }\n\n // The first guard still open, in the order the fields are drawn — DangerConfirm's rule.\n const held = !typedMatches(typed, email, \"caseless\")\n ? typeof guardLabels.needsPhrase === \"function\"\n ? guardLabels.needsPhrase(email)\n : guardLabels.needsPhrase\n : password === \"\"\n ? guardLabels.needsPassword\n : undefined;\n\n const present = (error: unknown) => {\n const own = describeError?.(error);\n if (hasContent(own)) {\n setFailure(own);\n return;\n }\n if (isRateLimited(error)) {\n setFailure(labels.rateLimited(retryAfterSeconds(error)));\n return;\n }\n const code = authErrorCode(error);\n // `invalid_credentials` too, for a server that answered a wrong password so before\n // server-kit 0.4.0 named `password_incorrect`.\n if (code === \"password_incorrect\" || code === \"invalid_credentials\") {\n setFieldError(\"password\");\n passwordRef.current?.focus();\n return;\n }\n if (code === \"confirmation_mismatch\" || code === \"confirmation_required\") {\n setFieldError(\"email\");\n typedRef.current?.focus();\n return;\n }\n if (code === \"last_admin\") {\n const companies = refusalCompanies(error);\n setFailure(\n companies\n ? labels.lastAdminOf(new Intl.ListFormat(locale, { type: \"conjunction\" }).format(companies))\n : labels.lastAdmin,\n );\n return;\n }\n setFailure(code === \"household_has_members\" ? labels.householdHasMembers : labels.failed);\n };\n\n const confirm = () => {\n setFailure(null);\n setFieldError(null);\n setBusy(true);\n const values: DeleteAccountValues = { password, confirmEmail: typed.trim() };\n return settle(() => onRequest(values)).then(\n () => {\n if (!mounted.current) return;\n setBusy(false);\n setDone(true);\n },\n (error: unknown) => {\n if (mounted.current) {\n setBusy(false);\n present(error);\n }\n // Rejected again, so DangerConfirm stays armed with what was typed.\n throw error;\n },\n );\n };\n\n // A disarmed tile holds no password — DangerConfirm's own rule, for the fields it\n // does not own here.\n const disarmed = (armed: boolean) => {\n if (armed) return;\n setTyped(\"\");\n setPassword(\"\");\n setFieldError(null);\n setFailure(null);\n };\n\n return (\n <Card {...rest} data-state={done ? \"done\" : \"form\"} tone=\"danger\" className={cn(\"p-4 space-y-3\", className)}>\n <div>\n <SettingsCardTitle>{labels.title}</SettingsCardTitle>\n <div className={CARD_DESCRIPTION_CLASS}>{modeSentence}</div>\n </div>\n {done ? (\n <div ref={doneRef} tabIndex={-1} role=\"status\" className=\"flex items-start gap-2 text-sm outline-none\">\n <UserX aria-hidden className=\"mt-0.5 size-4 shrink-0 text-muted\" />\n <span>{labels.done}</span>\n </div>\n ) : (\n <>\n <DangerConfirm\n commit={COMMIT_EXCEPT_BILLING}\n armLabel={labels.arm}\n prompt={labels.prompt}\n consequences={lines}\n confirmLabel={labels.confirm}\n confirmDisabledReason={held}\n busy={busy}\n onArmedChange={disarmed}\n onConfirm={confirm}\n >\n <TypedConfirmField\n ref={typedRef}\n target={email}\n match=\"caseless\"\n value={typed}\n onValueChange={(next) => {\n setTyped(next);\n if (fieldError === \"email\") setFieldError(null);\n }}\n error={fieldError === \"email\" ? labels.confirmationMismatch : undefined}\n busy={busy}\n />\n <CurrentPasswordInput\n ref={passwordRef}\n value={password}\n onValueChange={(next) => {\n setPassword(next);\n if (fieldError === \"password\") setFieldError(null);\n }}\n error={fieldError === \"password\" ? labels.wrongPassword : undefined}\n busy={busy}\n />\n </DangerConfirm>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AAc;AAAA,UACd,cAAc,OAAO;AAAA,UACrB,uBAAuB;AAAA,UACvB;AAAA,UACA,eAAe;AAAA,UACf,WAAW;AAAA,UAEX;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,KAAK;AAAA,gBACL,QAAQ;AAAA,gBACR,OAAM;AAAA,gBACN,OAAO;AAAA,gBACP,eAAe,CAAC,SAAS;AACvB,2BAAS,IAAI;AACb,sBAAI,eAAe,QAAS,eAAc,IAAI;AAAA,gBAChD;AAAA,gBACA,OAAO,eAAe,UAAU,OAAO,uBAAuB;AAAA,gBAC9D;AAAA;AAAA,YACF;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,KAAK;AAAA,gBACL,OAAO;AAAA,gBACP,eAAe,CAAC,SAAS;AACvB,8BAAY,IAAI;AAChB,sBAAI,eAAe,WAAY,eAAc,IAAI;AAAA,gBACnD;AAAA,gBACA,OAAO,eAAe,aAAa,OAAO,gBAAgB;AAAA,gBAC1D;AAAA;AAAA,YACF;AAAA;AAAA;AAAA,MACF;AAAA,MACC,WAAW,OAAO,KACjB,oBAAC,eAAY,MAAK,UAAS,MAAK,MAAK,MAAK,SACvC,mBACH;AAAA,OAEJ;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/email-change-setting-labels.ts"],"sourcesContent":["// The English words of ./email-change-setting, in a module with no component code: the\n// English catalogue (src/i18n/defaults.ts) imports them without the component, so `en`\n// loads as one chunk like the other languages (0.34, KS U8). ./email-change-setting\n// re-exports them.\n\nimport { englishRateLimited } from \"../auth/auth-errors\";\nimport type { EmailChangeLabels } from \"./email-change-setting\";\n\nexport const DEFAULT_EMAIL_CHANGE_LABELS: EmailChangeLabels = {\n title: \"Email address\",\n current: \"Current address\",\n newEmail: \"New email address\",\n password: \"Current password\",\n passwordHint: \"Your address is how you sign in, so changing it takes your password.\",\n emailTagUse: (address) => `Use ${address}`,\n emailTagHint:\n \"Many providers deliver name+tag@… to the same inbox, so mail from this app is easy to filter and trace. Check yours does before you rely on it: you would sign in with the tagged address.\",\n submit: \"Change email address\",\n sameAsCurrent: \"This is already your address.\",\n emailTaken: \"An account with this email address already exists.\",\n wrongPassword: \"The password is incorrect.\",\n pending: (newEmail) => `Confirm the link we sent to ${newEmail}.`,\n pendingHint: (currentEmail)
|
|
1
|
+
{"version":3,"sources":["../../src/account/email-change-setting-labels.ts"],"sourcesContent":["// The English words of ./email-change-setting, in a module with no component code: the\n// English catalogue (src/i18n/defaults.ts) imports them without the component, so `en`\n// loads as one chunk like the other languages (0.34, KS U8). ./email-change-setting\n// re-exports them.\n\nimport { englishRateLimited } from \"../auth/auth-errors\";\nimport type { EmailChangeLabels } from \"./email-change-setting\";\n\nexport const DEFAULT_EMAIL_CHANGE_LABELS: EmailChangeLabels = {\n title: \"Email address\",\n current: \"Current address\",\n newEmail: \"New email address\",\n password: \"Current password\",\n passwordHint: \"Your address is how you sign in, so changing it takes your password.\",\n emailTagUse: (address) => `Use ${address}`,\n emailTagHint:\n \"Many providers deliver name+tag@… to the same inbox, so mail from this app is easy to filter and trace. Check yours does before you rely on it: you would sign in with the tagged address.\",\n submit: \"Change email address\",\n sameAsCurrent: \"This is already your address.\",\n emailTaken: \"An account with this email address already exists.\",\n wrongPassword: \"The password is incorrect.\",\n pending: (newEmail) => `Confirm the link we sent to ${newEmail}.`,\n pendingHint: (currentEmail) => `Until you do, you keep signing in with ${currentEmail}. Check your spam folder too.`,\n resend: \"Send the link again\",\n resent: \"We sent the link again.\",\n cancel: \"Cancel the change\",\n confirmed: (email) => `Your email address is now ${email}.`,\n passkeyNote: \"Your passkeys keep working. Your device may still list them under your old address.\",\n rateLimited: englishRateLimited,\n failed: \"That didn’t work. Please try again.\",\n};\n"],"mappings":";AAKA,SAAS,0BAA0B;AAG5B,MAAM,8BAAiD;AAAA,EAC5D,OAAO;AAAA,EACP,SAAS;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,aAAa,CAAC,YAAY,OAAO,OAAO;AAAA,EACxC,cACE;AAAA,EACF,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,SAAS,CAAC,aAAa,+BAA+B,QAAQ;AAAA,EAC9D,aAAa,CAAC,iBAAiB,0CAA0C,YAAY;AAAA,EACrF,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,WAAW,CAAC,UAAU,6BAA6B,KAAK;AAAA,EACxD,aAAa;AAAA,EACb,aAAa;AAAA,EACb,QAAQ;AACV;","names":[]}
|