@eifi1/ui-kit 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +445 -283
- package/dist/account/account-parts.d.ts +6 -8
- package/dist/account/account-parts.js +1 -2
- package/dist/account/account-parts.js.map +1 -1
- package/dist/{components → account}/account-settings-labels.d.ts +16 -10
- package/dist/{components → account}/account-settings-labels.js +3 -1
- package/dist/account/account-settings-labels.js.map +1 -0
- package/dist/{components → account}/account-settings.d.ts +53 -23
- package/dist/{components → account}/account-settings.js +97 -26
- package/dist/account/account-settings.js.map +1 -0
- package/dist/account/data-export-setting-labels.d.ts +2 -0
- package/dist/account/data-export-setting-labels.js +15 -0
- package/dist/account/data-export-setting-labels.js.map +1 -0
- package/dist/account/data-export-setting.d.ts +9 -11
- package/dist/account/data-export-setting.js +11 -27
- package/dist/account/data-export-setting.js.map +1 -1
- package/dist/account/delete-account-setting-labels.d.ts +2 -0
- package/dist/account/delete-account-setting-labels.js +23 -0
- package/dist/account/delete-account-setting-labels.js.map +1 -0
- package/dist/account/delete-account-setting.d.ts +132 -100
- package/dist/account/delete-account-setting.js +7 -23
- package/dist/account/delete-account-setting.js.map +1 -1
- package/dist/account/email-change-setting-labels.d.ts +2 -0
- package/dist/account/email-change-setting-labels.js +28 -0
- package/dist/account/email-change-setting-labels.js.map +1 -0
- package/dist/account/email-change-setting.d.ts +10 -12
- package/dist/account/email-change-setting.js +11 -30
- package/dist/account/email-change-setting.js.map +1 -1
- package/dist/{components → account}/passkeys-setting.d.ts +9 -12
- package/dist/{components → account}/passkeys-setting.js +10 -7
- package/dist/account/passkeys-setting.js.map +1 -0
- package/dist/account/sessions-setting-labels.d.ts +2 -0
- package/dist/account/sessions-setting-labels.js +22 -0
- package/dist/account/sessions-setting-labels.js.map +1 -0
- package/dist/account/sessions-setting.d.ts +12 -14
- package/dist/account/sessions-setting.js +8 -23
- package/dist/account/sessions-setting.js.map +1 -1
- package/dist/admin/admin-action-confirm-labels.d.ts +2 -0
- package/dist/admin/admin-action-confirm-labels.js +16 -0
- package/dist/admin/admin-action-confirm-labels.js.map +1 -0
- package/dist/admin/admin-action-confirm.d.ts +156 -100
- package/dist/admin/admin-action-confirm.js +17 -22
- package/dist/admin/admin-action-confirm.js.map +1 -1
- package/dist/admin/admin-action-log-labels.d.ts +2 -0
- package/dist/admin/admin-action-log-labels.js +73 -0
- package/dist/admin/admin-action-log-labels.js.map +1 -0
- package/dist/admin/admin-action-log.d.ts +98 -22
- package/dist/admin/admin-action-log.js +48 -45
- package/dist/admin/admin-action-log.js.map +1 -1
- package/dist/admin/admin-parts.d.ts +7 -14
- package/dist/admin/admin-parts.js +0 -4
- package/dist/admin/admin-parts.js.map +1 -1
- package/dist/admin/invitations-panel-labels.d.ts +2 -0
- package/dist/admin/invitations-panel-labels.js +29 -0
- package/dist/admin/invitations-panel-labels.js.map +1 -0
- package/dist/admin/invitations-panel.d.ts +167 -100
- package/dist/admin/invitations-panel.js +12 -31
- package/dist/admin/invitations-panel.js.map +1 -1
- package/dist/admin/plan-change-labels.d.ts +2 -0
- package/dist/admin/plan-change-labels.js +22 -0
- package/dist/admin/plan-change-labels.js.map +1 -0
- package/dist/admin/plan-change.d.ts +244 -100
- package/dist/admin/plan-change.js +17 -23
- package/dist/admin/plan-change.js.map +1 -1
- package/dist/admin/reviewer-scope-editor-labels.d.ts +2 -0
- package/dist/admin/reviewer-scope-editor-labels.js +14 -0
- package/dist/admin/reviewer-scope-editor-labels.js.map +1 -0
- package/dist/admin/reviewer-scope-editor.d.ts +95 -100
- package/dist/admin/reviewer-scope-editor.js +5 -13
- package/dist/admin/reviewer-scope-editor.js.map +1 -1
- package/dist/admin/role-select-labels.d.ts +2 -0
- package/dist/admin/role-select-labels.js +15 -0
- package/dist/admin/role-select-labels.js.map +1 -0
- package/dist/admin/role-select.d.ts +136 -100
- package/dist/admin/role-select.js +7 -18
- package/dist/admin/role-select.js.map +1 -1
- package/dist/admin/transfer-ownership-dialog-labels.d.ts +2 -0
- package/dist/admin/transfer-ownership-dialog-labels.js +18 -0
- package/dist/admin/transfer-ownership-dialog-labels.js.map +1 -0
- package/dist/admin/transfer-ownership-dialog.d.ts +81 -100
- package/dist/admin/transfer-ownership-dialog.js +3 -15
- package/dist/admin/transfer-ownership-dialog.js.map +1 -1
- package/dist/admin/user-roster-labels.d.ts +2 -0
- package/dist/admin/user-roster-labels.js +16 -0
- package/dist/admin/user-roster-labels.js.map +1 -0
- package/dist/admin/user-roster.d.ts +225 -100
- package/dist/admin/user-roster.js +4 -14
- package/dist/admin/user-roster.js.map +1 -1
- package/dist/auth/accept-invitation-labels.d.ts +2 -0
- package/dist/auth/accept-invitation-labels.js +20 -0
- package/dist/auth/accept-invitation-labels.js.map +1 -0
- package/dist/auth/accept-invitation.d.ts +11 -13
- package/dist/auth/accept-invitation.js +3 -16
- package/dist/auth/accept-invitation.js.map +1 -1
- package/dist/auth/auth-errors.d.ts +34 -23
- package/dist/auth/auth-errors.js +8 -4
- package/dist/auth/auth-errors.js.map +1 -1
- package/dist/auth/complete-name-dialog-labels.d.ts +2 -0
- package/dist/auth/complete-name-dialog-labels.js +14 -0
- package/dist/auth/complete-name-dialog-labels.js.map +1 -0
- package/dist/auth/complete-name-dialog.d.ts +9 -11
- package/dist/auth/complete-name-dialog.js +4 -11
- package/dist/auth/complete-name-dialog.js.map +1 -1
- package/dist/auth/email-tag.d.ts +2 -4
- package/dist/auth/forgot-password-form-labels.d.ts +3 -0
- package/dist/auth/forgot-password-form-labels.js +17 -0
- package/dist/auth/forgot-password-form-labels.js.map +1 -0
- package/dist/auth/forgot-password-form.d.ts +9 -12
- package/dist/auth/forgot-password-form.js +6 -15
- package/dist/auth/forgot-password-form.js.map +1 -1
- package/dist/auth/form-rules.d.ts +5 -7
- package/dist/auth/new-password-fields.d.ts +4 -8
- package/dist/auth/new-password-fields.js +1 -1
- package/dist/auth/new-password-fields.js.map +1 -1
- package/dist/auth/not-found-page-labels.d.ts +2 -0
- package/dist/auth/not-found-page-labels.js +11 -0
- package/dist/auth/not-found-page-labels.js.map +1 -0
- package/dist/auth/not-found-page.d.ts +9 -11
- package/dist/auth/not-found-page.js +5 -10
- package/dist/auth/not-found-page.js.map +1 -1
- package/dist/auth/register-form-labels.d.ts +3 -0
- package/dist/auth/register-form-labels.js +28 -0
- package/dist/auth/register-form-labels.js.map +1 -0
- package/dist/auth/register-form.d.ts +174 -100
- package/dist/auth/register-form.js +11 -31
- package/dist/auth/register-form.js.map +1 -1
- package/dist/auth/reset-password-form-labels.d.ts +3 -0
- package/dist/auth/reset-password-form-labels.js +24 -0
- package/dist/auth/reset-password-form-labels.js.map +1 -0
- package/dist/auth/reset-password-form.d.ts +12 -15
- package/dist/auth/reset-password-form.js +6 -22
- package/dist/auth/reset-password-form.js.map +1 -1
- package/dist/auth/sign-in-form-labels.d.ts +3 -0
- package/dist/auth/sign-in-form-labels.js +42 -0
- package/dist/auth/sign-in-form-labels.js.map +1 -0
- package/dist/auth/sign-in-form.d.ts +15 -19
- package/dist/auth/sign-in-form.js +12 -46
- package/dist/auth/sign-in-form.js.map +1 -1
- package/dist/auth/status-parts.d.ts +13 -17
- package/dist/auth/status-parts.js +3 -3
- package/dist/auth/status-parts.js.map +1 -1
- package/dist/auth/verify-email-labels.d.ts +2 -0
- package/dist/auth/verify-email-labels.js +25 -0
- package/dist/auth/verify-email-labels.js.map +1 -0
- package/dist/auth/verify-email.d.ts +15 -17
- package/dist/auth/verify-email.js +4 -21
- package/dist/auth/verify-email.js.map +1 -1
- package/dist/billing/billing-banner.d.ts +8 -108
- package/dist/billing/billing-banner.js +2 -1
- package/dist/billing/billing-banner.js.map +1 -1
- package/dist/billing/billing-labels.d.ts +168 -100
- package/dist/billing/billing-labels.js.map +1 -1
- package/dist/billing/billing-lock.d.ts +10 -109
- package/dist/billing/billing-overview.d.ts +7 -108
- package/dist/billing/billing-standing.d.ts +6 -107
- package/dist/billing/checkout-processing.d.ts +8 -110
- package/dist/billing/checkout-processing.js +2 -9
- package/dist/billing/checkout-processing.js.map +1 -1
- package/dist/billing/checkout-return.d.ts +5 -7
- package/dist/billing/pay-page.d.ts +22 -119
- package/dist/billing/pay-page.js.map +1 -1
- package/dist/billing/plan-card.d.ts +14 -114
- package/dist/billing/plan-card.js +15 -13
- package/dist/billing/plan-card.js.map +1 -1
- package/dist/billing/plan-limit-notice.d.ts +8 -108
- package/dist/billing/plan-limit-notice.js +1 -1
- package/dist/billing/plan-limit-notice.js.map +1 -1
- package/dist/billing/plan-limit-toast.d.ts +6 -106
- package/dist/billing/plan-limit.d.ts +2 -4
- package/dist/billing/plan-price.d.ts +10 -12
- package/dist/billing/subscription-actions.d.ts +6 -108
- package/dist/billing/subscription-actions.js +2 -2
- package/dist/billing/subscription-actions.js.map +1 -1
- package/dist/billing/subscription-status-chip.d.ts +7 -107
- package/dist/chart.d.ts +12 -112
- package/dist/chart.js +4 -0
- package/dist/chart.js.map +1 -1
- package/dist/components/account-chips-labels.d.ts +10 -0
- package/dist/components/account-chips-labels.js +15 -0
- package/dist/components/account-chips-labels.js.map +1 -0
- package/dist/components/account-chips.d.ts +22 -44
- package/dist/components/account-chips.js +9 -14
- package/dist/components/account-chips.js.map +1 -1
- package/dist/components/alert-banner.d.ts +15 -11
- package/dist/components/alert-banner.js +28 -18
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.d.ts +66 -109
- package/dist/components/amount-input.js +259 -283
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/appearance-labels.d.ts +6 -10
- package/dist/components/appearance-labels.js.map +1 -1
- package/dist/components/authed-image-labels.d.ts +2 -0
- package/dist/components/authed-image-labels.js +10 -0
- package/dist/components/authed-image-labels.js.map +1 -0
- package/dist/components/authed-image.d.ts +11 -13
- package/dist/components/authed-image.js +2 -6
- package/dist/components/authed-image.js.map +1 -1
- package/dist/components/autocomplete.d.ts +13 -11
- package/dist/components/autocomplete.js +35 -30
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/breadcrumbs-labels.d.ts +2 -0
- package/dist/components/breadcrumbs-labels.js +9 -0
- package/dist/components/breadcrumbs-labels.js.map +1 -0
- package/dist/components/breadcrumbs.d.ts +10 -12
- package/dist/components/breadcrumbs.js +7 -10
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/bulk-action-bar-labels.d.ts +2 -0
- package/dist/components/bulk-action-bar-labels.js +10 -0
- package/dist/components/bulk-action-bar-labels.js.map +1 -0
- package/dist/components/bulk-action-bar.d.ts +10 -12
- package/dist/components/bulk-action-bar.js +9 -12
- package/dist/components/bulk-action-bar.js.map +1 -1
- package/dist/components/button-group.d.ts +7 -109
- package/dist/components/button-group.js +5 -5
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/button-look.d.ts +88 -0
- package/dist/components/button-look.js +91 -0
- package/dist/components/button-look.js.map +1 -0
- package/dist/components/button.d.ts +153 -0
- package/dist/components/button.js +165 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calculator.d.ts +8 -106
- package/dist/components/calculator.js +10 -7
- package/dist/components/calculator.js.map +1 -1
- package/dist/components/calendar-heatmap-labels.d.ts +3 -0
- package/dist/components/calendar-heatmap-labels.js +12 -0
- package/dist/components/calendar-heatmap-labels.js.map +1 -0
- package/dist/components/calendar-heatmap.d.ts +13 -16
- package/dist/components/calendar-heatmap.js +7 -13
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/card.d.ts +145 -0
- package/dist/components/card.js +186 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/chart-height.d.ts +4 -7
- package/dist/components/chart-zoom-core.d.ts +202 -0
- package/dist/components/chart-zoom-core.js +334 -0
- package/dist/components/chart-zoom-core.js.map +1 -0
- package/dist/components/chart-zoom.d.ts +39 -205
- package/dist/components/chart-zoom.js +15 -316
- package/dist/components/chart-zoom.js.map +1 -1
- package/dist/components/chart.d.ts +11 -15
- package/dist/components/chart.js +11 -11
- package/dist/components/chart.js.map +1 -1
- package/dist/components/checkbox-group.d.ts +6 -10
- package/dist/components/checkbox-group.js +10 -9
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/checkbox.d.ts +8 -12
- package/dist/components/checkbox.js +20 -18
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/chip-input.d.ts +73 -0
- package/dist/components/chip-input.js +224 -0
- package/dist/components/chip-input.js.map +1 -0
- package/dist/components/chip-labels.d.ts +2 -0
- package/dist/components/chip-labels.js +12 -0
- package/dist/components/chip-labels.js.map +1 -0
- package/dist/components/chip.d.ts +18 -93
- package/dist/components/chip.js +74 -426
- package/dist/components/chip.js.map +1 -1
- package/dist/components/choice-card.d.ts +21 -18
- package/dist/components/choice-card.js +45 -45
- package/dist/components/choice-card.js.map +1 -1
- package/dist/components/column-mapper-labels.d.ts +5 -0
- package/dist/components/column-mapper-labels.js +34 -0
- package/dist/components/column-mapper-labels.js.map +1 -0
- package/dist/components/column-mapper.d.ts +15 -17
- package/dist/components/column-mapper.js +11 -37
- package/dist/components/column-mapper.js.map +1 -1
- package/dist/components/combobox-core.d.ts +79 -40
- package/dist/components/combobox-core.js +189 -122
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox-suggestions.d.ts +76 -0
- package/dist/components/combobox-suggestions.js +56 -0
- package/dist/components/combobox-suggestions.js.map +1 -0
- package/dist/components/combobox.d.ts +14 -159
- package/dist/components/combobox.js +40 -507
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/confirm-dialog-labels.d.ts +7 -0
- package/dist/components/confirm-dialog-labels.js +10 -0
- package/dist/components/confirm-dialog-labels.js.map +1 -0
- package/dist/components/confirm-dialog.d.ts +165 -100
- package/dist/components/confirm-dialog.js +2 -6
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/copy-button-labels.d.ts +2 -0
- package/dist/components/copy-button-labels.js +12 -0
- package/dist/components/copy-button-labels.js.map +1 -0
- package/dist/components/copy-button.d.ts +70 -100
- package/dist/components/copy-button.js +4 -9
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/country-select-labels.d.ts +2 -0
- package/dist/components/country-select-labels.js +10 -0
- package/dist/components/country-select-labels.js.map +1 -0
- package/dist/components/country-select.d.ts +18 -15
- package/dist/components/country-select.js +49 -64
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/currency-option-list.d.ts +63 -0
- package/dist/components/currency-option-list.js +135 -0
- package/dist/components/currency-option-list.js.map +1 -0
- package/dist/components/currency-select.d.ts +10 -30
- package/dist/components/currency-select.js +50 -133
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm-labels.d.ts +14 -0
- package/dist/components/danger-confirm-labels.js +17 -0
- package/dist/components/danger-confirm-labels.js.map +1 -0
- package/dist/components/danger-confirm.d.ts +448 -100
- package/dist/components/danger-confirm.js +40 -46
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-cells.d.ts +9 -24
- package/dist/components/data-table-cells.js +1 -1
- package/dist/components/data-table-cells.js.map +1 -1
- package/dist/components/data-table-column-settings.d.ts +16 -0
- package/dist/components/data-table-column-settings.js +119 -0
- package/dist/components/data-table-column-settings.js.map +1 -0
- package/dist/components/data-table-filter-popover.d.ts +5 -19
- package/dist/components/data-table-filter-popover.js +39 -22
- package/dist/components/data-table-filter-popover.js.map +1 -1
- package/dist/components/data-table-filters.d.ts +93 -15
- package/dist/components/data-table-filters.js +22 -7
- package/dist/components/data-table-filters.js.map +1 -1
- package/dist/components/data-table-head.d.ts +36 -0
- package/dist/components/data-table-head.js +190 -0
- package/dist/components/data-table-head.js.map +1 -0
- package/dist/components/data-table-labels.d.ts +124 -15
- package/dist/components/data-table-labels.js +9 -5
- package/dist/components/data-table-labels.js.map +1 -1
- package/dist/components/data-table-mobile.d.ts +106 -0
- package/dist/components/data-table-mobile.js +412 -0
- package/dist/components/data-table-mobile.js.map +1 -0
- package/dist/components/data-table-pagination.d.ts +6 -21
- package/dist/components/data-table-pagination.js +7 -7
- package/dist/components/data-table-pagination.js.map +1 -1
- package/dist/components/data-table-resize.d.ts +37 -0
- package/dist/components/data-table-resize.js +103 -0
- package/dist/components/data-table-resize.js.map +1 -0
- package/dist/components/data-table-row-actions.d.ts +24 -0
- package/dist/components/data-table-row-actions.js +95 -0
- package/dist/components/data-table-row-actions.js.map +1 -0
- package/dist/components/data-table-selection.d.ts +21 -0
- package/dist/components/data-table-selection.js +30 -0
- package/dist/components/data-table-selection.js.map +1 -0
- package/dist/components/data-table-shared.d.ts +77 -0
- package/dist/components/data-table-shared.js +77 -0
- package/dist/components/data-table-shared.js.map +1 -0
- package/dist/components/data-table-sort.d.ts +8 -10
- package/dist/components/data-table.d.ts +603 -15
- package/dist/components/data-table.js +134 -927
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-field.d.ts +203 -0
- package/dist/components/date-field.js +270 -0
- package/dist/components/date-field.js.map +1 -0
- package/dist/components/date-picker.d.ts +6 -261
- package/dist/components/date-picker.js +24 -760
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.d.ts +125 -0
- package/dist/components/date-range-picker.js +261 -0
- package/dist/components/date-range-picker.js.map +1 -0
- package/dist/components/description-list-labels.d.ts +2 -0
- package/dist/components/description-list-labels.js +8 -0
- package/dist/components/description-list-labels.js.map +1 -0
- package/dist/components/description-list.d.ts +13 -15
- package/dist/components/description-list.js +17 -11
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog-frame-labels.d.ts +2 -0
- package/dist/components/dialog-frame-labels.js +6 -0
- package/dist/components/dialog-frame-labels.js.map +1 -0
- package/dist/components/dialog-frame.d.ts +7 -11
- package/dist/components/dialog-frame.js +6 -6
- package/dist/components/dialog-frame.js.map +1 -1
- package/dist/components/disclosure.d.ts +6 -10
- package/dist/components/disclosure.js +11 -11
- package/dist/components/disclosure.js.map +1 -1
- package/dist/components/dropdown.d.ts +55 -27
- package/dist/components/dropdown.js +62 -31
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/empty-state.d.ts +64 -0
- package/dist/components/empty-state.js +70 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/entity-combobox.d.ts +10 -11
- package/dist/components/entity-combobox.js +14 -13
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/error-boundary-labels.d.ts +2 -0
- package/dist/components/error-boundary-labels.js +19 -0
- package/dist/components/error-boundary-labels.js.map +1 -0
- package/dist/components/error-boundary.d.ts +17 -17
- package/dist/components/error-boundary.js +5 -17
- package/dist/components/error-boundary.js.map +1 -1
- package/dist/components/facing-pair.d.ts +7 -115
- package/dist/components/facing-pair.js +1 -1
- package/dist/components/facing-pair.js.map +1 -1
- package/dist/components/field-base.d.ts +260 -0
- package/dist/components/field-base.js +228 -0
- package/dist/components/field-base.js.map +1 -0
- package/dist/components/field-parts.d.ts +188 -87
- package/dist/components/field-parts.js +60 -33
- package/dist/components/field-parts.js.map +1 -1
- package/dist/components/field-strip.d.ts +19 -28
- package/dist/components/field-strip.js +2 -2
- package/dist/components/field-strip.js.map +1 -1
- package/dist/components/field-sync-labels.d.ts +2 -0
- package/dist/components/field-sync-labels.js +12 -0
- package/dist/components/field-sync-labels.js.map +1 -0
- package/dist/components/field-sync.d.ts +20 -19
- package/dist/components/field-sync.js +4 -10
- package/dist/components/field-sync.js.map +1 -1
- package/dist/components/field.d.ts +45 -10
- package/dist/components/field.js +10 -8
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-button.d.ts +85 -100
- package/dist/components/file-button.js +23 -169
- package/dist/components/file-button.js.map +1 -1
- package/dist/components/file-dropzone.d.ts +9 -109
- package/dist/components/file-dropzone.js +22 -22
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/floating-panel-labels.d.ts +2 -0
- package/dist/components/floating-panel-labels.js +9 -0
- package/dist/components/floating-panel-labels.js.map +1 -0
- package/dist/components/floating-panel.d.ts +17 -21
- package/dist/components/floating-panel.js +19 -18
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/focus-ring.d.ts +9 -6
- package/dist/components/focus-ring.js +2 -2
- package/dist/components/focus-ring.js.map +1 -1
- package/dist/components/form-actions-labels.d.ts +2 -0
- package/dist/components/form-actions-labels.js +10 -0
- package/dist/components/form-actions-labels.js.map +1 -0
- package/dist/components/form-actions.d.ts +280 -100
- package/dist/components/form-actions.js +10 -20
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/full-bleed-dialog.d.ts +7 -8
- package/dist/components/full-bleed-dialog.js +14 -13
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/grouped-picker.d.ts +21 -16
- package/dist/components/grouped-picker.js +76 -62
- package/dist/components/grouped-picker.js.map +1 -1
- package/dist/components/help-popover.d.ts +60 -0
- package/dist/components/help-popover.js +48 -0
- package/dist/components/help-popover.js.map +1 -0
- package/dist/components/hover-menu.d.ts +17 -16
- package/dist/components/hover-menu.js +18 -17
- package/dist/components/hover-menu.js.map +1 -1
- package/dist/components/iban-input-labels.d.ts +2 -0
- package/dist/components/iban-input-labels.js +13 -0
- package/dist/components/iban-input-labels.js.map +1 -0
- package/dist/components/iban-input.d.ts +73 -100
- package/dist/components/iban-input.js +22 -15
- package/dist/components/iban-input.js.map +1 -1
- package/dist/components/icon-button.d.ts +300 -0
- package/dist/components/icon-button.js +465 -0
- package/dist/components/icon-button.js.map +1 -0
- package/dist/components/icon-picker-labels.d.ts +2 -0
- package/dist/components/icon-picker-labels.js +12 -0
- package/dist/components/icon-picker-labels.js.map +1 -0
- package/dist/components/icon-picker.d.ts +13 -13
- package/dist/components/icon-picker.js +18 -17
- package/dist/components/icon-picker.js.map +1 -1
- package/dist/components/image-grid-labels.d.ts +2 -0
- package/dist/components/image-grid-labels.js +10 -0
- package/dist/components/image-grid-labels.js.map +1 -0
- package/dist/components/image-grid.d.ts +12 -14
- package/dist/components/image-grid.js +6 -10
- package/dist/components/image-grid.js.map +1 -1
- package/dist/components/inline-edit-field-labels.d.ts +2 -0
- package/dist/components/inline-edit-field-labels.js +10 -0
- package/dist/components/inline-edit-field-labels.js.map +1 -0
- package/dist/components/inline-edit-field.d.ts +11 -13
- package/dist/components/inline-edit-field.js +11 -13
- package/dist/components/inline-edit-field.js.map +1 -1
- package/dist/components/inline-entity-combobox.d.ts +155 -0
- package/dist/components/inline-entity-combobox.js +467 -0
- package/dist/components/inline-entity-combobox.js.map +1 -0
- package/dist/components/input.d.ts +98 -0
- package/dist/components/input.js +219 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/jump-calendar.d.ts +8 -0
- package/dist/components/jump-calendar.js +274 -0
- package/dist/components/jump-calendar.js.map +1 -0
- package/dist/components/language-select.d.ts +20 -110
- package/dist/components/language-select.js +12 -7
- package/dist/components/language-select.js.map +1 -1
- package/dist/components/legal-labels.d.ts +2 -0
- package/dist/components/legal-labels.js +100 -0
- package/dist/components/legal-labels.js.map +1 -0
- package/dist/components/legal-page.d.ts +17 -117
- package/dist/components/legal-page.js +2 -2
- package/dist/components/legal-page.js.map +1 -1
- package/dist/components/legal.d.ts +353 -100
- package/dist/components/legal.js +7 -101
- package/dist/components/legal.js.map +1 -1
- package/dist/components/lightbox-labels.d.ts +2 -0
- package/dist/components/lightbox-labels.js +17 -0
- package/dist/components/lightbox-labels.js.map +1 -0
- package/dist/components/lightbox.d.ts +12 -14
- package/dist/components/lightbox.js +9 -19
- package/dist/components/lightbox.js.map +1 -1
- package/dist/components/line-items-labels.d.ts +2 -0
- package/dist/components/line-items-labels.js +13 -0
- package/dist/components/line-items-labels.js.map +1 -0
- package/dist/components/line-items.d.ts +16 -18
- package/dist/components/line-items.js +18 -26
- package/dist/components/line-items.js.map +1 -1
- package/dist/components/list-labels.d.ts +2 -0
- package/dist/components/list-labels.js +9 -0
- package/dist/components/list-labels.js.map +1 -0
- package/dist/components/list.d.ts +32 -21
- package/dist/components/list.js +41 -25
- package/dist/components/list.js.map +1 -1
- package/dist/components/loading-state.d.ts +5 -9
- package/dist/components/loading-state.js +2 -2
- package/dist/components/loading-state.js.map +1 -1
- package/dist/components/measured-grid-labels.d.ts +4 -0
- package/dist/components/measured-grid-labels.js +21 -0
- package/dist/components/measured-grid-labels.js.map +1 -0
- package/dist/components/measured-grid.d.ts +13 -17
- package/dist/components/measured-grid.js +31 -50
- package/dist/components/measured-grid.js.map +1 -1
- package/dist/components/menu-item.d.ts +10 -10
- package/dist/components/menu-item.js +9 -9
- package/dist/components/menu-item.js.map +1 -1
- package/dist/components/mini-calendar-labels.d.ts +4 -0
- package/dist/components/mini-calendar-labels.js +14 -0
- package/dist/components/mini-calendar-labels.js.map +1 -0
- package/dist/components/mini-calendar.d.ts +10 -14
- package/dist/components/mini-calendar.js +22 -29
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.d.ts +26 -18
- package/dist/components/modal.js +8 -11
- package/dist/components/modal.js.map +1 -1
- package/dist/components/money-draft.d.ts +34 -0
- package/dist/components/money-draft.js +39 -0
- package/dist/components/money-draft.js.map +1 -0
- package/dist/components/money-field.d.ts +13 -110
- package/dist/components/money-field.js +6 -22
- package/dist/components/money-field.js.map +1 -1
- package/dist/components/month-picker-labels.d.ts +5 -0
- package/dist/components/month-picker-labels.js +18 -0
- package/dist/components/month-picker-labels.js.map +1 -0
- package/dist/components/month-picker.d.ts +15 -13
- package/dist/components/month-picker.js +34 -32
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.d.ts +9 -11
- package/dist/components/multi-entity-combobox.js +14 -13
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/multi-select.d.ts +81 -21
- package/dist/components/multi-select.js +171 -197
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/nav-pills.d.ts +9 -10
- package/dist/components/nav-pills.js +53 -42
- package/dist/components/nav-pills.js.map +1 -1
- package/dist/components/number-field.d.ts +13 -110
- package/dist/components/number-field.js +2 -3
- package/dist/components/number-field.js.map +1 -1
- package/dist/components/number-input.d.ts +55 -109
- package/dist/components/number-input.js +50 -67
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numeric-field.d.ts +85 -0
- package/dist/components/numeric-field.js +71 -0
- package/dist/components/numeric-field.js.map +1 -0
- package/dist/components/numpad-sheet.d.ts +5 -107
- package/dist/components/numpad-sheet.js +7 -7
- package/dist/components/numpad-sheet.js.map +1 -1
- package/dist/components/one-time-code-input.d.ts +6 -7
- package/dist/components/one-time-code-input.js +119 -124
- package/dist/components/one-time-code-input.js.map +1 -1
- package/dist/components/page-contents-labels.d.ts +2 -0
- package/dist/components/page-contents-labels.js +8 -0
- package/dist/components/page-contents-labels.js.map +1 -0
- package/dist/components/page-contents.d.ts +13 -15
- package/dist/components/page-contents.js +7 -9
- package/dist/components/page-contents.js.map +1 -1
- package/dist/components/page-header.d.ts +10 -10
- package/dist/components/page-header.js +3 -3
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/password-strength-labels.d.ts +2 -0
- package/dist/components/password-strength-labels.js +21 -0
- package/dist/components/password-strength-labels.js.map +1 -0
- package/dist/components/password-strength.d.ts +15 -17
- package/dist/components/password-strength.js +7 -22
- package/dist/components/password-strength.js.map +1 -1
- package/dist/components/phone-input-labels.d.ts +2 -0
- package/dist/components/phone-input-labels.js +9 -0
- package/dist/components/phone-input-labels.js.map +1 -0
- package/dist/components/phone-input.d.ts +75 -100
- package/dist/components/phone-input.js +20 -23
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/picker-sheet.d.ts +20 -8
- package/dist/components/picker-sheet.js +22 -11
- package/dist/components/picker-sheet.js.map +1 -1
- package/dist/components/pie-chart-labels.d.ts +2 -4
- package/dist/components/pie-chart.d.ts +8 -11
- package/dist/components/pie-chart.js +5 -5
- package/dist/components/pie-chart.js.map +1 -1
- package/dist/components/popover-labels.d.ts +2 -0
- package/dist/components/popover-labels.js +11 -0
- package/dist/components/popover-labels.js.map +1 -0
- package/dist/components/popover.d.ts +13 -11
- package/dist/components/popover.js +21 -23
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress-bar-labels.d.ts +2 -0
- package/dist/components/progress-bar-labels.js +9 -0
- package/dist/components/progress-bar-labels.js.map +1 -0
- package/dist/components/progress-bar.d.ts +16 -15
- package/dist/components/progress-bar.js +22 -20
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/qr-code.d.ts +4 -8
- package/dist/components/qr-code.js.map +1 -1
- package/dist/components/reauth-dialog-labels.d.ts +2 -0
- package/dist/components/reauth-dialog-labels.js +12 -0
- package/dist/components/reauth-dialog-labels.js.map +1 -0
- package/dist/components/reauth-dialog.d.ts +8 -10
- package/dist/components/reauth-dialog.js +3 -8
- package/dist/components/reauth-dialog.js.map +1 -1
- package/dist/components/row-actions-labels.d.ts +2 -0
- package/dist/components/row-actions-labels.js +9 -0
- package/dist/components/row-actions-labels.js.map +1 -0
- package/dist/components/row-actions.d.ts +224 -100
- package/dist/components/row-actions.js +4 -5
- package/dist/components/row-actions.js.map +1 -1
- package/dist/components/scroll-area.d.ts +6 -9
- package/dist/components/scroll-area.js +4 -10
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/search-field.d.ts +12 -27
- package/dist/components/search-field.js +13 -16
- package/dist/components/search-field.js.map +1 -1
- package/dist/components/select.d.ts +69 -0
- package/dist/components/select.js +164 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +3 -7
- package/dist/components/separator.js.map +1 -1
- package/dist/components/series-chart-axes.d.ts +120 -0
- package/dist/components/series-chart-axes.js +164 -0
- package/dist/components/series-chart-axes.js.map +1 -0
- package/dist/components/series-chart-budget.d.ts +8 -9
- package/dist/components/series-chart-labels.d.ts +2 -4
- package/dist/components/series-chart-thin.d.ts +34 -0
- package/dist/components/series-chart-thin.js +103 -0
- package/dist/components/series-chart-thin.js.map +1 -0
- package/dist/components/series-chart-ticks.d.ts +9 -11
- package/dist/components/series-chart.d.ts +64 -213
- package/dist/components/series-chart.js +69 -160
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/server-wake-labels.d.ts +2 -0
- package/dist/components/server-wake-labels.js +9 -0
- package/dist/components/server-wake-labels.js.map +1 -0
- package/dist/components/server-wake.d.ts +32 -23
- package/dist/components/server-wake.js +15 -35
- package/dist/components/server-wake.js.map +1 -1
- package/dist/components/settings-fields.d.ts +46 -117
- package/dist/components/settings-fields.js +13 -3
- package/dist/components/settings-fields.js.map +1 -1
- package/dist/components/share-card-labels.d.ts +2 -0
- package/dist/components/share-card-labels.js +29 -0
- package/dist/components/share-card-labels.js.map +1 -0
- package/dist/components/share-card.d.ts +188 -100
- package/dist/components/share-card.js +16 -34
- package/dist/components/share-card.js.map +1 -1
- package/dist/components/sign-chip-labels.d.ts +2 -0
- package/dist/components/sign-chip-labels.js +11 -0
- package/dist/components/sign-chip-labels.js.map +1 -0
- package/dist/components/sign-chip.d.ts +7 -9
- package/dist/components/sign-chip.js +2 -7
- package/dist/components/sign-chip.js.map +1 -1
- package/dist/components/signature-pad-labels.d.ts +2 -0
- package/dist/components/signature-pad-labels.js +23 -0
- package/dist/components/signature-pad-labels.js.map +1 -0
- package/dist/components/signature-pad.d.ts +16 -15
- package/dist/components/signature-pad.js +22 -35
- package/dist/components/signature-pad.js.map +1 -1
- package/dist/components/signed-amount-labels.d.ts +2 -0
- package/dist/components/signed-amount-labels.js +9 -0
- package/dist/components/signed-amount-labels.js.map +1 -0
- package/dist/components/signed-amount.d.ts +19 -21
- package/dist/components/signed-amount.js +12 -15
- package/dist/components/signed-amount.js.map +1 -1
- package/dist/components/skeleton.d.ts +13 -9
- package/dist/components/skeleton.js +1 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/slider.d.ts +16 -11
- package/dist/components/slider.js +23 -18
- package/dist/components/slider.js.map +1 -1
- package/dist/components/sparkline-labels.d.ts +2 -0
- package/dist/components/sparkline-labels.js +13 -0
- package/dist/components/sparkline-labels.js.map +1 -0
- package/dist/components/sparkline.d.ts +10 -12
- package/dist/components/sparkline.js +10 -17
- package/dist/components/sparkline.js.map +1 -1
- package/dist/components/spinner.d.ts +45 -0
- package/dist/components/spinner.js +39 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/stat-tile-labels.d.ts +2 -0
- package/dist/components/stat-tile-labels.js +14 -0
- package/dist/components/stat-tile-labels.js.map +1 -0
- package/dist/components/stat-tile.d.ts +15 -17
- package/dist/components/stat-tile.js +25 -32
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/status-dot.d.ts +8 -20
- package/dist/components/status-dot.js +13 -12
- package/dist/components/status-dot.js.map +1 -1
- package/dist/components/swatch-picker-labels.d.ts +2 -0
- package/dist/components/swatch-picker-labels.js +9 -0
- package/dist/components/swatch-picker-labels.js.map +1 -0
- package/dist/components/swatch-picker.d.ts +14 -14
- package/dist/components/swatch-picker.js +14 -8
- package/dist/components/swatch-picker.js.map +1 -1
- package/dist/components/swipeable-row.d.ts +14 -27
- package/dist/components/swipeable-row.js +2 -2
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/switch.d.ts +10 -13
- package/dist/components/switch.js +13 -12
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.d.ts +28 -31
- package/dist/components/table.js +15 -15
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.d.ts +182 -0
- package/dist/components/tabs.js +312 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/text-link.d.ts +17 -118
- package/dist/components/text-link.js +7 -7
- package/dist/components/text-link.js.map +1 -1
- package/dist/components/text.d.ts +14 -13
- package/dist/components/text.js +5 -5
- package/dist/components/text.js.map +1 -1
- package/dist/components/textarea.d.ts +20 -0
- package/dist/components/textarea.js +161 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/tile-radio.d.ts +6 -10
- package/dist/components/tile-radio.js +6 -6
- package/dist/components/tile-radio.js.map +1 -1
- package/dist/components/time-input.d.ts +5 -107
- package/dist/components/time-input.js +14 -5
- package/dist/components/time-input.js.map +1 -1
- package/dist/components/toast-labels.d.ts +2 -0
- package/dist/components/toast-labels.js +11 -0
- package/dist/components/toast-labels.js.map +1 -0
- package/dist/components/toast.d.ts +21 -23
- package/dist/components/toast.js +1 -6
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.d.ts +26 -26
- package/dist/components/toggle-group.js +43 -19
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle-legend.d.ts +18 -21
- package/dist/components/toggle-legend.js +3 -3
- package/dist/components/toggle-legend.js.map +1 -1
- package/dist/components/tooltip.d.ts +16 -15
- package/dist/components/tooltip.js +4 -9
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/translation-review-editor.d.ts +8 -10
- package/dist/components/translation-review-editor.js +6 -5
- package/dist/components/translation-review-editor.js.map +1 -1
- package/dist/components/translation-review-labels.d.ts +4 -7
- package/dist/components/translation-review-parts.d.ts +19 -28
- package/dist/components/translation-review-parts.js +4 -7
- package/dist/components/translation-review-parts.js.map +1 -1
- package/dist/components/translation-review.d.ts +26 -24
- package/dist/components/translation-review.js +13 -10
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/tree-view.d.ts +7 -11
- package/dist/components/tree-view.js +8 -8
- package/dist/components/tree-view.js.map +1 -1
- package/dist/components/treemap.d.ts +9 -13
- package/dist/components/trigger-aria.d.ts +2 -4
- package/dist/components/ui-labels.d.ts +5 -0
- package/dist/components/ui-labels.js +20 -0
- package/dist/components/ui-labels.js.map +1 -0
- package/dist/components/use-anchor-dir.d.ts +3 -6
- package/dist/components/use-mobile-reveal.d.ts +2 -6
- package/dist/components/use-table-state.d.ts +154 -15
- package/dist/components/user-avatar.d.ts +8 -21
- package/dist/components/user-avatar.js +1 -1
- package/dist/components/user-avatar.js.map +1 -1
- package/dist/components/wizard-stepper.d.ts +6 -6
- package/dist/components/wizard-stepper.js +4 -3
- package/dist/components/wizard-stepper.js.map +1 -1
- package/dist/components/write-lock-labels.d.ts +2 -0
- package/dist/components/write-lock-labels.js +8 -0
- package/dist/components/write-lock-labels.js.map +1 -0
- package/dist/components/write-lock.d.ts +16 -18
- package/dist/components/write-lock.js +4 -8
- package/dist/components/write-lock.js.map +1 -1
- package/dist/data-table.d.ts +10 -18
- package/dist/data-table.js.map +1 -1
- package/dist/demo/demo-banner.d.ts +10 -13
- package/dist/demo/demo-banner.js +5 -19
- package/dist/demo/demo-banner.js.map +1 -1
- package/dist/demo/demo-countdown.d.ts +7 -9
- package/dist/demo/demo-ended.d.ts +10 -13
- package/dist/demo/demo-ended.js +4 -4
- package/dist/demo/demo-ended.js.map +1 -1
- package/dist/demo/demo-labels.d.ts +4 -5
- package/dist/demo/demo-labels.js.map +1 -1
- package/dist/demo/demo-session.d.ts +3 -5
- package/dist/demo/demo-start.d.ts +8 -11
- package/dist/demo/demo-start.js +3 -2
- package/dist/demo/demo-start.js.map +1 -1
- package/dist/feedback/feedback-attachment-labels.d.ts +16 -0
- package/dist/feedback/feedback-attachment-labels.js +17 -0
- package/dist/feedback/feedback-attachment-labels.js.map +1 -0
- package/dist/feedback/feedback-attachment.d.ts +312 -100
- package/dist/feedback/feedback-attachment.js +31 -42
- package/dist/feedback/feedback-attachment.js.map +1 -1
- package/dist/feedback/feedback-capture.d.ts +2 -4
- package/dist/feedback/feedback-context-labels.d.ts +2 -0
- package/dist/feedback/feedback-context-labels.js +9 -0
- package/dist/feedback/feedback-context-labels.js.map +1 -0
- package/dist/feedback/feedback-context.d.ts +110 -100
- package/dist/feedback/feedback-context.js +4 -7
- package/dist/feedback/feedback-context.js.map +1 -1
- package/dist/feedback/feedback-crash.d.ts +8 -109
- package/dist/feedback/feedback-dialog-labels.d.ts +12 -0
- package/dist/feedback/feedback-dialog-labels.js +17 -0
- package/dist/feedback/feedback-dialog-labels.js.map +1 -0
- package/dist/feedback/feedback-dialog.d.ts +186 -100
- package/dist/feedback/feedback-dialog.js +8 -18
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.d.ts +236 -100
- package/dist/feedback/feedback-inbox.js +31 -141
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback/feedback-labels.d.ts +83 -100
- package/dist/feedback/feedback-labels.js.map +1 -1
- package/dist/feedback/feedback-menu-labels.d.ts +2 -0
- package/dist/feedback/feedback-menu-labels.js +10 -0
- package/dist/feedback/feedback-menu-labels.js.map +1 -0
- package/dist/feedback/feedback-menu.d.ts +83 -100
- package/dist/feedback/feedback-menu.js +3 -7
- package/dist/feedback/feedback-menu.js.map +1 -1
- package/dist/feedback/feedback-record.d.ts +239 -100
- package/dist/feedback/feedback-record.js +7 -2
- package/dist/feedback/feedback-record.js.map +1 -1
- package/dist/feedback/feedback-row-detail-labels.d.ts +2 -0
- package/dist/feedback/feedback-row-detail-labels.js +31 -0
- package/dist/feedback/feedback-row-detail-labels.js.map +1 -0
- package/dist/feedback/feedback-row-detail.d.ts +315 -100
- package/dist/feedback/feedback-row-detail.js +11 -37
- package/dist/feedback/feedback-row-detail.js.map +1 -1
- package/dist/feedback/feedback-status-undo.d.ts +66 -100
- package/dist/feedback/feedback-status-undo.js.map +1 -1
- package/dist/feedback/feedback-submit-dialog.d.ts +39 -0
- package/dist/feedback/feedback-submit-dialog.js +66 -0
- package/dist/feedback/feedback-submit-dialog.js.map +1 -0
- package/dist/feedback/feedback-submit.d.ts +13 -108
- package/dist/feedback/feedback-submit.js +19 -40
- package/dist/feedback/feedback-submit.js.map +1 -1
- package/dist/feedback/feedback-swipe.d.ts +9 -109
- package/dist/feedback/feedback-swipe.js +1 -1
- package/dist/feedback/feedback-swipe.js.map +1 -1
- package/dist/feedback/feedback-table-labels.d.ts +2 -0
- package/dist/feedback/feedback-table-labels.js +26 -0
- package/dist/feedback/feedback-table-labels.js.map +1 -0
- package/dist/feedback/feedback-table.d.ts +314 -100
- package/dist/feedback/feedback-table.js +11 -31
- package/dist/feedback/feedback-table.js.map +1 -1
- package/dist/feedback/feedback-thread-labels.d.ts +3 -0
- package/dist/feedback/feedback-thread-labels.js +21 -0
- package/dist/feedback/feedback-thread-labels.js.map +1 -0
- package/dist/feedback/feedback-thread.d.ts +378 -100
- package/dist/feedback/feedback-thread.js +32 -35
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/feedback/feedback-vocabulary.d.ts +98 -0
- package/dist/feedback/feedback-vocabulary.js +143 -0
- package/dist/feedback/feedback-vocabulary.js.map +1 -0
- package/dist/feedback.d.ts +15 -104
- package/dist/hooks/use-anchored-panel.d.ts +109 -17
- package/dist/hooks/use-anchored-panel.js +38 -6
- package/dist/hooks/use-anchored-panel.js.map +1 -1
- package/dist/hooks/use-anchored-rect.d.ts +15 -6
- package/dist/hooks/use-anchored-rect.js +2 -1
- package/dist/hooks/use-anchored-rect.js.map +1 -1
- package/dist/hooks/use-announce.d.ts +4 -6
- package/dist/hooks/use-authed-src.d.ts +5 -7
- package/dist/hooks/use-authed-src.js +3 -7
- package/dist/hooks/use-authed-src.js.map +1 -1
- package/dist/hooks/use-body-scroll-lock.d.ts +1 -3
- package/dist/hooks/use-breakpoint.d.ts +16 -17
- package/dist/hooks/use-breakpoint.js.map +1 -1
- package/dist/hooks/use-close-transition.d.ts +8 -8
- package/dist/hooks/use-close-transition.js +5 -4
- package/dist/hooks/use-close-transition.js.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +5 -7
- package/dist/hooks/use-debounce.d.ts +13 -6
- package/dist/hooks/use-debounce.js.map +1 -1
- package/dist/hooks/use-dismiss.d.ts +37 -11
- package/dist/hooks/use-dismiss.js +69 -10
- package/dist/hooks/use-dismiss.js.map +1 -1
- package/dist/hooks/use-file-drop.d.ts +8 -109
- package/dist/hooks/use-file-drop.js +1 -1
- package/dist/hooks/use-file-drop.js.map +1 -1
- package/dist/hooks/use-file-picker-labels.d.ts +2 -0
- package/dist/hooks/use-file-picker-labels.js +25 -0
- package/dist/hooks/use-file-picker-labels.js.map +1 -0
- package/dist/hooks/use-file-picker.d.ts +164 -0
- package/dist/hooks/use-file-picker.js +149 -0
- package/dist/hooks/use-file-picker.js.map +1 -0
- package/dist/hooks/use-focus-trap.d.ts +10 -4
- package/dist/hooks/use-focus-trap.js +19 -12
- package/dist/hooks/use-focus-trap.js.map +1 -1
- package/dist/hooks/use-hotkey.d.ts +7 -9
- package/dist/hooks/use-large-text.d.ts +3 -5
- package/dist/hooks/use-media-query.d.ts +1 -3
- package/dist/hooks/use-noindex.d.ts +1 -3
- package/dist/hooks/use-overlay-history.d.ts +1 -3
- package/dist/hooks/use-row-swipe.d.ts +5 -8
- package/dist/hooks/use-search-param-state.d.ts +10 -11
- package/dist/hooks/use-windowed-rows.d.ts +4 -7
- package/dist/i18n/defaults.d.ts +11 -104
- package/dist/i18n/defaults.js +82 -82
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.d.ts +2 -104
- package/dist/i18n/german.js +56 -9
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +609 -100
- package/dist/i18n/kit-labels.js +22 -97
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/languages.d.ts +197 -100
- package/dist/i18n/locales/de-CH.d.ts +3 -105
- package/dist/i18n/locales/en.d.ts +4 -104
- package/dist/i18n/locales/en.js +1834 -4
- package/dist/i18n/locales/en.js.map +7 -1
- package/dist/i18n/locales/es.d.ts +3 -105
- package/dist/i18n/locales/es.js +54 -9
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +3 -105
- package/dist/i18n/locales/fr.js +56 -9
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +3 -105
- package/dist/i18n/locales/hu.js +56 -10
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +3 -105
- package/dist/i18n/locales/it.js +55 -9
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +3 -105
- package/dist/i18n/locales/zh.js +52 -8
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/plurals.d.ts +20 -3
- package/dist/i18n/plurals.js +11 -0
- package/dist/i18n/plurals.js.map +1 -1
- package/dist/i18n/review.d.ts +5 -106
- package/dist/i18n/review.js +4 -0
- package/dist/i18n/review.js.map +1 -1
- package/dist/i18n/shared-labels.d.ts +17 -0
- package/dist/i18n/shared-labels.js +111 -0
- package/dist/i18n/shared-labels.js.map +1 -0
- package/dist/i18n/swiss.d.ts +1 -3
- package/dist/index.d.ts +329 -249
- package/dist/index.js +188 -215
- package/dist/index.js.map +1 -1
- package/dist/landing/access.d.ts +7 -9
- package/dist/landing/access.js.map +1 -1
- package/dist/landing/landing-actions.d.ts +9 -108
- package/dist/landing/landing-actions.js +1 -1
- package/dist/landing/landing-actions.js.map +1 -1
- package/dist/landing/landing-labels.d.ts +4 -5
- package/dist/landing/landing-labels.js.map +1 -1
- package/dist/landing/landing-sections.d.ts +21 -120
- package/dist/landing/landing-sections.js +15 -15
- package/dist/landing/landing-sections.js.map +1 -1
- package/dist/landing/page-seo.d.ts +7 -9
- package/dist/landing/public-header.d.ts +10 -110
- package/dist/landing/public-header.js +1 -1
- package/dist/landing/public-header.js.map +1 -1
- package/dist/landing/routing.d.ts +16 -119
- package/dist/landing/routing.js +2 -6
- package/dist/landing/routing.js.map +1 -1
- package/dist/lib/calc.d.ts +7 -9
- package/dist/lib/chip-edge-snap.d.ts +10 -0
- package/dist/lib/chip-edge-snap.js +131 -0
- package/dist/lib/chip-edge-snap.js.map +1 -0
- package/dist/lib/clipping.d.ts +2 -4
- package/dist/lib/cn.d.ts +2 -5
- package/dist/lib/cn.js +6 -1
- package/dist/lib/cn.js.map +1 -1
- package/dist/lib/column-mapping.d.ts +10 -13
- package/dist/lib/countries.d.ts +3 -5
- package/dist/lib/dates.d.ts +25 -25
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/decimal-marks.d.ts +8 -8
- package/dist/lib/decimal-marks.js +1 -1
- package/dist/lib/decimal-marks.js.map +1 -1
- package/dist/lib/direction.d.ts +4 -6
- package/dist/lib/document-navigation.d.ts +1 -3
- package/dist/lib/download.d.ts +67 -0
- package/dist/lib/download.js +89 -0
- package/dist/lib/download.js.map +1 -0
- package/dist/lib/floating-stack.d.ts +8 -6
- package/dist/lib/floating-stack.js.map +1 -1
- package/dist/lib/format.d.ts +24 -23
- package/dist/lib/format.js +3 -3
- package/dist/lib/format.js.map +1 -1
- package/dist/lib/iban.d.ts +9 -11
- package/dist/lib/ime.d.ts +17 -0
- package/dist/lib/ime.js +13 -0
- package/dist/lib/ime.js.map +1 -0
- package/dist/lib/isin.d.ts +3 -5
- package/dist/lib/logger.d.ts +4 -6
- package/dist/lib/person-name.d.ts +3 -5
- package/dist/lib/phone.d.ts +9 -11
- package/dist/lib/presence.d.ts +15 -0
- package/dist/lib/presence.js +8 -0
- package/dist/lib/presence.js.map +1 -0
- package/dist/lib/qr-encode.d.ts +4 -6
- package/dist/lib/reduced-motion.d.ts +18 -0
- package/dist/lib/reduced-motion.js +9 -0
- package/dist/lib/reduced-motion.js.map +1 -0
- package/dist/lib/round.d.ts +22 -0
- package/dist/lib/round.js +15 -0
- package/dist/lib/round.js.map +1 -0
- package/dist/lib/safe-storage.d.ts +14 -4
- package/dist/lib/safe-storage.js +24 -9
- package/dist/lib/safe-storage.js.map +1 -1
- package/dist/lib/server-wake.d.ts +13 -14
- package/dist/lib/session-refresh.d.ts +200 -0
- package/dist/lib/session-refresh.js +187 -0
- package/dist/lib/session-refresh.js.map +1 -0
- package/dist/lib/strip-fade.d.ts +10 -13
- package/dist/lib/table-text.d.ts +14 -16
- package/dist/lib/text-match.d.ts +41 -0
- package/dist/lib/text-match.js +23 -0
- package/dist/lib/text-match.js.map +1 -0
- package/dist/lib/translation-review.d.ts +44 -45
- package/dist/lib/translation-review.js +3 -2
- package/dist/lib/translation-review.js.map +1 -1
- package/dist/rhf/fields.d.ts +123 -188
- package/dist/rhf/fields.js +46 -54
- package/dist/rhf/fields.js.map +1 -1
- package/dist/rhf/form-core.d.ts +153 -0
- package/dist/rhf/form-core.js +143 -0
- package/dist/rhf/form-core.js.map +1 -0
- package/dist/rhf/form.d.ts +38 -174
- package/dist/rhf/form.js +9 -131
- package/dist/rhf/form.js.map +1 -1
- package/dist/rhf/line-items.d.ts +40 -11
- package/dist/rhf/line-items.js.map +1 -1
- package/dist/rhf/use-rhf-wizard-step.d.ts +3 -6
- package/dist/rhf.d.ts +4 -117
- package/dist/rhf.js.map +1 -1
- package/dist/search/command-palette-labels.d.ts +2 -0
- package/dist/search/command-palette-labels.js +15 -0
- package/dist/search/command-palette-labels.js.map +1 -0
- package/dist/search/command-palette.d.ts +10 -13
- package/dist/search/command-palette.js +25 -44
- package/dist/search/command-palette.js.map +1 -1
- package/dist/search/global-search-labels.d.ts +2 -0
- package/dist/search/global-search-labels.js +12 -0
- package/dist/search/global-search-labels.js.map +1 -0
- package/dist/search/global-search.d.ts +17 -16
- package/dist/search/global-search.js +12 -12
- package/dist/search/global-search.js.map +1 -1
- package/dist/search/search-index.d.ts +13 -14
- package/dist/search/search-index.js +2 -1
- package/dist/search/search-index.js.map +1 -1
- package/dist/search/use-command-key.d.ts +9 -0
- package/dist/search/use-command-key.js +18 -0
- package/dist/search/use-command-key.js.map +1 -0
- package/dist/search.d.ts +3 -4
- package/dist/settings/settings-card-classes.d.ts +11 -0
- package/dist/settings/settings-card-classes.js +8 -0
- package/dist/settings/settings-card-classes.js.map +1 -0
- package/dist/settings/settings-catalogue.d.ts +11 -14
- package/dist/settings/settings-context.d.ts +4 -8
- package/dist/settings/settings-heading.d.ts +8 -12
- package/dist/settings/settings-heading.js +1 -1
- package/dist/settings/settings-heading.js.map +1 -1
- package/dist/settings/settings-labels.d.ts +6 -7
- package/dist/settings/settings-labels.js.map +1 -1
- package/dist/settings/settings-layout.d.ts +36 -13
- package/dist/settings/settings-layout.js +25 -4
- package/dist/settings/settings-layout.js.map +1 -1
- package/dist/settings/settings-section.d.ts +4 -106
- package/dist/settings/settings-section.js +2 -2
- package/dist/settings/settings-section.js.map +1 -1
- package/dist/settings/use-account-appearance.d.ts +11 -16
- package/dist/settings/use-account-language.d.ts +8 -10
- package/dist/settings/use-settings-focus.d.ts +3 -5
- package/dist/settings/use-settings-focus.js +2 -4
- package/dist/settings/use-settings-focus.js.map +1 -1
- package/dist/settings/use-settings-route.d.ts +11 -16
- package/dist/shell/app-shell-labels.d.ts +2 -0
- package/dist/shell/app-shell-labels.js +9 -0
- package/dist/shell/app-shell-labels.js.map +1 -0
- package/dist/shell/app-shell.d.ts +216 -100
- package/dist/shell/app-shell.js +51 -35
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/auth-layout.d.ts +6 -9
- package/dist/shell/auth-layout.js +6 -6
- package/dist/shell/auth-layout.js.map +1 -1
- package/dist/shell/company-switcher-labels.d.ts +2 -0
- package/dist/shell/company-switcher-labels.js +12 -0
- package/dist/shell/company-switcher-labels.js.map +1 -0
- package/dist/shell/company-switcher.d.ts +9 -11
- package/dist/shell/company-switcher.js +3 -9
- package/dist/shell/company-switcher.js.map +1 -1
- package/dist/shell/option-switcher-menu.d.ts +19 -9
- package/dist/shell/option-switcher-menu.js +6 -4
- package/dist/shell/option-switcher-menu.js.map +1 -1
- package/dist/shell/role-switcher.d.ts +5 -6
- package/dist/shell/role-switcher.js +4 -3
- package/dist/shell/role-switcher.js.map +1 -1
- package/dist/shell/top-bar-brand.d.ts +4 -106
- package/dist/shell/top-bar-brand.js +1 -1
- package/dist/shell/top-bar-brand.js.map +1 -1
- package/dist/shell/top-bar.d.ts +6 -9
- package/dist/shell/top-bar.js +1 -1
- package/dist/shell/top-bar.js.map +1 -1
- package/dist/shell/topbar-action-menu.d.ts +30 -31
- package/dist/shell/topbar-action-menu.js +12 -10
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell/topbar-controls.d.ts +20 -18
- package/dist/shell/topbar-controls.js +14 -11
- package/dist/shell/topbar-controls.js.map +1 -1
- package/dist/shell.d.ts +25 -115
- package/dist/shell.js.map +1 -1
- package/dist/table-text.d.ts +1 -1
- package/dist/testing/css-variables.d.ts +4 -6
- package/dist/testing/css-variables.generated.d.ts +2 -4
- package/dist/testing/index.d.ts +2 -1
- package/dist/testing/index.js +9 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/viewport.d.ts +93 -0
- package/dist/testing/viewport.js +152 -0
- package/dist/testing/viewport.js.map +1 -0
- package/dist/theme/chart-palette.d.ts +7 -9
- package/dist/theme/color.d.ts +14 -16
- package/dist/theme/color.js +2 -1
- package/dist/theme/color.js.map +1 -1
- package/dist/theme/contrast-tokens.d.ts +13 -17
- package/dist/theme/contrast.d.ts +22 -27
- package/dist/theme/palette-derive.d.ts +16 -22
- package/dist/theme/palette-derive.js +15 -7
- package/dist/theme/palette-derive.js.map +1 -1
- package/dist/theme/palette-presets.d.ts +25 -15
- package/dist/theme/palette-presets.js +66 -66
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/theme/palette-store.d.ts +10 -13
- package/dist/theme/text-size.d.ts +21 -26
- package/dist/theme/theme-store.d.ts +9 -14
- package/dist/tour/tour-labels.d.ts +2 -0
- package/dist/tour/tour-labels.js +13 -0
- package/dist/tour/tour-labels.js.map +1 -0
- package/dist/tour/tour.d.ts +12 -14
- package/dist/tour/tour.js +9 -20
- package/dist/tour/tour.js.map +1 -1
- package/dist/tour.d.ts +1 -2
- package/dist/wizard/stepper-nav.d.ts +8 -107
- package/dist/wizard/stepper-nav.js +15 -14
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard/types.d.ts +18 -18
- package/dist/wizard/types.js +1 -19
- package/dist/wizard/types.js.map +1 -1
- package/dist/wizard/use-wizard.d.ts +2 -6
- package/dist/wizard/validation.d.ts +3 -7
- package/dist/wizard/wizard-context.d.ts +7 -11
- package/dist/wizard/wizard-labels.d.ts +4 -0
- package/dist/wizard/wizard-labels.js +24 -0
- package/dist/wizard/wizard-labels.js.map +1 -0
- package/dist/wizard/wizard-step.d.ts +3 -7
- package/dist/wizard/wizard-step.js +2 -2
- package/dist/wizard/wizard-step.js.map +1 -1
- package/dist/wizard/wizard-summary.d.ts +5 -8
- package/dist/wizard/wizard-summary.js +6 -5
- package/dist/wizard/wizard-summary.js.map +1 -1
- package/dist/wizard.d.ts +7 -106
- package/package.json +9 -6
- package/src/account/account-parts.ts +3 -3
- package/src/{components → account}/account-settings-labels.ts +11 -1
- package/src/{components → account}/account-settings.tsx +145 -34
- package/src/account/data-export-setting-labels.ts +20 -0
- package/src/account/data-export-setting.tsx +19 -38
- package/src/account/delete-account-setting-labels.ts +33 -0
- package/src/account/delete-account-setting.tsx +13 -35
- package/src/account/email-change-setting-labels.ts +32 -0
- package/src/account/email-change-setting.tsx +17 -36
- package/src/{components → account}/passkeys-setting.tsx +14 -9
- package/src/account/sessions-setting-labels.ts +24 -0
- package/src/account/sessions-setting.tsx +14 -28
- package/src/admin/admin-action-confirm-labels.ts +19 -0
- package/src/admin/admin-action-confirm.tsx +59 -38
- package/src/admin/admin-action-log-labels.ts +74 -0
- package/src/admin/admin-action-log.tsx +180 -54
- package/src/admin/admin-parts.ts +0 -7
- package/src/admin/invitations-panel-labels.ts +31 -0
- package/src/admin/invitations-panel.tsx +16 -34
- package/src/admin/plan-change-labels.ts +23 -0
- package/src/admin/plan-change.tsx +89 -37
- package/src/admin/reviewer-scope-editor-labels.ts +16 -0
- package/src/admin/reviewer-scope-editor.tsx +9 -15
- package/src/admin/role-select-labels.ts +16 -0
- package/src/admin/role-select.tsx +13 -23
- package/src/admin/transfer-ownership-dialog-labels.ts +20 -0
- package/src/admin/transfer-ownership-dialog.tsx +7 -17
- package/src/admin/user-roster-labels.ts +17 -0
- package/src/admin/user-roster.tsx +9 -17
- package/src/auth/accept-invitation-labels.ts +21 -0
- package/src/auth/accept-invitation.tsx +9 -20
- package/src/auth/auth-errors.ts +29 -13
- package/src/auth/complete-name-dialog-labels.ts +16 -0
- package/src/auth/complete-name-dialog.tsx +8 -13
- package/src/auth/forgot-password-form-labels.ts +20 -0
- package/src/auth/forgot-password-form.tsx +12 -20
- package/src/auth/new-password-fields.tsx +1 -1
- package/src/auth/not-found-page-labels.ts +12 -0
- package/src/auth/not-found-page.tsx +11 -14
- package/src/auth/register-form-labels.ts +31 -0
- package/src/auth/register-form.tsx +18 -38
- package/src/auth/reset-password-form-labels.ts +27 -0
- package/src/auth/reset-password-form.tsx +12 -27
- package/src/auth/sign-in-form-labels.ts +44 -0
- package/src/auth/sign-in-form.tsx +18 -51
- package/src/auth/status-parts.tsx +3 -3
- package/src/auth/verify-email-labels.ts +26 -0
- package/src/auth/verify-email.tsx +15 -30
- package/src/billing/billing-banner.tsx +2 -1
- package/src/billing/billing-labels.ts +1 -1
- package/src/billing/checkout-processing.ts +2 -12
- package/src/billing/pay-page.ts +9 -5
- package/src/billing/plan-card.tsx +26 -27
- package/src/billing/plan-limit-notice.tsx +1 -1
- package/src/billing/subscription-actions.tsx +4 -4
- package/src/chart.ts +7 -1
- package/src/components/account-chips-labels.ts +16 -0
- package/src/components/account-chips.tsx +13 -16
- package/src/components/alert-banner.tsx +39 -19
- package/src/components/amount-input.tsx +461 -405
- package/src/components/appearance-labels.ts +2 -2
- package/src/components/authed-image-labels.ts +11 -0
- package/src/components/authed-image.tsx +6 -8
- package/src/components/autocomplete.tsx +84 -80
- package/src/components/breadcrumbs-labels.ts +10 -0
- package/src/components/breadcrumbs.tsx +17 -14
- package/src/components/bulk-action-bar-labels.ts +11 -0
- package/src/components/bulk-action-bar.tsx +15 -16
- package/src/components/button-group.tsx +7 -7
- package/src/components/button-look.ts +230 -0
- package/src/components/button.tsx +339 -0
- package/src/components/calculator.tsx +18 -11
- package/src/components/calendar-heatmap-labels.ts +15 -0
- package/src/components/calendar-heatmap.tsx +13 -19
- package/src/components/card.tsx +381 -0
- package/src/components/chart-zoom-core.tsx +653 -0
- package/src/components/chart-zoom.tsx +64 -648
- package/src/components/chart.tsx +11 -11
- package/src/components/checkbox-group.tsx +13 -10
- package/src/components/checkbox.tsx +43 -42
- package/src/components/chip-input.tsx +377 -0
- package/src/components/chip-labels.ts +13 -0
- package/src/components/chip.tsx +115 -711
- package/src/components/choice-card.tsx +83 -85
- package/src/components/column-mapper-labels.ts +45 -0
- package/src/components/column-mapper.tsx +16 -51
- package/src/components/combobox-core.tsx +351 -196
- package/src/components/combobox-suggestions.tsx +129 -0
- package/src/components/combobox.tsx +69 -893
- package/src/components/confirm-dialog-labels.ts +13 -0
- package/src/components/confirm-dialog.tsx +4 -8
- package/src/components/copy-button-labels.ts +13 -0
- package/src/components/copy-button.tsx +10 -12
- package/src/components/country-select-labels.ts +11 -0
- package/src/components/country-select.tsx +74 -89
- package/src/components/currency-option-list.tsx +216 -0
- package/src/components/currency-select.tsx +85 -196
- package/src/components/danger-confirm-labels.ts +20 -0
- package/src/components/danger-confirm.tsx +69 -77
- package/src/components/data-table-cells.tsx +5 -5
- package/src/components/data-table-column-settings.tsx +137 -0
- package/src/components/data-table-filter-popover.tsx +49 -24
- package/src/components/data-table-filters.ts +48 -11
- package/src/components/data-table-head.tsx +258 -0
- package/src/components/data-table-labels.ts +43 -11
- package/src/components/data-table-mobile.tsx +594 -0
- package/src/components/data-table-pagination.tsx +11 -10
- package/src/components/data-table-resize.ts +187 -0
- package/src/components/data-table-row-actions.tsx +152 -0
- package/src/components/data-table-selection.ts +55 -0
- package/src/components/data-table-shared.tsx +172 -0
- package/src/components/data-table.tsx +178 -1300
- package/src/components/date-field.tsx +627 -0
- package/src/components/date-picker.tsx +58 -1446
- package/src/components/date-range-picker.tsx +490 -0
- package/src/components/description-list-labels.ts +9 -0
- package/src/components/description-list.tsx +31 -15
- package/src/components/dialog-frame-labels.ts +7 -0
- package/src/components/dialog-frame.tsx +8 -6
- package/src/components/disclosure.tsx +14 -14
- package/src/components/dropdown.tsx +114 -42
- package/src/components/empty-state.tsx +137 -0
- package/src/components/entity-combobox.tsx +17 -12
- package/src/components/error-boundary-labels.ts +20 -0
- package/src/components/error-boundary.tsx +10 -20
- package/src/components/facing-pair.ts +1 -1
- package/src/components/field-base.tsx +615 -0
- package/src/components/field-parts.tsx +206 -77
- package/src/components/field-strip.tsx +16 -21
- package/src/components/field-sync-labels.ts +13 -0
- package/src/components/field-sync.tsx +11 -12
- package/src/components/field.tsx +13 -11
- package/src/components/file-button.tsx +64 -412
- package/src/components/file-dropzone.tsx +36 -33
- package/src/components/floating-panel-labels.ts +10 -0
- package/src/components/floating-panel.tsx +32 -21
- package/src/components/focus-ring.ts +9 -4
- package/src/components/form-actions-labels.ts +11 -0
- package/src/components/form-actions.tsx +17 -21
- package/src/components/full-bleed-dialog.tsx +33 -25
- package/src/components/grouped-picker.tsx +118 -96
- package/src/components/help-popover.tsx +115 -0
- package/src/components/hover-menu.tsx +46 -35
- package/src/components/iban-input-labels.ts +15 -0
- package/src/components/iban-input.tsx +25 -20
- package/src/components/icon-button.tsx +945 -0
- package/src/components/icon-picker-labels.ts +13 -0
- package/src/components/icon-picker.tsx +27 -24
- package/src/components/image-grid-labels.ts +11 -0
- package/src/components/image-grid.tsx +13 -15
- package/src/components/inline-edit-field-labels.ts +11 -0
- package/src/components/inline-edit-field.tsx +20 -19
- package/src/components/inline-entity-combobox.tsx +789 -0
- package/src/components/input.tsx +380 -0
- package/src/components/jump-calendar.tsx +385 -0
- package/src/components/language-select.tsx +31 -16
- package/src/components/legal-labels.ts +99 -0
- package/src/components/legal-page.tsx +2 -2
- package/src/components/legal.tsx +11 -101
- package/src/components/lightbox-labels.ts +18 -0
- package/src/components/lightbox.tsx +13 -21
- package/src/components/line-items-labels.ts +14 -0
- package/src/components/line-items.tsx +24 -31
- package/src/components/list-labels.ts +10 -0
- package/src/components/list.tsx +98 -75
- package/src/components/loading-state.tsx +4 -4
- package/src/components/measured-grid-labels.ts +25 -0
- package/src/components/measured-grid.tsx +39 -62
- package/src/components/menu-item.tsx +29 -26
- package/src/components/mini-calendar-labels.ts +17 -0
- package/src/components/mini-calendar.tsx +38 -45
- package/src/components/modal.tsx +36 -18
- package/src/components/money-draft.ts +72 -0
- package/src/components/money-field.tsx +16 -30
- package/src/components/month-picker-labels.ts +22 -0
- package/src/components/month-picker.tsx +59 -45
- package/src/components/multi-entity-combobox.tsx +17 -12
- package/src/components/multi-select.tsx +313 -288
- package/src/components/nav-pills.tsx +19 -8
- package/src/components/number-field.tsx +14 -5
- package/src/components/number-input.tsx +125 -90
- package/src/components/numeric-field.ts +161 -0
- package/src/components/numpad-sheet.tsx +16 -16
- package/src/components/one-time-code-input.tsx +154 -169
- package/src/components/page-contents-labels.ts +9 -0
- package/src/components/page-contents.tsx +15 -15
- package/src/components/page-header.tsx +9 -5
- package/src/components/password-strength-labels.ts +23 -0
- package/src/components/password-strength.tsx +13 -27
- package/src/components/phone-input-labels.ts +10 -0
- package/src/components/phone-input.tsx +42 -57
- package/src/components/picker-sheet.tsx +47 -18
- package/src/components/pie-chart.tsx +11 -9
- package/src/components/popover-labels.ts +14 -0
- package/src/components/popover.tsx +40 -39
- package/src/components/progress-bar-labels.ts +10 -0
- package/src/components/progress-bar.tsx +32 -23
- package/src/components/qr-code.tsx +2 -2
- package/src/components/reauth-dialog-labels.ts +13 -0
- package/src/components/reauth-dialog.tsx +7 -10
- package/src/components/row-actions-labels.ts +10 -0
- package/src/components/row-actions.tsx +11 -10
- package/src/components/scroll-area.tsx +4 -10
- package/src/components/search-field.tsx +35 -49
- package/src/components/select.tsx +302 -0
- package/src/components/separator.tsx +2 -2
- package/src/components/series-chart-axes.ts +329 -0
- package/src/components/series-chart-thin.ts +180 -0
- package/src/components/series-chart.tsx +124 -325
- package/src/components/server-wake-labels.ts +11 -0
- package/src/components/server-wake.tsx +42 -63
- package/src/components/settings-fields.tsx +46 -17
- package/src/components/share-card-labels.ts +30 -0
- package/src/components/share-card.tsx +22 -37
- package/src/components/sign-chip-labels.ts +12 -0
- package/src/components/sign-chip.tsx +6 -9
- package/src/components/signature-pad-labels.ts +24 -0
- package/src/components/signature-pad.tsx +48 -57
- package/src/components/signed-amount-labels.ts +10 -0
- package/src/components/signed-amount.tsx +21 -22
- package/src/components/skeleton.tsx +11 -3
- package/src/components/slider.tsx +51 -39
- package/src/components/sparkline-labels.ts +14 -0
- package/src/components/sparkline.tsx +16 -21
- package/src/components/spinner.tsx +81 -0
- package/src/components/stat-tile-labels.ts +15 -0
- package/src/components/stat-tile.tsx +32 -37
- package/src/components/status-dot.tsx +17 -14
- package/src/components/swatch-picker-labels.ts +10 -0
- package/src/components/swatch-picker.tsx +23 -16
- package/src/components/swipeable-row.tsx +7 -7
- package/src/components/switch.tsx +33 -32
- package/src/components/table.tsx +15 -15
- package/src/components/tabs.tsx +660 -0
- package/src/components/text-link.tsx +7 -7
- package/src/components/text.tsx +10 -6
- package/src/components/textarea.tsx +323 -0
- package/src/components/tile-radio.tsx +6 -6
- package/src/components/time-input.tsx +15 -7
- package/src/components/toast-labels.ts +12 -0
- package/src/components/toast.tsx +5 -8
- package/src/components/toggle-group.tsx +105 -42
- package/src/components/toggle-legend.tsx +6 -6
- package/src/components/tooltip.tsx +10 -21
- package/src/components/translation-review-editor.tsx +8 -7
- package/src/components/translation-review-parts.tsx +9 -13
- package/src/components/translation-review.tsx +26 -14
- package/src/components/tree-view.tsx +14 -12
- package/src/components/ui-labels.ts +22 -0
- package/src/components/user-avatar.tsx +3 -3
- package/src/components/wizard-stepper.tsx +10 -5
- package/src/components/write-lock-labels.ts +9 -0
- package/src/components/write-lock.tsx +10 -12
- package/src/data-table.ts +4 -0
- package/src/demo/demo-banner.tsx +9 -25
- package/src/demo/demo-ended.tsx +8 -7
- package/src/demo/demo-labels.ts +2 -2
- package/src/demo/demo-start.tsx +7 -5
- package/src/feedback/feedback-attachment-labels.ts +36 -0
- package/src/feedback/feedback-attachment.tsx +42 -66
- package/src/feedback/feedback-context-labels.ts +10 -0
- package/src/feedback/feedback-context.tsx +8 -9
- package/src/feedback/feedback-dialog-labels.ts +28 -0
- package/src/feedback/feedback-dialog.tsx +14 -44
- package/src/feedback/feedback-inbox.tsx +49 -252
- package/src/feedback/feedback-labels.ts +5 -5
- package/src/feedback/feedback-menu-labels.ts +11 -0
- package/src/feedback/feedback-menu.tsx +13 -11
- package/src/feedback/feedback-record.ts +21 -7
- package/src/feedback/feedback-row-detail-labels.ts +33 -0
- package/src/feedback/feedback-row-detail.tsx +30 -43
- package/src/feedback/feedback-status-undo.ts +3 -2
- package/src/feedback/feedback-submit-dialog.tsx +109 -0
- package/src/feedback/feedback-submit.tsx +45 -55
- package/src/feedback/feedback-swipe.tsx +1 -1
- package/src/feedback/feedback-table-labels.ts +27 -0
- package/src/feedback/feedback-table.tsx +24 -40
- package/src/feedback/feedback-thread-labels.ts +22 -0
- package/src/feedback/feedback-thread.tsx +68 -48
- package/src/feedback/feedback-vocabulary.ts +252 -0
- package/src/hooks/use-anchored-panel.ts +155 -9
- package/src/hooks/use-anchored-rect.ts +11 -9
- package/src/hooks/use-authed-src.ts +13 -7
- package/src/hooks/use-breakpoint.ts +5 -4
- package/src/hooks/use-close-transition.ts +9 -10
- package/src/hooks/use-debounce.ts +9 -0
- package/src/hooks/use-dismiss.ts +176 -19
- package/src/hooks/use-file-drop.ts +2 -2
- package/src/hooks/use-file-picker-labels.ts +29 -0
- package/src/hooks/use-file-picker.tsx +363 -0
- package/src/hooks/use-focus-trap.ts +74 -18
- package/src/i18n/defaults.ts +91 -82
- package/src/i18n/german.ts +54 -7
- package/src/i18n/kit-labels.tsx +70 -119
- package/src/i18n/locales/en.ts +46 -0
- package/src/i18n/locales/es.ts +52 -7
- package/src/i18n/locales/fr.ts +55 -8
- package/src/i18n/locales/hu.ts +54 -8
- package/src/i18n/locales/it.ts +53 -7
- package/src/i18n/locales/zh.ts +50 -6
- package/src/i18n/plurals.ts +29 -0
- package/src/i18n/review.ts +4 -0
- package/src/i18n/shared-labels.ts +135 -0
- package/src/index.ts +412 -402
- package/src/landing/access.ts +2 -1
- package/src/landing/landing-actions.tsx +6 -5
- package/src/landing/landing-labels.ts +2 -2
- package/src/landing/landing-sections.tsx +24 -23
- package/src/landing/public-header.tsx +3 -2
- package/src/landing/routing.tsx +2 -7
- package/src/lib/chip-edge-snap.ts +212 -0
- package/src/lib/cn.ts +13 -1
- package/src/lib/dates.ts +4 -2
- package/src/lib/decimal-marks.ts +4 -2
- package/src/lib/download.ts +172 -0
- package/src/lib/floating-stack.ts +5 -1
- package/src/lib/format.ts +5 -3
- package/src/lib/ime.ts +24 -0
- package/src/lib/presence.ts +18 -0
- package/src/lib/reduced-motion.ts +21 -0
- package/src/lib/round.ts +38 -0
- package/src/lib/safe-storage.ts +35 -11
- package/src/lib/session-refresh.ts +473 -0
- package/src/lib/text-match.ts +60 -0
- package/src/lib/translation-review.ts +7 -6
- package/src/rhf/fields.tsx +131 -179
- package/src/rhf/form-core.tsx +327 -0
- package/src/rhf/form.tsx +46 -321
- package/src/rhf/line-items.tsx +1 -1
- package/src/rhf.ts +3 -2
- package/src/search/command-palette-labels.ts +16 -0
- package/src/search/command-palette.tsx +37 -50
- package/src/search/global-search-labels.ts +13 -0
- package/src/search/global-search.tsx +50 -24
- package/src/search/search-index.ts +5 -6
- package/src/search/use-command-key.ts +22 -0
- package/src/settings/settings-card-classes.ts +11 -0
- package/src/settings/settings-heading.tsx +1 -1
- package/src/settings/settings-labels.ts +2 -2
- package/src/settings/settings-layout.tsx +65 -6
- package/src/settings/settings-section.tsx +5 -5
- package/src/settings/use-settings-focus.ts +2 -5
- package/src/shell/app-shell-labels.ts +10 -0
- package/src/shell/app-shell.tsx +79 -53
- package/src/shell/auth-layout.tsx +11 -10
- package/src/shell/company-switcher-labels.ts +13 -0
- package/src/shell/company-switcher.tsx +7 -11
- package/src/shell/option-switcher-menu.tsx +25 -6
- package/src/shell/role-switcher.tsx +7 -3
- package/src/shell/top-bar-brand.tsx +1 -1
- package/src/shell/top-bar.tsx +6 -5
- package/src/shell/topbar-action-menu.tsx +39 -20
- package/src/shell/topbar-controls.tsx +24 -12
- package/src/shell.ts +1 -1
- package/src/testing/index.ts +11 -0
- package/src/testing/viewport.ts +251 -0
- package/src/theme/color.ts +7 -1
- package/src/theme/palette-derive.ts +29 -7
- package/src/theme/palette-presets.ts +81 -68
- package/src/tour/tour-labels.ts +14 -0
- package/src/tour/tour.tsx +13 -23
- package/src/wizard/stepper-nav.tsx +19 -18
- package/src/wizard/types.ts +7 -22
- package/src/wizard/wizard-labels.ts +29 -0
- package/src/wizard/wizard-step.tsx +2 -2
- package/src/wizard/wizard-summary.tsx +8 -7
- package/tokens.css +63 -14
- package/dist/components/account-settings-labels.js.map +0 -1
- package/dist/components/account-settings.js.map +0 -1
- package/dist/components/choice-parts.d.ts +0 -24
- package/dist/components/choice-parts.js +0 -18
- package/dist/components/choice-parts.js.map +0 -1
- package/dist/components/passkeys-setting.js.map +0 -1
- package/dist/components/ui.d.ts +0 -100
- package/dist/components/ui.js +0 -1955
- package/dist/components/ui.js.map +0 -1
- package/dist/data-table-labels-BJ5JE_X2.d.ts +0 -923
- package/dist/delete-account-setting-DiPX4Vue.d.ts +0 -8130
- package/src/components/choice-parts.ts +0 -33
- package/src/components/ui.tsx +0 -4233
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/admin/user-roster.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport type { DateInput } from \"../lib/format\";\nimport type { PersonName } from \"../lib/person-name\";\nimport { useKitLabels, useKitLocale } from \"../i18n/kit-labels\";\nimport { AccountStateChip, RoleChip, dateColumn } from \"../components/account-chips\";\nimport type { AccountState, RoleVocabulary } from \"../components/account-chips\";\nimport type { ChipTone } from \"../components/chip\";\nimport type { DataTableColumn } from \"../components/data-table\";\nimport { encodeSorts } from \"../components/data-table-sort\";\nimport type { SortState } from \"../components/data-table-sort\";\nimport { RowActions } from \"../components/row-actions\";\nimport type { RowAction, RowActionList } from \"../components/row-actions\";\nimport { UserAvatar } from \"../components/user-avatar\";\nimport { personLabel } from \"./admin-parts\";\nimport { RoleSelect } from \"./role-select\";\nimport type { RoleLock } from \"./role-select\";\n\n/**\n * The admin's user list (docs/user-admin-harmonization.md §3): a column preset for the\n * kit's `DataTable`, not a table of its own.\n *\n * keksdose built its roster by hand (1150 lines, its own Badge), Kurvenschmiede on the\n * kit `DataTable` with the 0.18 chips, kastlan as a settings page. What the three share\n * is the row — name over address, a role, the account's states, created, last login, the\n * app's own columns, and a handful of actions — so that is what the kit draws, and the\n * table, its paging, its sort and its filters stay the app's `DataTable` wiring:\n *\n * ```tsx\n * const columns = useUserRosterColumns<AdminUserRow, Role>({ roles: ROLES, actions, extra });\n * <DataTable rows={page.users} columns={columns} rowKey={(r) => r.id}\n * serverPagination={{ page, pageSize, total: page.total, onPageChange }}\n * sorts={sorts} onSortsChange={setSorts} />\n * // GET /admin/users?sort=${userRosterSort(sorts)}&…\n * ```\n *\n * The column keys ARE the server's sort keys (§3.1): `name`, `email`, `role`, `created`,\n * `last_login` — so {@link userRosterSort} turns the table's sort state into the query\n * as it is. Phone cards come from the same columns: the identity is the card's headline,\n * the role, states, last login and the actions are its fields, created is left off.\n */\n\n/* ── Rows and states ────────────────────────────────────────────────────────── */\n\n/**\n * The fields of the contract's `AdminUserRow` the preset reads (§3.2, the auth\n * contract's `UserResponse` core). An app's row has more — its `extra` — and the\n * preset passes the whole row to every callback.\n */\nexport interface UserRosterRow extends AdminUserStateFields {\n id: string | number;\n email: string;\n first_name?: string | null;\n last_name?: string | null;\n /** The derived whole name — only the fallback when both parts are blank. */\n display_name?: string | null;\n /** keksdose, Kurvenschmiede: one role. */\n role?: string | null;\n /** kastlan: the account's roles in the current company. Wins over `role`. */\n roles?: readonly string[] | null;\n created_at?: DateInput;\n /** Account-wide; kastlan's comes from its session rows (§3.2). */\n last_login_at?: DateInput;\n}\n\n/** The state fields of the contract's row that {@link adminUserStates} maps (§3.2). */\nexport interface AdminUserStateFields {\n is_active?: boolean;\n email_verified?: boolean;\n password_change_required_at?: string | null;\n /** `after_days` mode: the day the account is erased (§6.4). */\n deletion_scheduled_at?: string | null;\n /** When the user asked. The only deletion field in kastlan's `operator` mode, where\n * nothing is scheduled. */\n deletion_requested_at?: string | null;\n}\n\n/** One state chip of a row: an {@link AccountState}, or one with its `date` (the\n * `deletion` day), a `tone` or the app's own words. */\nexport type RosterState =\n | AccountState\n | { state: AccountState; date?: DateInput; tone?: ChipTone; label?: ReactNode };\n\n/**\n * The contract's row as state chips (§3.2: \"map 1:1 to the kit's AccountStateChip\"):\n *\n * - marked for deletion → `deletion` with the scheduled day (none in `operator` mode),\n * IN PLACE of `inactive` — such an account is always deactivated (§2.1);\n * - else `active` / `inactive` from `is_active`;\n * - `unverified` when `email_verified` is `false` (not when it is missing);\n * - `passwordChange` while `password_change_required_at` is set.\n */\nexport function adminUserStates(row: AdminUserStateFields): RosterState[] {\n const out: RosterState[] = [];\n if (row.deletion_scheduled_at || row.deletion_requested_at) {\n out.push({ state: \"deletion\", date: row.deletion_scheduled_at ?? null });\n } else if (row.is_active !== undefined) {\n out.push(row.is_active ? \"active\" : \"inactive\");\n }\n if (row.email_verified === false) out.push(\"unverified\");\n if (row.password_change_required_at) out.push(\"passwordChange\");\n return out;\n}\n\n/** The server's sort keys, which are the preset's column keys (§3.1). */\nexport const USER_ROSTER_SORT_KEYS = [\"name\", \"email\", \"role\", \"created\", \"last_login\"] as const;\nexport type UserRosterSortKey = (typeof USER_ROSTER_SORT_KEYS)[number];\n\n/**\n * The table's sort state as the `sort` query parameter of `GET /admin/users` (§3.1), in\n * the DataTable's own encoding ({@link encodeSorts}: `\"last_login.desc\"`), which\n * server-kit 0.4 reads beside the `-key` form. Only the first criterion on one of the\n * server's keys: an app's own column (`owned`) is the client's to sort, and the query\n * takes one key — a shift-clicked second criterion is not sent. `undefined` when nothing\n * the server knows is sorted, so its default order applies.\n */\nexport function userRosterSort(sorts: readonly SortState[]): string | undefined {\n const first = sorts.find((s) => (USER_ROSTER_SORT_KEYS as readonly string[]).includes(s.key));\n return first ? (encodeSorts([first]) ?? undefined) : undefined;\n}\n\n/* ── Labels ─────────────────────────────────────────────────────────────────── */\n\n/** The `userRoster` namespace: the preset's headers and the action menu's words. */\nexport interface UserRosterLabels {\n /** The identity column — the name with the address under it. */\n name: string;\n /** The separate address column (`emailColumn`). */\n email: string;\n role: string;\n state: string;\n created: string;\n lastLogin: string;\n /** A last login that never happened. */\n never: string;\n /** The actions column's (hidden) header. */\n actions: string;\n /** The action menu's button and panel — \"Actions for Ada Example\". */\n actionsFor: (name: string) => string;\n}\n\nexport const DEFAULT_USER_ROSTER_LABELS: UserRosterLabels = {\n name: \"Name\",\n email: \"Email\",\n role: \"Role\",\n state: \"State\",\n created: \"Created\",\n lastLogin: \"Last login\",\n never: \"Never\",\n actions: \"Actions\",\n actionsFor: (name) => `Actions for ${name}`,\n};\n\n/* ── UserIdentityCell ───────────────────────────────────────────────────────── */\n\nexport interface UserIdentityCellProps {\n /** First and last name (auth §3.2), shown in the READER's order. */\n person?: PersonName | null;\n /** A whole name, for an API that still sends `display_name` only. */\n name?: string | null;\n email?: string | null;\n /** The initials avatar before the name. Default true. */\n avatar?: boolean;\n /** After the name, on its line — a \"You\" chip, a demo mark. */\n badge?: ReactNode;\n /** Over the provider's locale. */\n locale?: string;\n className?: string;\n}\n\n/**\n * Who an account is, in one cell (§3.3): the initials avatar, the name in the reader's\n * order ({@link formatPersonName} — \"Example Ada\" in Hungarian) and the address under it\n * — the cell both rosters drew by hand. An account with no name yet (a migrated row\n * before `CompleteNameDialog`, an invitee) shows its address once, as the name.\n *\n * Both lines carry `data-private`, so keksdose's demo blur reaches them, and both end\n * in \"…\" at Normal only: from Large up they wrap (`truncate-until-large`, 0.33,\n * docs/text-size-harmonization.md §10.17), since a cut name or address is a finding there.\n */\nexport function UserIdentityCell({\n person,\n name,\n email,\n avatar = true,\n badge,\n locale: localeProp,\n className,\n}: UserIdentityCellProps) {\n const locale = useKitLocale(localeProp);\n const named = personLabel({ first: person?.first, last: person?.last, name }, locale);\n const address = (email ?? \"\").trim();\n return (\n <div className={cn(\"flex min-w-0 items-center gap-2.5\", className)}>\n {avatar && <UserAvatar person={person} name={name} email={email} size=\"sm\" />}\n <div className=\"min-w-0\">\n <div className=\"flex min-w-0 items-center gap-1.5\">\n <span data-private className=\"truncate-until-large font-medium text-[var(--text-primary)]\">\n {named || address}\n </span>\n {badge}\n </div>\n {named && address && (\n <div data-private className=\"truncate-until-large text-xs text-[var(--text-muted)]\">\n {address}\n </div>\n )}\n </div>\n </div>\n );\n}\n\n/* ── The row's actions ──────────────────────────────────────────────────────── */\n\n/** One entry of a row's action menu (§4) — the kit's {@link RowAction} since 0.32,\n * which generalised it for every dense row (docs/text-size-harmonization.md §10.8). */\nexport type UserRowAction = RowAction;\n\n/** What `actions(row)` may return: entries, and `false` / `null` for the ones a\n * condition left out (`row.is_active && {…}`). */\nexport type UserRowActionList = RowActionList;\n\nexport interface UserRowActionsProps {\n actions: UserRowActionList;\n /** The account's name, for the menu's name — \"Actions for Ada Example\". */\n name: string;\n labels?: Partial<UserRosterLabels>;\n}\n\n/**\n * A row's actions as one \"…\" button and a menu of them: keksdose had a strip of icon\n * buttons in the expanded row, Kurvenschmiede five text buttons in a cell — neither fits\n * a phone card, and both grow with every action §2.4 adds. The menu is portalled, so a\n * table's scroller cannot clip it; Escape and an outside press close it, and focus goes\n * back to the button, which is where a confirmation dialog then returns it.\n *\n * Since 0.32 this is {@link RowActions} with `collapse=\"menu\"` — the menu at every size —\n * named by the roster's own `actionsFor`.\n */\nexport function UserRowActions({ actions, name, labels: labelsProp }: UserRowActionsProps) {\n const labels = useKitLabels(\"userRoster\", DEFAULT_USER_ROSTER_LABELS, labelsProp);\n return (\n <RowActions\n actions={actions}\n name={name}\n collapse=\"menu\"\n labels={{ actionsFor: labels.actionsFor }}\n />\n );\n}\n\n/* ── The preset ─────────────────────────────────────────────────────────────── */\n\n/** How a row's role may be changed inline: `true`, or with reasons. */\nexport interface RoleEditing<R extends string> {\n /** Why the whole select is locked for this row — `\"self\"`, `\"last_admin\"`, or words. */\n disabledReason?: RoleLock;\n /** Why one role cannot be chosen for this row (a string: it goes inside an option). */\n optionDisabledReason?: (role: R) => string | undefined;\n /** The roles that may be chosen. Default: the whole vocabulary. */\n offered?: readonly R[];\n}\n\nexport interface UserRosterColumnsOptions<T extends UserRosterRow, R extends string = string> {\n /** The app's roles, as `RoleChip` reads them. */\n roles: RoleVocabulary<R>;\n /** The row's state chips. Default {@link adminUserStates}, which reads the contract's\n * fields (`is_active`, `email_verified`, `password_change_required_at`,\n * `deletion_scheduled_at`, `deletion_requested_at`). */\n stateOf?: (row: T) => readonly RosterState[];\n /** The app's own columns — keksdose's plan and key custody, Kurvenschmiede's owned\n * counts — after the dates, before the actions. */\n extra?: readonly DataTableColumn<T>[];\n /** The row's action menu (§4). Left out: no actions column. */\n actions?: (row: T) => UserRowActionList;\n /**\n * Whether this row's role is a select rather than a chip, and with which reasons.\n * Left out, or `false`: a chip. kastlan's several roles are never a select here — they\n * are a \"Manage roles\" action that opens `RolesEditor`.\n */\n editableRole?: (row: T) => boolean | RoleEditing<R>;\n /** A role was picked in a row's select. The app confirms (`acknowledge`) and sends it. */\n onRoleChange?: (row: T, role: R) => void;\n /** The row's role(s). Default `row.roles ?? row.role`. */\n roleOf?: (row: T) => R | readonly R[] | null | undefined;\n /** A separate, sortable \"Email\" column (the server's `email` sort key) beside the\n * identity. Default false: the address is under the name already. */\n emailColumn?: boolean;\n /** The words, already resolved. Default English; {@link useUserRosterColumns} reads\n * the provider's `userRoster` namespace. */\n labels?: Partial<UserRosterLabels>;\n}\n\nfunction rolesOf<T extends UserRosterRow, R extends string>(\n row: T,\n roleOf: UserRosterColumnsOptions<T, R>[\"roleOf\"],\n): R[] {\n const raw = roleOf ? roleOf(row) : ((row.roles ?? row.role) as R | readonly R[] | null | undefined);\n if (raw === null || raw === undefined || raw === \"\") return [];\n return typeof raw === \"string\" ? [raw as R] : [...(raw as readonly R[])];\n}\n\n/** The row's name in the reader's order — a component, because the order is the\n * READER's and the locale comes from the provider. */\nfunction RowName<T extends UserRosterRow>({ row, children }: { row: T; children: (name: string) => ReactNode }) {\n const locale = useKitLocale();\n const name = personLabel(\n { first: row.first_name, last: row.last_name, name: row.display_name, email: row.email },\n locale,\n );\n return <>{children(name)}</>;\n}\n\nfunction StateChips({ states }: { states: readonly RosterState[] }) {\n if (states.length === 0) return null;\n return (\n <div className=\"flex flex-wrap gap-1\">\n {states.map((entry) => {\n const spec = typeof entry === \"string\" ? { state: entry } : entry;\n return (\n <AccountStateChip key={spec.state} state={spec.state} date={spec.date} tone={spec.tone} size=\"xs\">\n {spec.label}\n </AccountStateChip>\n );\n })}\n </div>\n );\n}\n\n/**\n * The roster's columns, in the contract's order (§3.3):\n *\n * | key | cell | sort | phone |\n * |---|---|---|---|\n * | `name` | {@link UserIdentityCell} | last, first | the card's headline |\n * | `email` | the address (`emailColumn` only) | address | hidden |\n * | `role` | `RoleChip`(s), or {@link RoleSelect} where `editableRole` | role | field |\n * | `state` | `AccountStateChip`s from `stateOf` | — | field |\n * | `created` | `dateColumn` | instant | hidden |\n * | `last_login` | `dateColumn`, relative, \"Never\" | instant | field |\n * | …`extra` | the app's | the app's | the app's |\n * | `actions` | {@link UserRowActions} | — | field |\n *\n * Pure: hand it resolved words, or use {@link useUserRosterColumns}. The keys are stable,\n * so an app may drop or move a column (`columns.filter((c) => c.key !== \"created\")`).\n * Under `serverPagination` the `sortBy`s only make the headers clickable; the app sends\n * the sort ({@link userRosterSort}).\n */\nexport function userRosterColumns<T extends UserRosterRow, R extends string = string>({\n roles,\n stateOf = adminUserStates,\n extra = [],\n actions,\n editableRole,\n onRoleChange,\n roleOf,\n emailColumn = false,\n labels: labelsProp,\n}: UserRosterColumnsOptions<T, R>): DataTableColumn<T>[] {\n const labels: UserRosterLabels = { ...DEFAULT_USER_ROSTER_LABELS, ...labelsProp };\n const roleWords = (row: T) =>\n rolesOf(row, roleOf)\n .map((role) => roles[role]?.label ?? role)\n .join(\", \");\n const columns: DataTableColumn<T>[] = [\n {\n key: \"name\",\n header: labels.name,\n cell: (row) => (\n <UserIdentityCell\n person={{ first: row.first_name, last: row.last_name }}\n name={row.display_name}\n email={row.email}\n />\n ),\n // By last name, then first (auth §3.2), as the server sorts `name`.\n sortBy: (row) => `${row.last_name ?? \"\"} ${row.first_name ?? \"\"}`.trim().toLocaleLowerCase() || row.email,\n // Either part, in either order, or the address (auth §10.6).\n filterBy: (row) =>\n [row.first_name, row.last_name, row.last_name, row.first_name, row.display_name, row.email]\n .filter(Boolean)\n .join(\" \"),\n mobilePrimary: true,\n },\n ];\n if (emailColumn) {\n columns.push({\n key: \"email\",\n header: labels.email,\n className: \"whitespace-nowrap\",\n cell: (row) => (\n <span data-private className=\"text-[var(--text-secondary)]\">\n {row.email}\n </span>\n ),\n sortBy: (row) => row.email.toLowerCase(),\n filterBy: (row) => row.email,\n mobileHidden: true,\n });\n }\n columns.push(\n {\n key: \"role\",\n header: labels.role,\n cell: (row) => {\n const held = rolesOf(row, roleOf);\n const editing = held.length <= 1 ? editableRole?.(row) : false;\n if (editing && onRoleChange) {\n const rules: RoleEditing<R> = editing === true ? {} : editing;\n return (\n <RowName row={row}>\n {(name) => (\n <RoleSelect<R>\n size=\"sm\"\n name={name}\n value={held[0] ?? null}\n roles={roles}\n offered={rules.offered}\n disabledReason={rules.disabledReason}\n optionDisabledReason={rules.optionDisabledReason}\n onChange={(role) => onRoleChange(row, role)}\n />\n )}\n </RowName>\n );\n }\n if (held.length === 0) return null;\n return (\n <div className=\"flex flex-wrap gap-1\">\n {held.map((role) => (\n <RoleChip<R> key={role} value={role} roles={roles} size=\"xs\" />\n ))}\n </div>\n );\n },\n sortBy: roleWords,\n filter: {\n type: \"select\",\n getValue: (row) => rolesOf(row, roleOf)[0] ?? \"\",\n options: (Object.keys(roles) as R[]).map((value) => ({ value, label: roles[value].label })),\n },\n },\n {\n key: \"state\",\n header: labels.state,\n cell: (row) => <StateChips states={stateOf(row)} />,\n },\n dateColumn<T>({\n key: \"created\",\n header: labels.created,\n value: (row) => row.created_at ?? null,\n column: { mobileHidden: true },\n }),\n // How long ago rather than a date — the question is \"recently?\" — with the exact\n // time beside it (keksdose's last-seen column, Kurvenschmiede's; 0.32 §4: never only\n // in a tooltip).\n dateColumn<T>({\n key: \"last_login\",\n header: labels.lastLogin,\n value: (row) => row.last_login_at ?? null,\n display: \"relative\",\n empty: labels.never,\n }),\n ...extra,\n );\n if (actions) {\n columns.push({\n key: \"actions\",\n header: <span className=\"sr-only\">{labels.actions}</span>,\n headerText: labels.actions,\n // The caller's own words only: the menu reads the provider's itself, and the\n // English defaults merged in above must not shadow them.\n cell: (row) => (\n <RowName row={row}>\n {(name) => <UserRowActions actions={actions(row)} name={name} labels={labelsProp} />}\n </RowName>\n ),\n className: \"w-px whitespace-nowrap text-end\",\n headClassName: \"w-px\",\n // The menu button keeps its own click: a row link must not wrap it.\n noRowLink: true,\n });\n }\n return columns;\n}\n\n/**\n * {@link userRosterColumns} with the `userRoster` words from the provider, memoised on\n * the options — pass stable callbacks (`useCallback`) and a module-level vocabulary, or\n * the columns are rebuilt on every render.\n */\nexport function useUserRosterColumns<T extends UserRosterRow, R extends string = string>({\n roles,\n stateOf,\n extra,\n actions,\n editableRole,\n onRoleChange,\n roleOf,\n emailColumn,\n labels: labelsProp,\n}: UserRosterColumnsOptions<T, R>): DataTableColumn<T>[] {\n const labels = useKitLabels(\"userRoster\", DEFAULT_USER_ROSTER_LABELS, labelsProp);\n return useMemo(\n () =>\n userRosterColumns<T, R>({\n roles,\n stateOf,\n extra,\n actions,\n editableRole,\n onRoleChange,\n roleOf,\n emailColumn,\n labels,\n }),\n [roles, stateOf, extra, actions, editableRole, onRoleChange, roleOf, emailColumn, labels],\n );\n}\n"],"mappings":";AAmMiB,SAoHR,UApHQ,KAET,YAFS;AAnMjB,SAAS,eAAe;AAExB,SAAS,UAAU;AAGnB,SAAS,cAAc,oBAAoB;AAC3C,SAAS,kBAAkB,UAAU,kBAAkB;AAIvD,SAAS,mBAAmB;AAE5B,SAAS,kBAAkB;AAE3B,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AA6EpB,SAAS,gBAAgB,KAA0C;AACxE,QAAM,MAAqB,CAAC;AAC5B,MAAI,IAAI,yBAAyB,IAAI,uBAAuB;AAC1D,QAAI,KAAK,EAAE,OAAO,YAAY,MAA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O,CAAC,QAAQ,IAAI,iBAAiB;AAAA,MACrC,SAAS;AAAA,MACT,OAAO,OAAO;AAAA,IAChB,CAAC;AAAA,IACD,GAAG;AAAA,EACL;AACA,MAAI,SAAS;AACX,YAAQ,KAAK;AAAA,MACX,KAAK;AAAA,MACL,QAAQ,oBAAC,UAAK,WAAU,WAAW,iBAAO,SAAQ;AAAA,MAClD,YAAY,OAAO;AAAA;AAAA;AAAA,MAGnB,MAAM,CAAC,QACL,oBAAC,WAAQ,KACN,WAAC,SAAS,oBAAC,kBAAe,SAAS,QAAQ,GAAG,GAAG,MAAY,QAAQ,YAAY,GACpF;AAAA,MAEF,WAAW;AAAA,MACX,eAAe;AAAA;AAAA,MAEf,WAAW;AAAA,IACb,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAOO,SAAS,qBAAyE;AAAA,EACvF;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AACV,GAAyD;AACvD,QAAM,SAAS,aAAa,cAAc,4BAA4B,UAAU;AAChF,SAAO;AAAA,IACL,MACE,kBAAwB;AAAA,MACtB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,IACH,CAAC,OAAO,SAAS,OAAO,SAAS,cAAc,cAAc,QAAQ,aAAa,MAAM;AAAA,EAC1F;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/admin/user-roster.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport type { DateInput } from \"../lib/format\";\nimport type { PersonName } from \"../lib/person-name\";\nimport { useKitLabels, useKitLocale, type LabelOverride } from \"../i18n/kit-labels\";\nimport { AccountStateChip, RoleChip, dateColumn } from \"../components/account-chips\";\nimport type { AccountState, RoleVocabulary } from \"../components/account-chips\";\nimport type { ChipTone } from \"../components/chip\";\nimport type { DataTableColumn } from \"../components/data-table\";\nimport { encodeSorts } from \"../components/data-table-sort\";\nimport type { SortState } from \"../components/data-table-sort\";\nimport { RowActions } from \"../components/row-actions\";\nimport type { RowAction, RowActionList } from \"../components/row-actions\";\nimport { UserAvatar } from \"../components/user-avatar\";\nimport { personLabel } from \"./admin-parts\";\nimport { RoleSelect } from \"./role-select\";\nimport type { RoleLock } from \"./role-select\";\nimport { DEFAULT_USER_ROSTER_LABELS } from \"./user-roster-labels\";\n\n/**\n * The admin's user list (docs/user-admin-harmonization.md §3): a column preset for the\n * kit's `DataTable`, not a table of its own.\n *\n * keksdose built its roster by hand (1150 lines, its own Badge), Kurvenschmiede on the\n * kit `DataTable` with the 0.18 chips, kastlan as a settings page. What the three share\n * is the row — name over address, a role, the account's states, created, last login, the\n * app's own columns, and a handful of actions — so that is what the kit draws, and the\n * table, its paging, its sort and its filters stay the app's `DataTable` wiring:\n *\n * ```tsx\n * const columns = useUserRosterColumns<AdminUserRow, Role>({ roles: ROLES, actions, extra });\n * <DataTable rows={page.users} columns={columns} rowKey={(r) => r.id}\n * serverPagination={{ page, pageSize, total: page.total, onPageChange }}\n * sorts={sorts} onSortsChange={setSorts} />\n * // GET /admin/users?sort=${userRosterSort(sorts)}&…\n * ```\n *\n * The column keys ARE the server's sort keys (§3.1): `name`, `email`, `role`, `created`,\n * `last_login` — so {@link userRosterSort} turns the table's sort state into the query\n * as it is. Phone cards come from the same columns: the identity is the card's headline,\n * the role, states, last login and the actions are its fields, created is left off.\n */\n\n/* ── Rows and states ────────────────────────────────────────────────────────── */\n\n/**\n * The fields of the contract's `AdminUserRow` the preset reads (§3.2, the auth\n * contract's `UserResponse` core). An app's row has more — its `extra` — and the\n * preset passes the whole row to every callback.\n */\nexport interface UserRosterRow extends AdminUserStateFields {\n id: string | number;\n email: string;\n first_name?: string | null;\n last_name?: string | null;\n /** The derived whole name — only the fallback when both parts are blank. */\n display_name?: string | null;\n /** keksdose, Kurvenschmiede: one role. */\n role?: string | null;\n /** kastlan: the account's roles in the current company. Wins over `role`. */\n roles?: readonly string[] | null;\n created_at?: DateInput;\n /** Account-wide; kastlan's comes from its session rows (§3.2). */\n last_login_at?: DateInput;\n}\n\n/** The state fields of the contract's row that {@link adminUserStates} maps (§3.2). */\nexport interface AdminUserStateFields {\n is_active?: boolean;\n email_verified?: boolean;\n password_change_required_at?: string | null;\n /** `after_days` mode: the day the account is erased (§6.4). */\n deletion_scheduled_at?: string | null;\n /** When the user asked. The only deletion field in kastlan's `operator` mode, where\n * nothing is scheduled. */\n deletion_requested_at?: string | null;\n}\n\n/** One state chip of a row: an {@link AccountState}, or one with its `date` (the\n * `deletion` day), a `tone` or the app's own words. */\nexport type RosterState =\n | AccountState\n | { state: AccountState; date?: DateInput; tone?: ChipTone; label?: ReactNode };\n\n/**\n * The contract's row as state chips (§3.2: \"map 1:1 to the kit's AccountStateChip\"):\n *\n * - marked for deletion → `deletion` with the scheduled day (none in `operator` mode),\n * IN PLACE of `inactive` — such an account is always deactivated (§2.1);\n * - else `active` / `inactive` from `is_active`;\n * - `unverified` when `email_verified` is `false` (not when it is missing);\n * - `passwordChange` while `password_change_required_at` is set.\n */\nexport function adminUserStates(row: AdminUserStateFields): RosterState[] {\n const out: RosterState[] = [];\n if (row.deletion_scheduled_at || row.deletion_requested_at) {\n out.push({ state: \"deletion\", date: row.deletion_scheduled_at ?? null });\n } else if (row.is_active !== undefined) {\n out.push(row.is_active ? \"active\" : \"inactive\");\n }\n if (row.email_verified === false) out.push(\"unverified\");\n if (row.password_change_required_at) out.push(\"passwordChange\");\n return out;\n}\n\n/** The server's sort keys, which are the preset's column keys (§3.1). */\nexport const USER_ROSTER_SORT_KEYS = [\"name\", \"email\", \"role\", \"created\", \"last_login\"] as const;\nexport type UserRosterSortKey = (typeof USER_ROSTER_SORT_KEYS)[number];\n\n/**\n * The table's sort state as the `sort` query parameter of `GET /admin/users` (§3.1), in\n * the DataTable's own encoding ({@link encodeSorts}: `\"last_login.desc\"`), which\n * server-kit 0.4 reads beside the `-key` form. Only the first criterion on one of the\n * server's keys: an app's own column (`owned`) is the client's to sort, and the query\n * takes one key — a shift-clicked second criterion is not sent. `undefined` when nothing\n * the server knows is sorted, so its default order applies.\n */\nexport function userRosterSort(sorts: readonly SortState[]): string | undefined {\n const first = sorts.find((s) => (USER_ROSTER_SORT_KEYS as readonly string[]).includes(s.key));\n return first ? (encodeSorts([first]) ?? undefined) : undefined;\n}\n\n/* ── Labels ─────────────────────────────────────────────────────────────────── */\n\n/** The `userRoster` namespace: the preset's headers and the action menu's words. */\nexport interface UserRosterLabels {\n /** The identity column — the name with the address under it. */\n name: string;\n /** The separate address column (`emailColumn`). */\n email: string;\n role: string;\n state: string;\n created: string;\n lastLogin: string;\n /** A last login that never happened. */\n never: string;\n /** The actions column's (hidden) header. */\n actions: string;\n /** The action menu's button and panel — \"Actions for Ada Example\". */\n actionsFor: (name: string) => string;\n}\n\n// Defined in ./user-roster-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_USER_ROSTER_LABELS };\n\n/* ── UserIdentityCell ───────────────────────────────────────────────────────── */\n\nexport interface UserIdentityCellProps {\n /** First and last name (auth §3.2), shown in the READER's order. */\n person?: PersonName | null;\n /** A whole name, for an API that still sends `display_name` only. */\n name?: string | null;\n email?: string | null;\n /** The initials avatar before the name. Default true. */\n avatar?: boolean;\n /** After the name, on its line — a \"You\" chip, a demo mark. */\n badge?: ReactNode;\n /** Over the provider's locale. */\n locale?: string;\n className?: string;\n}\n\n/**\n * Who an account is, in one cell (§3.3): the initials avatar, the name in the reader's\n * order ({@link formatPersonName} — \"Example Ada\" in Hungarian) and the address under it\n * — the cell both rosters drew by hand. An account with no name yet (a migrated row\n * before `CompleteNameDialog`, an invitee) shows its address once, as the name.\n *\n * Both lines carry `data-private`, so keksdose's demo blur reaches them, and both end\n * in \"…\" at Normal only: from Large up they wrap (`truncate-until-large`, 0.33,\n * docs/text-size-harmonization.md §10.17), since a cut name or address is a finding there.\n */\nexport function UserIdentityCell({\n person,\n name,\n email,\n avatar = true,\n badge,\n locale: localeProp,\n className,\n}: UserIdentityCellProps) {\n const locale = useKitLocale(localeProp);\n const named = personLabel({ first: person?.first, last: person?.last, name }, locale);\n const address = (email ?? \"\").trim();\n return (\n <div className={cn(\"flex min-w-0 items-center gap-2.5\", className)}>\n {avatar && <UserAvatar person={person} name={name} email={email} size=\"sm\" />}\n <div className=\"min-w-0\">\n <div className=\"flex min-w-0 items-center gap-1.5\">\n <span data-private className=\"truncate-until-large font-medium text-primary\">\n {named || address}\n </span>\n {badge}\n </div>\n {named && address && (\n <div data-private className=\"truncate-until-large text-xs text-muted\">\n {address}\n </div>\n )}\n </div>\n </div>\n );\n}\n\n/* ── The row's actions ──────────────────────────────────────────────────────── */\n\n/** One entry of a row's action menu (§4) — the kit's {@link RowAction} since 0.32,\n * which generalised it for every dense row (docs/text-size-harmonization.md §10.8). */\nexport type UserRowAction = RowAction;\n\n/** What `actions(row)` may return: entries, and `false` / `null` for the ones a\n * condition left out (`row.is_active && {…}`). */\nexport type UserRowActionList = RowActionList;\n\nexport interface UserRowActionsProps {\n actions: UserRowActionList;\n /** The account's name, for the menu's name — \"Actions for Ada Example\". */\n name: string;\n labels?: LabelOverride<UserRosterLabels>;\n}\n\n/**\n * A row's actions as one \"…\" button and a menu of them: keksdose had a strip of icon\n * buttons in the expanded row, Kurvenschmiede five text buttons in a cell — neither fits\n * a phone card, and both grow with every action §2.4 adds. The menu is portalled, so a\n * table's scroller cannot clip it; Escape and an outside press close it, and focus goes\n * back to the button, which is where a confirmation dialog then returns it.\n *\n * Since 0.32 this is {@link RowActions} with `collapse=\"menu\"` — the menu at every size —\n * named by the roster's own `actionsFor`.\n */\nexport function UserRowActions({ actions, name, labels: labelsProp }: UserRowActionsProps) {\n const labels = useKitLabels(\"userRoster\", DEFAULT_USER_ROSTER_LABELS, labelsProp);\n return (\n <RowActions\n actions={actions}\n name={name}\n collapse=\"menu\"\n labels={{ actionsFor: labels.actionsFor }}\n />\n );\n}\n\n/* ── The preset ─────────────────────────────────────────────────────────────── */\n\n/** How a row's role may be changed inline: `true`, or with reasons. */\nexport interface RoleEditing<R extends string> {\n /** Why the whole select is locked for this row — `\"self\"`, `\"last_admin\"`, or words. */\n disabledReason?: RoleLock;\n /** Why one role cannot be chosen for this row (a string: it goes inside an option). */\n optionDisabledReason?: (role: R) => string | undefined;\n /** The roles that may be chosen. Default: the whole vocabulary. */\n offered?: readonly R[];\n}\n\nexport interface UserRosterColumnsOptions<T extends UserRosterRow, R extends string = string> {\n /** The app's roles, as `RoleChip` reads them. */\n roles: RoleVocabulary<R>;\n /** The row's state chips. Default {@link adminUserStates}, which reads the contract's\n * fields (`is_active`, `email_verified`, `password_change_required_at`,\n * `deletion_scheduled_at`, `deletion_requested_at`). */\n stateOf?: (row: T) => readonly RosterState[];\n /** The app's own columns — keksdose's plan and key custody, Kurvenschmiede's owned\n * counts — after the dates, before the actions. */\n extra?: readonly DataTableColumn<T>[];\n /** The row's action menu (§4). Left out: no actions column. */\n actions?: (row: T) => UserRowActionList;\n /**\n * Whether this row's role is a select rather than a chip, and with which reasons.\n * Left out, or `false`: a chip. kastlan's several roles are never a select here — they\n * are a \"Manage roles\" action that opens `RolesEditor`.\n */\n editableRole?: (row: T) => boolean | RoleEditing<R>;\n /** A role was picked in a row's select. The app confirms (`acknowledge`) and sends it. */\n onRoleChange?: (row: T, role: R) => void;\n /** The row's role(s). Default `row.roles ?? row.role`. */\n roleOf?: (row: T) => R | readonly R[] | null | undefined;\n /** A separate, sortable \"Email\" column (the server's `email` sort key) beside the\n * identity. Default false: the address is under the name already. */\n emailColumn?: boolean;\n /** The words, already resolved. Default English; {@link useUserRosterColumns} reads\n * the provider's `userRoster` namespace. */\n labels?: LabelOverride<UserRosterLabels>;\n}\n\nfunction rolesOf<T extends UserRosterRow, R extends string>(\n row: T,\n roleOf: UserRosterColumnsOptions<T, R>[\"roleOf\"],\n): R[] {\n const raw = roleOf ? roleOf(row) : ((row.roles ?? row.role) as R | readonly R[] | null | undefined);\n if (raw === null || raw === undefined || raw === \"\") return [];\n return typeof raw === \"string\" ? [raw as R] : [...(raw as readonly R[])];\n}\n\n/** The row's name in the reader's order — a component, because the order is the\n * READER's and the locale comes from the provider. */\nfunction RowName<T extends UserRosterRow>({ row, children }: { row: T; children: (name: string) => ReactNode }) {\n const locale = useKitLocale();\n const name = personLabel(\n { first: row.first_name, last: row.last_name, name: row.display_name, email: row.email },\n locale,\n );\n return <>{children(name)}</>;\n}\n\nfunction StateChips({ states }: { states: readonly RosterState[] }) {\n if (states.length === 0) return null;\n return (\n <div className=\"flex flex-wrap gap-1\">\n {states.map((entry) => {\n const spec = typeof entry === \"string\" ? { state: entry } : entry;\n return (\n <AccountStateChip key={spec.state} state={spec.state} date={spec.date} tone={spec.tone} size=\"xs\">\n {spec.label}\n </AccountStateChip>\n );\n })}\n </div>\n );\n}\n\n/**\n * The roster's columns, in the contract's order (§3.3):\n *\n * | key | cell | sort | phone |\n * |---|---|---|---|\n * | `name` | {@link UserIdentityCell} | last, first | the card's headline |\n * | `email` | the address (`emailColumn` only) | address | hidden |\n * | `role` | `RoleChip`(s), or {@link RoleSelect} where `editableRole` | role | field |\n * | `state` | `AccountStateChip`s from `stateOf` | — | field |\n * | `created` | `dateColumn` | instant | hidden |\n * | `last_login` | `dateColumn`, relative, \"Never\" | instant | field |\n * | …`extra` | the app's | the app's | the app's |\n * | `actions` | {@link UserRowActions} | — | field |\n *\n * Pure: hand it resolved words, or use {@link useUserRosterColumns}. The keys are stable,\n * so an app may drop or move a column (`columns.filter((c) => c.key !== \"created\")`).\n * Under `serverPagination` the `sortBy`s only make the headers clickable; the app sends\n * the sort ({@link userRosterSort}).\n */\nexport function userRosterColumns<T extends UserRosterRow, R extends string = string>({\n roles,\n stateOf = adminUserStates,\n extra = [],\n actions,\n editableRole,\n onRoleChange,\n roleOf,\n emailColumn = false,\n labels: labelsProp,\n}: UserRosterColumnsOptions<T, R>): DataTableColumn<T>[] {\n const labels: UserRosterLabels = { ...DEFAULT_USER_ROSTER_LABELS, ...labelsProp };\n const roleWords = (row: T) =>\n rolesOf(row, roleOf)\n .map((role) => roles[role]?.label ?? role)\n .join(\", \");\n const columns: DataTableColumn<T>[] = [\n {\n key: \"name\",\n header: labels.name,\n cell: (row) => (\n <UserIdentityCell\n person={{ first: row.first_name, last: row.last_name }}\n name={row.display_name}\n email={row.email}\n />\n ),\n // By last name, then first (auth §3.2), as the server sorts `name`.\n sortBy: (row) => `${row.last_name ?? \"\"} ${row.first_name ?? \"\"}`.trim().toLocaleLowerCase() || row.email,\n // Either part, in either order, or the address (auth §10.6).\n filterBy: (row) =>\n [row.first_name, row.last_name, row.last_name, row.first_name, row.display_name, row.email]\n .filter(Boolean)\n .join(\" \"),\n mobilePrimary: true,\n },\n ];\n if (emailColumn) {\n columns.push({\n key: \"email\",\n header: labels.email,\n className: \"whitespace-nowrap\",\n cell: (row) => (\n <span data-private className=\"text-secondary\">\n {row.email}\n </span>\n ),\n sortBy: (row) => row.email.toLowerCase(),\n filterBy: (row) => row.email,\n mobileHidden: true,\n });\n }\n columns.push(\n {\n key: \"role\",\n header: labels.role,\n cell: (row) => {\n const held = rolesOf(row, roleOf);\n const editing = held.length <= 1 ? editableRole?.(row) : false;\n if (editing && onRoleChange) {\n const rules: RoleEditing<R> = editing === true ? {} : editing;\n return (\n <RowName row={row}>\n {(name) => (\n <RoleSelect<R>\n size=\"sm\"\n name={name}\n value={held[0] ?? null}\n roles={roles}\n offered={rules.offered}\n disabledReason={rules.disabledReason}\n optionDisabledReason={rules.optionDisabledReason}\n onChange={(role) => onRoleChange(row, role)}\n />\n )}\n </RowName>\n );\n }\n if (held.length === 0) return null;\n return (\n <div className=\"flex flex-wrap gap-1\">\n {held.map((role) => (\n <RoleChip<R> key={role} value={role} roles={roles} size=\"xs\" />\n ))}\n </div>\n );\n },\n sortBy: roleWords,\n filter: {\n type: \"select\",\n getValue: (row) => rolesOf(row, roleOf)[0] ?? \"\",\n options: (Object.keys(roles) as R[]).map((value) => ({ value, label: roles[value].label })),\n },\n },\n {\n key: \"state\",\n header: labels.state,\n cell: (row) => <StateChips states={stateOf(row)} />,\n },\n dateColumn<T>({\n key: \"created\",\n header: labels.created,\n value: (row) => row.created_at ?? null,\n column: { mobileHidden: true },\n }),\n // How long ago rather than a date — the question is \"recently?\" — with the exact\n // time beside it (keksdose's last-seen column, Kurvenschmiede's; 0.32 §4: never only\n // in a tooltip).\n dateColumn<T>({\n key: \"last_login\",\n header: labels.lastLogin,\n value: (row) => row.last_login_at ?? null,\n display: \"relative\",\n empty: labels.never,\n }),\n ...extra,\n );\n if (actions) {\n columns.push({\n key: \"actions\",\n header: <span className=\"sr-only\">{labels.actions}</span>,\n headerText: labels.actions,\n // The caller's own words only: the menu reads the provider's itself, and the\n // English defaults merged in above must not shadow them.\n cell: (row) => (\n <RowName row={row}>\n {(name) => <UserRowActions actions={actions(row)} name={name} labels={labelsProp} />}\n </RowName>\n ),\n className: \"w-px whitespace-nowrap text-end\",\n headClassName: \"w-px\",\n // The menu button keeps its own click: a row link must not wrap it.\n noRowLink: true,\n });\n }\n return columns;\n}\n\n/**\n * {@link userRosterColumns} with the `userRoster` words from the provider, memoised on\n * the options — pass stable callbacks (`useCallback`) and a module-level vocabulary, or\n * the columns are rebuilt on every render.\n */\nexport function useUserRosterColumns<T extends UserRosterRow, R extends string = string>({\n roles,\n stateOf,\n extra,\n actions,\n editableRole,\n onRoleChange,\n roleOf,\n emailColumn,\n labels: labelsProp,\n}: UserRosterColumnsOptions<T, R>): DataTableColumn<T>[] {\n const labels = useKitLabels(\"userRoster\", DEFAULT_USER_ROSTER_LABELS, labelsProp);\n return useMemo(\n () =>\n userRosterColumns<T, R>({\n roles,\n stateOf,\n extra,\n actions,\n editableRole,\n onRoleChange,\n roleOf,\n emailColumn,\n labels,\n }),\n [roles, stateOf, extra, actions, editableRole, onRoleChange, roleOf, emailColumn, labels],\n );\n}\n"],"mappings":";A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ation",
|
|
4
|
+
accepting: "Joining\u2026",
|
|
5
|
+
accepted: "Invitation accepted.",
|
|
6
|
+
joined: (name) => `You\u2019ve joined ${name}.`,
|
|
7
|
+
continue: "Continue",
|
|
8
|
+
invalid: "Could not join with this link",
|
|
9
|
+
expired: "This invitation has expired",
|
|
10
|
+
noToken: "This link is missing its invite token.",
|
|
11
|
+
askAgain: "Ask the person who invited you to send a new invitation.",
|
|
12
|
+
signInFirst: "Sign in to accept this invitation",
|
|
13
|
+
signInHint: "Use the account the invitation was sent to.",
|
|
14
|
+
signIn: "Sign in",
|
|
15
|
+
register: "Create account"
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
DEFAULT_ACCEPT_INVITATION_LABELS
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=accept-invitation-labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/auth/accept-invitation-labels.ts"],"sourcesContent":["// The English words of ./accept-invitation, in a module with no component code: the English\n// catalogue (src/i18n/defaults.ts) imports them without the component, so `en` loads as one\n// chunk like the other languages (0.34, KS U8). ./accept-invitation re-exports them.\n\nimport type { AcceptInvitationLabels } from \"./accept-invitation\";\n\nexport const DEFAULT_ACCEPT_INVITATION_LABELS: AcceptInvitationLabels = {\n title: \"Accept invitation\",\n accepting: \"Joining…\",\n accepted: \"Invitation accepted.\",\n joined: (name) => `You’ve joined ${name}.`,\n continue: \"Continue\",\n invalid: \"Could not join with this link\",\n expired: \"This invitation has expired\",\n noToken: \"This link is missing its invite token.\",\n askAgain: \"Ask the person who invited you to send a new invitation.\",\n signInFirst: \"Sign in to accept this invitation\",\n signInHint: \"Use the account the invitation was sent to.\",\n signIn: \"Sign in\",\n register: \"Create account\",\n};\n"],"mappings":";AAMO,MAAM,mCAA2D;AAAA,EACtE,OAAO;AAAA,EACP,WAAW;AAAA,EACX,UAAU;AAAA,EACV,QAAQ,CAAC,SAAS,sBAAiB,IAAI;AAAA,EACvC,UAAU;AAAA,EACV,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,UAAU;AACZ;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { AuthHeadingLevel } from
|
|
4
|
-
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
|
+
import { type LabelOverride } from "../i18n/kit-labels.js";
|
|
3
|
+
import type { AuthHeadingLevel } from "./status-parts.js";
|
|
4
|
+
import { DEFAULT_ACCEPT_INVITATION_LABELS } from "./accept-invitation-labels.js";
|
|
5
5
|
/** Every string the page renders — the `acceptInvitation` namespace. keksdose's words
|
|
6
6
|
* where its `/join` page has them (`budget_share.join*`). */
|
|
7
|
-
interface AcceptInvitationLabels {
|
|
7
|
+
export interface AcceptInvitationLabels {
|
|
8
8
|
/** The heading. */
|
|
9
9
|
title: string;
|
|
10
10
|
/** While the invitation is accepted. */
|
|
@@ -30,17 +30,17 @@ interface AcceptInvitationLabels {
|
|
|
30
30
|
/** Beside "Sign in", with `registerHref`. */
|
|
31
31
|
register: string;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
export { DEFAULT_ACCEPT_INVITATION_LABELS };
|
|
34
34
|
/** What `onAccept` may resolve with. */
|
|
35
|
-
interface AcceptInvitationResult {
|
|
35
|
+
export interface AcceptInvitationResult {
|
|
36
36
|
/** What the invitation attached the account to, by name — "Example Property Ltd",
|
|
37
37
|
* "Team North", a budget. Said in the confirmation. */
|
|
38
38
|
name?: string;
|
|
39
39
|
}
|
|
40
40
|
/** What became of an invitation that was not accepted. `signIn`: the server wants a
|
|
41
41
|
* session first (a `401`), which `signedIn` did not know about. */
|
|
42
|
-
type AcceptInvitationFailure = "invalid" | "expired" | "signIn";
|
|
43
|
-
interface AcceptInvitationProps extends Omit<
|
|
42
|
+
export type AcceptInvitationFailure = "invalid" | "expired" | "signIn";
|
|
43
|
+
export interface AcceptInvitationProps extends Omit<ComponentPropsWithRef<"div">, "children" | "title"> {
|
|
44
44
|
/** The invitation's token — the app's `?invite=` / `?token=`. Empty: the link was cut
|
|
45
45
|
* short, and the page says so without asking anyone. */
|
|
46
46
|
token: string;
|
|
@@ -69,7 +69,7 @@ interface AcceptInvitationProps extends Omit<ComponentPropsWithoutRef<"div">, "c
|
|
|
69
69
|
title?: ReactNode;
|
|
70
70
|
/** The heading's level. Default `h2`, under the page's `h1`. */
|
|
71
71
|
headingAs?: AuthHeadingLevel;
|
|
72
|
-
labels?:
|
|
72
|
+
labels?: LabelOverride<AcceptInvitationLabels>;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Accept an invitation with an EXISTING account (docs/auth-harmonization.md §4.4): the
|
|
@@ -85,6 +85,4 @@ interface AcceptInvitationProps extends Omit<ComponentPropsWithoutRef<"div">, "c
|
|
|
85
85
|
* "resend" mints a new token); or "sign in first", with nothing sent. "Continue" REPLACES
|
|
86
86
|
* this page in the history: the token is spent, so Back must not land here again.
|
|
87
87
|
*/
|
|
88
|
-
declare function AcceptInvitation({ token, signedIn, onAccept, classifyError, continueHref, signInHref, registerHref, title, headingAs: Heading, labels: labelsProp, className, ...rest }: AcceptInvitationProps): react.JSX.Element;
|
|
89
|
-
|
|
90
|
-
export { AcceptInvitation, type AcceptInvitationFailure, type AcceptInvitationLabels, type AcceptInvitationProps, type AcceptInvitationResult, DEFAULT_ACCEPT_INVITATION_LABELS };
|
|
88
|
+
export declare function AcceptInvitation({ token, signedIn, onAccept, classifyError, continueHref, signInHref, registerHref, title, headingAs: Heading, labels: labelsProp, className, ...rest }: AcceptInvitationProps): import("react").JSX.Element;
|
|
@@ -6,24 +6,11 @@ import { cn } from "../lib/cn.js";
|
|
|
6
6
|
import { useKitLabels } from "../i18n/kit-labels.js";
|
|
7
7
|
import { useAnnounce } from "../hooks/use-announce.js";
|
|
8
8
|
import { LoadingState } from "../components/loading-state.js";
|
|
9
|
-
import { Button
|
|
9
|
+
import { Button } from "../components/button.js";
|
|
10
|
+
import { EmptyState } from "../components/empty-state.js";
|
|
10
11
|
import { authErrorCode } from "./auth-errors.js";
|
|
11
12
|
import { OUTCOME_CLASS, STATUS_HEADING_CLASS, useOncePerKey } from "./status-parts.js";
|
|
12
|
-
|
|
13
|
-
title: "Accept invitation",
|
|
14
|
-
accepting: "Joining\u2026",
|
|
15
|
-
accepted: "Invitation accepted.",
|
|
16
|
-
joined: (name) => `You\u2019ve joined ${name}.`,
|
|
17
|
-
continue: "Continue",
|
|
18
|
-
invalid: "Could not join with this link",
|
|
19
|
-
expired: "This invitation has expired",
|
|
20
|
-
noToken: "This link is missing its invite token.",
|
|
21
|
-
askAgain: "Ask the person who invited you to send a new invitation.",
|
|
22
|
-
signInFirst: "Sign in to accept this invitation",
|
|
23
|
-
signInHint: "Use the account the invitation was sent to.",
|
|
24
|
-
signIn: "Sign in",
|
|
25
|
-
register: "Create account"
|
|
26
|
-
};
|
|
13
|
+
import { DEFAULT_ACCEPT_INVITATION_LABELS } from "./accept-invitation-labels.js";
|
|
27
14
|
function AcceptInvitation({
|
|
28
15
|
token,
|
|
29
16
|
signedIn,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/auth/accept-invitation.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport { CheckCircle2, LogIn, TimerOff, XCircle } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { useAnnounce } from \"../hooks/use-announce\";\nimport { LoadingState } from \"../components/loading-state\";\nimport { Button, EmptyState } from \"../components/ui\";\nimport { authErrorCode } from \"./auth-errors\";\nimport { OUTCOME_CLASS, STATUS_HEADING_CLASS, useOncePerKey } from \"./status-parts\";\nimport type { AuthHeadingLevel } from \"./status-parts\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/** Every string the page renders — the `acceptInvitation` namespace. keksdose's words\n * where its `/join` page has them (`budget_share.join*`). */\nexport interface AcceptInvitationLabels {\n /** The heading. */\n title: string;\n /** While the invitation is accepted. */\n accepting: string;\n /** Accepted, when the app did not say into what. */\n accepted: string;\n /** Accepted, given what it attached the account to — a company, a team, a budget. */\n joined: (name: string) => string;\n /** Into the app, from every outcome but \"sign in first\". */\n continue: string;\n /** The token is unknown, spent, or for another address. */\n invalid: string;\n expired: string;\n /** The page was opened without a `token`. */\n noToken: string;\n /** Under `invalid` and `expired`: an invitation is re-sent as a new one (§4.4). */\n askAgain: string;\n /** Nobody is signed in: an existing account accepts after sign-in (§4.4). */\n signInFirst: string;\n /** Under it. */\n signInHint: string;\n signIn: string;\n /** Beside \"Sign in\", with `registerHref`. */\n register: string;\n}\n\nexport const DEFAULT_ACCEPT_INVITATION_LABELS: AcceptInvitationLabels = {\n title: \"Accept invitation\",\n accepting: \"Joining…\",\n accepted: \"Invitation accepted.\",\n joined: (name) => `You’ve joined ${name}.`,\n continue: \"Continue\",\n invalid: \"Could not join with this link\",\n expired: \"This invitation has expired\",\n noToken: \"This link is missing its invite token.\",\n askAgain: \"Ask the person who invited you to send a new invitation.\",\n signInFirst: \"Sign in to accept this invitation\",\n signInHint: \"Use the account the invitation was sent to.\",\n signIn: \"Sign in\",\n register: \"Create account\",\n};\n\n/* ── Types ───────────────────────────────────────────────────────────────── */\n\n/** What `onAccept` may resolve with. */\nexport interface AcceptInvitationResult {\n /** What the invitation attached the account to, by name — \"Example Property Ltd\",\n * \"Team North\", a budget. Said in the confirmation. */\n name?: string;\n}\n\n/** What became of an invitation that was not accepted. `signIn`: the server wants a\n * session first (a `401`), which `signedIn` did not know about. */\nexport type AcceptInvitationFailure = \"invalid\" | \"expired\" | \"signIn\";\n\ntype Outcome = \"accepted\" | AcceptInvitationFailure;\n\nexport interface AcceptInvitationProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\" | \"title\"> {\n /** The invitation's token — the app's `?invite=` / `?token=`. Empty: the link was cut\n * short, and the page says so without asking anyone. */\n token: string;\n /** Someone is signed in on this device. Until then the page asks for a sign-in and\n * sends nothing: accepting attaches the invitation to the SIGNED-IN account. */\n signedIn: boolean;\n /**\n * Accept it — `POST /auth/invitations/accept {token}`, once per token, as soon as\n * someone is signed in. Resolve (with what it attached the account to, if the app\n * knows); reject with the client's error.\n */\n onAccept: (token: string) => Promise<AcceptInvitationResult | void | undefined>;\n /** Which dead end a rejection is. Default: `invitation_expired` is `expired`,\n * anything else `invalid` (§5.2's codes). Map a `401` to `signIn` here. */\n classifyError?: (error: unknown) => AcceptInvitationFailure;\n /** \"Continue\" — into the app. Default `/`. */\n continueHref?: string;\n /** \"Sign in\" — the app's `/login`, with a way back here (`?next=…`). Default\n * `/login`. */\n signInHref?: string;\n /** \"Create account\" beside \"Sign in\", for an invitation that may lead to a new\n * account — the app's `/register?invite=…`. Left out, none. */\n registerHref?: string;\n /** The heading. Default `labels.title`; `null` draws none, for a page that puts it in\n * `AuthLayout`'s `title` instead. */\n title?: ReactNode;\n /** The heading's level. Default `h2`, under the page's `h1`. */\n headingAs?: AuthHeadingLevel;\n labels?: Partial<AcceptInvitationLabels>;\n}\n\n/**\n * Accept an invitation with an EXISTING account (docs/auth-harmonization.md §4.4): the\n * link leads here, the person signs in if they are not, and the app attaches the\n * invitation — a kastlan user joining a second company, a Kurvenschmiede member a team,\n * a keksdose user a shared budget. A new address never needs this page: its link opens\n * the sign-up form, which spends the invitation itself.\n *\n * keksdose's `JoinSharePage` (features/budgets/join-page.tsx) is the model: it accepts\n * on load, once (the token is single-use, and StrictMode's double effect would send it\n * twice), and shows the outcome where its spinner was. The outcomes: accepted, with the\n * way into the app; not valid; expired (both say to ask for a new invitation, since\n * \"resend\" mints a new token); or \"sign in first\", with nothing sent. \"Continue\" REPLACES\n * this page in the history: the token is spent, so Back must not land here again.\n */\nexport function AcceptInvitation({\n token,\n signedIn,\n onAccept,\n classifyError,\n continueHref = \"/\",\n signInHref = \"/login\",\n registerHref,\n title,\n headingAs: Heading = \"h2\",\n labels: labelsProp,\n className,\n ...rest\n}: AcceptInvitationProps) {\n const labels = useKitLabels(\"acceptInvitation\", DEFAULT_ACCEPT_INVITATION_LABELS, labelsProp);\n const [settled, setSettled] = useState<{ token: string; outcome: Outcome; name?: string } | null>(null);\n const { announce, regionProps } = useAnnounce();\n\n useOncePerKey(token !== \"\" && signedIn ? token : null, onAccept, (key, result) => {\n if (result.ok) {\n const name = result.value?.name?.trim() || undefined;\n setSettled({ token: key, outcome: \"accepted\", name });\n announce(name ? labels.joined(name) : labels.accepted);\n return;\n }\n const failure: AcceptInvitationFailure =\n classifyError?.(result.error) ?? (authErrorCode(result.error) === \"invitation_expired\" ? \"expired\" : \"invalid\");\n setSettled({ token: key, outcome: failure });\n announce(failure === \"signIn\" ? labels.signInFirst : labels[failure]);\n });\n\n const outcome: Outcome | \"accepting\" =\n token === \"\"\n ? \"invalid\"\n : settled?.token === token\n ? settled.outcome\n : signedIn\n ? \"accepting\"\n : \"signIn\";\n\n const continueButton = (variant: \"brand\" | \"secondary\") => (\n <Button href={continueHref} replace variant={variant}>\n {labels.continue}\n </Button>\n );\n\n let body: ReactNode;\n if (outcome === \"accepting\") {\n body = <LoadingState size=\"sm\" label={labels.accepting} />;\n } else if (outcome === \"accepted\") {\n body = (\n <EmptyState\n tone=\"success\"\n icon={<CheckCircle2 />}\n title={settled?.name ? labels.joined(settled.name) : labels.accepted}\n action={continueButton(\"brand\")}\n className={OUTCOME_CLASS}\n />\n );\n } else if (outcome === \"signIn\") {\n body = (\n <EmptyState\n icon={<LogIn />}\n title={labels.signInFirst}\n hint={labels.signInHint}\n action={\n <>\n <Button href={signInHref} variant=\"brand\">\n {labels.signIn}\n </Button>\n {registerHref !== undefined && (\n <Button href={registerHref} variant=\"secondary\">\n {labels.register}\n </Button>\n )}\n </>\n }\n className={OUTCOME_CLASS}\n />\n );\n } else {\n body = (\n <EmptyState\n tone=\"danger\"\n icon={outcome === \"expired\" ? <TimerOff /> : <XCircle />}\n title={token === \"\" ? labels.noToken : labels[outcome]}\n hint={labels.askAgain}\n action={signedIn ? continueButton(\"secondary\") : undefined}\n className={OUTCOME_CLASS}\n />\n );\n }\n\n return (\n <div\n {...rest}\n data-state={outcome}\n aria-busy={outcome === \"accepting\" || undefined}\n className={cn(\"space-y-3\", className)}\n >\n {title === null ? null : <Heading className={STATUS_HEADING_CLASS}>{title ?? labels.title}</Heading>}\n {body}\n {/* Rendered from the start, so the outcome is read when it arrives. */}\n <div {...regionProps} />\n </div>\n );\n}\n"],"mappings":";AAiKI,SAyBM,UAzBN,KAyBM,YAzBN;AAjKJ,SAAS,gBAAgB;AAEzB,SAAS,cAAc,OAAO,UAAU,eAAe;AACvD,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,QAAQ,kBAAkB;AACnC,SAAS,qBAAqB;AAC9B,SAAS,eAAe,sBAAsB,qBAAqB;AAkC5D,MAAM,mCAA2D;AAAA,EACtE,OAAO;AAAA,EACP,WAAW;AAAA,EACX,UAAU;AAAA,EACV,QAAQ,CAAC,SAAS,sBAAiB,IAAI;AAAA,EACvC,UAAU;AAAA,EACV,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,UAAU;AACZ;AA+DO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,WAAW,UAAU;AAAA,EACrB,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAA0B;AACxB,QAAM,SAAS,aAAa,oBAAoB,kCAAkC,UAAU;AAC5F,QAAM,CAAC,SAAS,UAAU,IAAI,SAAoE,IAAI;AACtG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UACC,iBAAiB,UAChB,oBAAC,UAAO,MAAM,cAAc,SAAQ,aACjC,iBAAO,UACV;AAAA,WAEJ;AAAA,QAEF,WAAW;AAAA;AAAA,IACb;AAAA,EAEJ,OAAO;AACL,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,MAAM,YAAY,YAAY,oBAAC,YAAS,IAAK,oBAAC,WAAQ;AAAA,QACtD,OAAO,UAAU,KAAK,OAAO,UAAU,OAAO,OAAO;AAAA,QACrD,MAAM,OAAO;AAAA,QACb,QAAQ,WAAW,eAAe,WAAW,IAAI;AAAA,QACjD,WAAW;AAAA;AAAA,IACb;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,cAAY;AAAA,MACZ,aAAW,YAAY,eAAe;AAAA,MACtC,WAAW,GAAG,aAAa,SAAS;AAAA,MAEnC;AAAA,kBAAU,OAAO,OAAO,oBAAC,WAAQ,WAAW,sBAAuB,mBAAS,OAAO,OAAM;AAAA,QACzF;AAAA,QAED,oBAAC,SAAK,GAAG,aAAa;AAAA;AAAA;AAAA,EACxB;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/auth/accept-invitation.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { CheckCircle2, LogIn, TimerOff, XCircle } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { useAnnounce } from \"../hooks/use-announce\";\nimport { LoadingState } from \"../components/loading-state\";\nimport { Button } from \"../components/button\";\nimport { EmptyState } from \"../components/empty-state\";\nimport { authErrorCode } from \"./auth-errors\";\nimport { OUTCOME_CLASS, STATUS_HEADING_CLASS, useOncePerKey } from \"./status-parts\";\nimport type { AuthHeadingLevel } from \"./status-parts\";\nimport { DEFAULT_ACCEPT_INVITATION_LABELS } from \"./accept-invitation-labels\";\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\n/** Every string the page renders — the `acceptInvitation` namespace. keksdose's words\n * where its `/join` page has them (`budget_share.join*`). */\nexport interface AcceptInvitationLabels {\n /** The heading. */\n title: string;\n /** While the invitation is accepted. */\n accepting: string;\n /** Accepted, when the app did not say into what. */\n accepted: string;\n /** Accepted, given what it attached the account to — a company, a team, a budget. */\n joined: (name: string) => string;\n /** Into the app, from every outcome but \"sign in first\". */\n continue: string;\n /** The token is unknown, spent, or for another address. */\n invalid: string;\n expired: string;\n /** The page was opened without a `token`. */\n noToken: string;\n /** Under `invalid` and `expired`: an invitation is re-sent as a new one (§4.4). */\n askAgain: string;\n /** Nobody is signed in: an existing account accepts after sign-in (§4.4). */\n signInFirst: string;\n /** Under it. */\n signInHint: string;\n signIn: string;\n /** Beside \"Sign in\", with `registerHref`. */\n register: string;\n}\n\n// Defined in ./accept-invitation-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_ACCEPT_INVITATION_LABELS };\n\n/* ── Types ───────────────────────────────────────────────────────────────── */\n\n/** What `onAccept` may resolve with. */\nexport interface AcceptInvitationResult {\n /** What the invitation attached the account to, by name — \"Example Property Ltd\",\n * \"Team North\", a budget. Said in the confirmation. */\n name?: string;\n}\n\n/** What became of an invitation that was not accepted. `signIn`: the server wants a\n * session first (a `401`), which `signedIn` did not know about. */\nexport type AcceptInvitationFailure = \"invalid\" | \"expired\" | \"signIn\";\n\ntype Outcome = \"accepted\" | AcceptInvitationFailure;\n\nexport interface AcceptInvitationProps extends Omit<ComponentPropsWithRef<\"div\">, \"children\" | \"title\"> {\n /** The invitation's token — the app's `?invite=` / `?token=`. Empty: the link was cut\n * short, and the page says so without asking anyone. */\n token: string;\n /** Someone is signed in on this device. Until then the page asks for a sign-in and\n * sends nothing: accepting attaches the invitation to the SIGNED-IN account. */\n signedIn: boolean;\n /**\n * Accept it — `POST /auth/invitations/accept {token}`, once per token, as soon as\n * someone is signed in. Resolve (with what it attached the account to, if the app\n * knows); reject with the client's error.\n */\n onAccept: (token: string) => Promise<AcceptInvitationResult | void | undefined>;\n /** Which dead end a rejection is. Default: `invitation_expired` is `expired`,\n * anything else `invalid` (§5.2's codes). Map a `401` to `signIn` here. */\n classifyError?: (error: unknown) => AcceptInvitationFailure;\n /** \"Continue\" — into the app. Default `/`. */\n continueHref?: string;\n /** \"Sign in\" — the app's `/login`, with a way back here (`?next=…`). Default\n * `/login`. */\n signInHref?: string;\n /** \"Create account\" beside \"Sign in\", for an invitation that may lead to a new\n * account — the app's `/register?invite=…`. Left out, none. */\n registerHref?: string;\n /** The heading. Default `labels.title`; `null` draws none, for a page that puts it in\n * `AuthLayout`'s `title` instead. */\n title?: ReactNode;\n /** The heading's level. Default `h2`, under the page's `h1`. */\n headingAs?: AuthHeadingLevel;\n labels?: LabelOverride<AcceptInvitationLabels>;\n}\n\n/**\n * Accept an invitation with an EXISTING account (docs/auth-harmonization.md §4.4): the\n * link leads here, the person signs in if they are not, and the app attaches the\n * invitation — a kastlan user joining a second company, a Kurvenschmiede member a team,\n * a keksdose user a shared budget. A new address never needs this page: its link opens\n * the sign-up form, which spends the invitation itself.\n *\n * keksdose's `JoinSharePage` (features/budgets/join-page.tsx) is the model: it accepts\n * on load, once (the token is single-use, and StrictMode's double effect would send it\n * twice), and shows the outcome where its spinner was. The outcomes: accepted, with the\n * way into the app; not valid; expired (both say to ask for a new invitation, since\n * \"resend\" mints a new token); or \"sign in first\", with nothing sent. \"Continue\" REPLACES\n * this page in the history: the token is spent, so Back must not land here again.\n */\nexport function AcceptInvitation({\n token,\n signedIn,\n onAccept,\n classifyError,\n continueHref = \"/\",\n signInHref = \"/login\",\n registerHref,\n title,\n headingAs: Heading = \"h2\",\n labels: labelsProp,\n className,\n ...rest\n}: AcceptInvitationProps) {\n const labels = useKitLabels(\"acceptInvitation\", DEFAULT_ACCEPT_INVITATION_LABELS, labelsProp);\n const [settled, setSettled] = useState<{ token: string; outcome: Outcome; name?: string } | null>(null);\n const { announce, regionProps } = useAnnounce();\n\n useOncePerKey(token !== \"\" && signedIn ? token : null, onAccept, (key, result) => {\n if (result.ok) {\n const name = result.value?.name?.trim() || undefined;\n setSettled({ token: key, outcome: \"accepted\", name });\n announce(name ? labels.joined(name) : labels.accepted);\n return;\n }\n const failure: AcceptInvitationFailure =\n classifyError?.(result.error) ?? (authErrorCode(result.error) === \"invitation_expired\" ? \"expired\" : \"invalid\");\n setSettled({ token: key, outcome: failure });\n announce(failure === \"signIn\" ? labels.signInFirst : labels[failure]);\n });\n\n const outcome: Outcome | \"accepting\" =\n token === \"\"\n ? \"invalid\"\n : settled?.token === token\n ? settled.outcome\n : signedIn\n ? \"accepting\"\n : \"signIn\";\n\n const continueButton = (variant: \"brand\" | \"secondary\") => (\n <Button href={continueHref} replace variant={variant}>\n {labels.continue}\n </Button>\n );\n\n let body: ReactNode;\n if (outcome === \"accepting\") {\n body = <LoadingState size=\"sm\" label={labels.accepting} />;\n } else if (outcome === \"accepted\") {\n body = (\n <EmptyState\n tone=\"success\"\n icon={<CheckCircle2 />}\n title={settled?.name ? labels.joined(settled.name) : labels.accepted}\n action={continueButton(\"brand\")}\n className={OUTCOME_CLASS}\n />\n );\n } else if (outcome === \"signIn\") {\n body = (\n <EmptyState\n icon={<LogIn />}\n title={labels.signInFirst}\n hint={labels.signInHint}\n action={\n <>\n <Button href={signInHref} variant=\"brand\">\n {labels.signIn}\n </Button>\n {registerHref !== undefined && (\n <Button href={registerHref} variant=\"secondary\">\n {labels.register}\n </Button>\n )}\n </>\n }\n className={OUTCOME_CLASS}\n />\n );\n } else {\n body = (\n <EmptyState\n tone=\"danger\"\n icon={outcome === \"expired\" ? <TimerOff /> : <XCircle />}\n title={token === \"\" ? labels.noToken : labels[outcome]}\n hint={labels.askAgain}\n action={signedIn ? continueButton(\"secondary\") : undefined}\n className={OUTCOME_CLASS}\n />\n );\n }\n\n return (\n <div\n {...rest}\n data-state={outcome}\n aria-busy={outcome === \"accepting\" || undefined}\n className={cn(\"space-y-3\", className)}\n >\n {title === null ? null : <Heading className={STATUS_HEADING_CLASS}>{title ?? labels.title}</Heading>}\n {body}\n {/* Rendered from the start, so the outcome is read when it arrives. */}\n <div {...regionProps} />\n </div>\n );\n}\n"],"mappings":";AAsJI,SAyBM,UAzBN,KAyBM,YAzBN;AAtJJ,SAAS,gBAAgB;AAEzB,SAAS,cAAc,OAAO,UAAU,eAAe;AACvD,SAAS,UAAU;AACnB,SAAS,oBAAwC;AACjD,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,eAAe,sBAAsB,qBAAqB;AAEnE,SAAS,wCAAwC;AAiG1C,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,WAAW,UAAU;AAAA,EACrB,QAAQ;AAAA,EACR;AAAA,EACA,GAAG;AACL,GAA0B;AACxB,QAAM,SAAS,aAAa,oBAAoB,kCAAkC,UAAU;AAC5F,QAAM,CAAC,SAAS,UAAU,IAAI,SAAoE,IAAI;AACtG,QAAM,EAAE,UAAU,YAAY,IAAI,YAAY;AAE9C,gBAAc,UAAU,MAAM,WAAW,QAAQ,MAAM,UAAU,CAAC,KAAK,WAAW;AAChF,QAAI,OAAO,IAAI;AACb,YAAM,OAAO,OAAO,OAAO,MAAM,KAAK,KAAK;AAC3C,iBAAW,EAAE,OAAO,KAAK,SAAS,YAAY,KAAK,CAAC;AACpD,eAAS,OAAO,OAAO,OAAO,IAAI,IAAI,OAAO,QAAQ;AACrD;AAAA,IACF;AACA,UAAM,UACJ,gBAAgB,OAAO,KAAK,MAAM,cAAc,OAAO,KAAK,MAAM,uBAAuB,YAAY;AACvG,eAAW,EAAE,OAAO,KAAK,SAAS,QAAQ,CAAC;AAC3C,aAAS,YAAY,WAAW,OAAO,cAAc,OAAO,OAAO,CAA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AW,YAAY,eAAe;AAAA,MACtC,WAAW,GAAG,aAAa,SAAS;AAAA,MAEnC;AAAA,kBAAU,OAAO,OAAO,oBAAC,WAAQ,WAAW,sBAAuB,mBAAS,OAAO,OAAM;AAAA,QACzF;AAAA,QAED,oBAAC,SAAK,GAAG,aAAa;AAAA;AAAA;AAAA,EACxB;AAEJ;","names":[]}
|
|
@@ -22,11 +22,15 @@
|
|
|
22
22
|
* account gets `invalid_credentials`, because a separate answer after a correct
|
|
23
23
|
* password would confirm a leaked one. It stays in the union only for a future server
|
|
24
24
|
* step that is past the password (an admin view, a signed-in refresh) and may say so.
|
|
25
|
+
* - `session_ended` — 0.34.0 (§11.2, decision 7; server-kit 0.8): every definitive
|
|
26
|
+
* refusal of `POST /auth/refresh`, a `401`. No form shows it, so it has no label: the
|
|
27
|
+
* kit's `attachSessionRefresh` decides by the STATUS, so an app whose server has not
|
|
28
|
+
* switched yet keeps working.
|
|
25
29
|
*/
|
|
26
|
-
type AuthErrorCode = "invalid_credentials" | "registration_closed" | "email_taken" | "invitation_invalid" | "invitation_expired" | "token_invalid"
|
|
27
|
-
/** 0.
|
|
30
|
+
export type AuthErrorCode = "invalid_credentials" | "registration_closed" | "email_taken" | "invitation_invalid" | "invitation_expired" | "token_invalid"
|
|
31
|
+
/** 0.30.0: a link that WAS valid and ran out (verification, reset) — keksdose's step-3
|
|
28
32
|
* refusals tell it from `token_invalid`, so a page can say "expired, ask for a new one". */
|
|
29
|
-
| "token_expired" | "account_inactive";
|
|
33
|
+
| "token_expired" | "account_inactive" | "session_ended";
|
|
30
34
|
/**
|
|
31
35
|
* 0.30.0: the coded refusals of user administration and the account's own settings
|
|
32
36
|
* (docs/user-admin-harmonization.md §4, §6) — server-kit 0.4.0's `AccountErrorCode`,
|
|
@@ -47,7 +51,7 @@ type AuthErrorCode = "invalid_credentials" | "registration_closed" | "email_take
|
|
|
47
51
|
* ended session and signs the user out, the wrong answer to a typo. Every other one
|
|
48
52
|
* is a `409`.
|
|
49
53
|
*/
|
|
50
|
-
type AccountErrorCode = "last_admin" | "self_action" | "other_companies" | "household_has_members" | "confirmation_required" | "confirmation_mismatch" | "password_incorrect";
|
|
54
|
+
export type AccountErrorCode = "last_admin" | "self_action" | "other_companies" | "household_has_members" | "confirmation_required" | "confirmation_mismatch" | "password_incorrect";
|
|
51
55
|
/**
|
|
52
56
|
* 0.31.0: the demo's coded refusals (docs/landing-demo-harmonization.md §6.2) —
|
|
53
57
|
* server-kit 0.5's `DemoErrorCode`, value for value, answered as `{detail, code}` like
|
|
@@ -62,7 +66,7 @@ type AccountErrorCode = "last_admin" | "self_action" | "other_companies" | "hous
|
|
|
62
66
|
* - `demo_refused` — `403`, both models: an action a demo never may — a way in or out,
|
|
63
67
|
* mail, uploads, the account export (§6.4).
|
|
64
68
|
*/
|
|
65
|
-
type DemoErrorCode = "demo_disabled" | "demo_rate_limited" | "demo_capacity" | "demo_not_ready" | "demo_read_only" | "demo_refused";
|
|
69
|
+
export type DemoErrorCode = "demo_disabled" | "demo_rate_limited" | "demo_capacity" | "demo_not_ready" | "demo_read_only" | "demo_refused";
|
|
66
70
|
/**
|
|
67
71
|
* 0.32.0: billing's coded refusals (docs/billing-harmonization.md §3.3, §3.4, §4, §12.3) —
|
|
68
72
|
* server-kit 0.6's `BillingError` and `PlanLimitError`, value for value, answered as
|
|
@@ -91,10 +95,10 @@ type DemoErrorCode = "demo_disabled" | "demo_rate_limited" | "demo_capacity" | "
|
|
|
91
95
|
* - `billing_plan_not_sold` — `422`: a checkout for a plan, currency or interval the
|
|
92
96
|
* catalogue doesn't sell.
|
|
93
97
|
*/
|
|
94
|
-
type BillingErrorCode = "billing_disabled" | "billing_read_only" | "plan_limit" | "billing_not_configured" | "billing_provider_unavailable" | "billing_not_at_provider" | "billing_already_subscribed" | "billing_plan_not_sold";
|
|
98
|
+
export type BillingErrorCode = "billing_disabled" | "billing_read_only" | "plan_limit" | "billing_not_configured" | "billing_provider_unavailable" | "billing_not_at_provider" | "billing_already_subscribed" | "billing_plan_not_sold";
|
|
95
99
|
/** Every code the kit reads: the sign-in refusals, the account ones (0.30.0), the demo's
|
|
96
100
|
* (0.31.0) and billing's (0.32.0). */
|
|
97
|
-
type KitErrorCode = AuthErrorCode | AccountErrorCode | DemoErrorCode | BillingErrorCode;
|
|
101
|
+
export type KitErrorCode = AuthErrorCode | AccountErrorCode | DemoErrorCode | BillingErrorCode;
|
|
98
102
|
/**
|
|
99
103
|
* The code an error carries — an {@link AuthErrorCode}, since 0.30.0 an
|
|
100
104
|
* {@link AccountErrorCode}, since 0.31.0 a {@link DemoErrorCode}, since 0.32.0 a
|
|
@@ -115,7 +119,7 @@ type KitErrorCode = AuthErrorCode | AccountErrorCode | DemoErrorCode | BillingEr
|
|
|
115
119
|
* read as a refusal. The HTTP status is not checked: the code is the contract, and the
|
|
116
120
|
* status differs per refusal (401, 402, 403, 404, 409, 410).
|
|
117
121
|
*/
|
|
118
|
-
declare function authErrorCode(err: unknown): KitErrorCode | undefined;
|
|
122
|
+
export declare function authErrorCode(err: unknown): KitErrorCode | undefined;
|
|
119
123
|
/**
|
|
120
124
|
* Whether `err` is a coded auth refusal — any of them, or the one named:
|
|
121
125
|
*
|
|
@@ -131,14 +135,14 @@ declare function authErrorCode(err: unknown): KitErrorCode | undefined;
|
|
|
131
135
|
* `isAuthError(err, "demo_read_only")`; since 0.32.0 billing's:
|
|
132
136
|
* `isAuthError(err, "billing_read_only")` (or {@link isBillingError}).
|
|
133
137
|
*/
|
|
134
|
-
declare function isAuthError(err: unknown, code?: KitErrorCode): boolean;
|
|
138
|
+
export declare function isAuthError(err: unknown, code?: KitErrorCode): boolean;
|
|
135
139
|
/**
|
|
136
140
|
* Whether `err` is one of billing's coded refusals (0.32.0, docs/billing-harmonization.md
|
|
137
141
|
* §10, §14.2) — any of them, or the one named. {@link isAuthError} answers the same for a
|
|
138
142
|
* named code; this one also answers "is it billing's at all", which an app's error
|
|
139
143
|
* handler asks before it decides between the write lock, a `PlanLimitNotice` and a toast.
|
|
140
144
|
*/
|
|
141
|
-
declare function isBillingError(err: unknown, code?: BillingErrorCode): boolean;
|
|
145
|
+
export declare function isBillingError(err: unknown, code?: BillingErrorCode): boolean;
|
|
142
146
|
/**
|
|
143
147
|
* The parsed body that carries a code, wherever {@link authErrorCode} would find it (in
|
|
144
148
|
* the same order) — the object with the `code`, so FastAPI's nested `detail` when the code
|
|
@@ -147,7 +151,21 @@ declare function isBillingError(err: unknown, code?: BillingErrorCode): boolean;
|
|
|
147
151
|
*
|
|
148
152
|
* @internal Not part of the barrel.
|
|
149
153
|
*/
|
|
150
|
-
declare function errorBodyWithCode(err: unknown, accept?: (code: unknown) => boolean): Record<string, unknown> | undefined;
|
|
154
|
+
export declare function errorBodyWithCode(err: unknown, accept?: (code: unknown) => boolean): Record<string, unknown> | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* The HTTP status a thrown error carries, wherever the apps' HTTP clients put it —
|
|
157
|
+
* without depending on any of them:
|
|
158
|
+
*
|
|
159
|
+
* 1. `err.response.status` — axios (all three apps' clients);
|
|
160
|
+
* 2. `err.status` — ofetch's `FetchError`, the generated OpenAPI clients' `ApiError`, and
|
|
161
|
+
* a `Response` thrown as it came;
|
|
162
|
+
* 3. `err.statusCode` — ofetch's alias, and Node-style errors.
|
|
163
|
+
*
|
|
164
|
+
* `undefined` when none is a whole number. Package-private — not re-exported from the
|
|
165
|
+
* barrel; {@link isRateLimited} and the session refresh's classifier read it (DUP-11,
|
|
166
|
+
* refactor audit 2026-10: the refresh carried its own copy of this probe).
|
|
167
|
+
*/
|
|
168
|
+
export declare function httpStatusOf(err: unknown): number | undefined;
|
|
151
169
|
/**
|
|
152
170
|
* Whether `err` is a throttled request — HTTP `429 Too Many Requests` (0.30.0, from the
|
|
153
171
|
* apps' 0.29 adoption: every app answered a throttled sign-in, sign-up or reset through
|
|
@@ -155,12 +173,7 @@ declare function errorBodyWithCode(err: unknown, accept?: (code: unknown) => boo
|
|
|
155
173
|
*
|
|
156
174
|
* A throttle carries no `code` in the contract — the STATUS is the answer, set by the
|
|
157
175
|
* apps' limiters (server-kit's `AuthLimiters`, keksdose's per-IP limit) — so this reads
|
|
158
|
-
* the status, wherever the apps' HTTP clients put it
|
|
159
|
-
*
|
|
160
|
-
* 1. `err.response.status` — axios (all three apps' clients);
|
|
161
|
-
* 2. `err.status` — ofetch's `FetchError`, the generated OpenAPI clients' `ApiError`, and
|
|
162
|
-
* a `Response` thrown as it came;
|
|
163
|
-
* 3. `err.statusCode` — ofetch's alias, and Node-style errors.
|
|
176
|
+
* the status, wherever the apps' HTTP clients put it ({@link httpStatusOf}).
|
|
164
177
|
*
|
|
165
178
|
* There is no `rate_limited` code: keksdose answers its 429s uncoded, with a
|
|
166
179
|
* `Retry-After` header, and the status is the one signal every limiter gives.
|
|
@@ -170,7 +183,7 @@ declare function errorBodyWithCode(err: unknown, accept?: (code: unknown) => boo
|
|
|
170
183
|
* and before their generic failure, so "Too many attempts. Try again in 30 s." (with
|
|
171
184
|
* {@link retryAfterSeconds}) or "… Wait a moment and try again." needs no app code.
|
|
172
185
|
*/
|
|
173
|
-
declare function isRateLimited(err: unknown): boolean;
|
|
186
|
+
export declare function isRateLimited(err: unknown): boolean;
|
|
174
187
|
/**
|
|
175
188
|
* How long a throttled request asks to wait, in whole seconds — its `Retry-After`
|
|
176
189
|
* header (0.30.0, keksdose: its 429s carry no code, only the header) — or `undefined`
|
|
@@ -187,7 +200,7 @@ declare function isRateLimited(err: unknown): boolean;
|
|
|
187
200
|
* again." A browser only exposes `Retry-After` to a cross-origin page when the server
|
|
188
201
|
* lists it in `Access-Control-Expose-Headers`.
|
|
189
202
|
*/
|
|
190
|
-
declare function retryAfterSeconds(err: unknown, now?: number | Date): number | undefined;
|
|
203
|
+
export declare function retryAfterSeconds(err: unknown, now?: number | Date): number | undefined;
|
|
191
204
|
/**
|
|
192
205
|
* The English of every `rateLimited` label (0.30.0): "Too many attempts. Try again in
|
|
193
206
|
* 30 s." with a wait under a minute, in whole minutes from one minute up (keksdose's
|
|
@@ -196,8 +209,6 @@ declare function retryAfterSeconds(err: unknown, now?: number | Date): number |
|
|
|
196
209
|
*
|
|
197
210
|
* @internal The namespaces' English; not part of the barrel.
|
|
198
211
|
*/
|
|
199
|
-
declare function englishRateLimited(seconds?: number): string;
|
|
212
|
+
export declare function englishRateLimited(seconds?: number): string;
|
|
200
213
|
/** "30 s", "2 min" — a wait in English, rounded up. @internal */
|
|
201
|
-
declare function englishWait(seconds: number): string;
|
|
202
|
-
|
|
203
|
-
export { type AccountErrorCode, type AuthErrorCode, type BillingErrorCode, type DemoErrorCode, type KitErrorCode, authErrorCode, englishRateLimited, englishWait, errorBodyWithCode, isAuthError, isBillingError, isRateLimited, retryAfterSeconds };
|
|
214
|
+
export declare function englishWait(seconds: number): string;
|
package/dist/auth/auth-errors.js
CHANGED
|
@@ -18,6 +18,7 @@ const CODES = /* @__PURE__ */ new Set([
|
|
|
18
18
|
"token_invalid",
|
|
19
19
|
"token_expired",
|
|
20
20
|
"account_inactive",
|
|
21
|
+
"session_ended",
|
|
21
22
|
"last_admin",
|
|
22
23
|
"self_action",
|
|
23
24
|
"other_companies",
|
|
@@ -67,11 +68,13 @@ function errorBodyWithCode(err, accept = (code) => known(code) !== void 0) {
|
|
|
67
68
|
function statusOf(value) {
|
|
68
69
|
return typeof value === "number" && Number.isInteger(value) ? value : void 0;
|
|
69
70
|
}
|
|
70
|
-
function
|
|
71
|
-
if (!isBag(err)) return
|
|
71
|
+
function httpStatusOf(err) {
|
|
72
|
+
if (!isBag(err)) return void 0;
|
|
72
73
|
const response = err.response;
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
return (isBag(response) ? statusOf(response.status) : void 0) ?? statusOf(err.status) ?? statusOf(err.statusCode);
|
|
75
|
+
}
|
|
76
|
+
function isRateLimited(err) {
|
|
77
|
+
return httpStatusOf(err) === 429;
|
|
75
78
|
}
|
|
76
79
|
function headerOf(headers, name) {
|
|
77
80
|
if (!isBag(headers)) return void 0;
|
|
@@ -117,6 +120,7 @@ export {
|
|
|
117
120
|
englishRateLimited,
|
|
118
121
|
englishWait,
|
|
119
122
|
errorBodyWithCode,
|
|
123
|
+
httpStatusOf,
|
|
120
124
|
isAuthError,
|
|
121
125
|
isBillingError,
|
|
122
126
|
isRateLimited,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/auth/auth-errors.ts"],"sourcesContent":["/**\n * The coded refusals of sign-in and sign-up (docs/auth-harmonization.md §5.2): every\n * refusal the auth routes answer carries a machine-readable `code`, and the pages\n * recognise the CODE, never the server's sentence.\n *\n * Today each app's pages print the server's `detail` string (keksdose's\n * `extractApiErrorMessage`), which is English on every locale and, on a credential\n * check, would be an account-enumeration oracle if it ever said more than one thing.\n * keksdose already keys one refusal on a code (`features/budgets/plan-limit.ts`,\n * `402 {detail, code: \"plan_budget_limit\"}`); §5.2 makes that the rule for auth. Each\n * app switches its server and its pages together (§9).\n *\n * - `invalid_credentials` — unknown address, wrong password AND deactivated account:\n * one answer, in the same time (§2.10). `401`.\n * - `registration_closed` — the sign-up gate refused the address. `403`.\n * - `email_taken` — an account with this address exists. `409`.\n * - `invitation_invalid`, `invitation_expired` — the `invite` token of a sign-up or an\n * accept (§4.4).\n * - `token_invalid` — a one-time token (reset, verification, a sign-in challenge) is\n * unknown, spent or expired.\n * - `account_inactive` — **no server answers it.** §2.10 decided that a deactivated\n * account gets `invalid_credentials`, because a separate answer after a correct\n * password would confirm a leaked one. It stays in the union only for a future server\n * step that is past the password (an admin view, a signed-in refresh) and may say so.\n */\nexport type AuthErrorCode =\n | \"invalid_credentials\"\n | \"registration_closed\"\n | \"email_taken\"\n | \"invitation_invalid\"\n | \"invitation_expired\"\n | \"token_invalid\"\n /** 0.29.1: a link that WAS valid and ran out (verification, reset) — keksdose's step-3\n * refusals tell it from `token_invalid`, so a page can say \"expired, ask for a new one\". */\n | \"token_expired\"\n | \"account_inactive\";\n\n/**\n * 0.30.0: the coded refusals of user administration and the account's own settings\n * (docs/user-admin-harmonization.md §4, §6) — server-kit 0.4.0's `AccountErrorCode`,\n * value for value. The same family of answer as the sign-in codes (`{detail, code}`,\n * plus `companies` on kastlan's `last_admin`), read by the same {@link authErrorCode}.\n *\n * - `last_admin` — the action would leave no active admin: deactivating, demoting or\n * deleting the last one (in kastlan, of a company; the answer names the `companies`).\n * - `self_action` — an admin acting on their own account where that is never allowed.\n * - `other_companies` — kastlan: the account belongs to other companies too, so a\n * company admin may not deactivate it; \"Remove from company\" instead (§9.6).\n * - `household_has_members` — keksdose's guard on a deletion request (§6.4).\n * - `confirmation_required`, `confirmation_mismatch` — the action's confirmation level\n * asked for a typed address (or a tick), and the request carried none, or another\n * address (§4.2).\n * - `password_incorrect` — the CURRENT password is wrong on a signed-in route (the email\n * change, the deletion request). `400`, not `401`: an app's client reads a 401 as an\n * ended session and signs the user out, the wrong answer to a typo. Every other one\n * is a `409`.\n */\nexport type AccountErrorCode =\n | \"last_admin\"\n | \"self_action\"\n | \"other_companies\"\n | \"household_has_members\"\n | \"confirmation_required\"\n | \"confirmation_mismatch\"\n | \"password_incorrect\";\n\n/**\n * 0.31.0: the demo's coded refusals (docs/landing-demo-harmonization.md §6.2) —\n * server-kit 0.5's `DemoErrorCode`, value for value, answered as `{detail, code}` like\n * the others and read by the same {@link authErrorCode}.\n *\n * - `demo_disabled` — `404`: the demo switch is off (it is \"not there\", not forbidden).\n * - `demo_rate_limited` — `429` with `Retry-After`: the per-IP window of demo starts.\n * - `demo_capacity` — `429`, no `Retry-After`: the cap of live demo users.\n * - `demo_not_ready` — `503`: the demo data has not been seeded yet.\n * - `demo_read_only` — `403`, model R: any write by a demo user. The app's write lock\n * already explains it, so it shows no toast (§5.4).\n * - `demo_refused` — `403`, both models: an action a demo never may — a way in or out,\n * mail, uploads, the account export (§6.4).\n */\nexport type DemoErrorCode =\n | \"demo_disabled\"\n | \"demo_rate_limited\"\n | \"demo_capacity\"\n | \"demo_not_ready\"\n | \"demo_read_only\"\n | \"demo_refused\";\n\n/**\n * 0.32.0: billing's coded refusals (docs/billing-harmonization.md §3.3, §3.4, §4, §12.3) —\n * server-kit 0.6's `BillingError` and `PlanLimitError`, value for value, answered as\n * `{detail, code}` like the others and read by the same {@link authErrorCode}.\n *\n * - `billing_disabled` — `404`: the billing switch is off (§2.9), so every billing route\n * but `GET /billing/status` is \"not there\", as a switched-off demo is.\n * - `billing_read_only` — `402`: a write by (or into the data of) a payer out of good\n * standing (§3.3, §12.1). Inside a sync reply it marks the changes that were refused\n * and not applied (§12.5). The app's write lock and banner already say why, so — like\n * `demo_read_only` — it needs no toast of its own.\n * - `plan_limit` — `402`: a create past the plan's limit (§3.4), with the extra fields\n * `dimension`, `plan`, `limit` and `used` — read them with `isPlanLimit`. A lapsed payer\n * creating gets `billing_read_only` instead, never this (§12.3).\n * - `billing_not_configured` — billing is switched on but the provider's settings are\n * missing (the secrets, a price id): the operator's mistake, not the payer's.\n *\n * 0.33.0 (server-kit 0.7, §14.2): the provider's refusals, with the `billing_` prefix of\n * the others (decision 22).\n * - `billing_provider_unavailable` — `502`: Paddle didn't answer, or refused the request.\n * Try again.\n * - `billing_not_at_provider` — `409`: a portal request before the payer reached the\n * provider (§14.5) — a stale page; the overview's `at_provider` says it first.\n * - `billing_already_subscribed` — `409`: a checkout while a provider subscription runs\n * (§14.6). Plan changes go through the portal.\n * - `billing_plan_not_sold` — `422`: a checkout for a plan, currency or interval the\n * catalogue doesn't sell.\n */\nexport type BillingErrorCode =\n | \"billing_disabled\"\n | \"billing_read_only\"\n | \"plan_limit\"\n | \"billing_not_configured\"\n | \"billing_provider_unavailable\"\n | \"billing_not_at_provider\"\n | \"billing_already_subscribed\"\n | \"billing_plan_not_sold\";\n\n/** Every code the kit reads: the sign-in refusals, the account ones (0.30.0), the demo's\n * (0.31.0) and billing's (0.32.0). */\nexport type KitErrorCode = AuthErrorCode | AccountErrorCode | DemoErrorCode | BillingErrorCode;\n\nconst BILLING_CODES: ReadonlySet<BillingErrorCode> = new Set<BillingErrorCode>([\n \"billing_disabled\",\n \"billing_read_only\",\n \"plan_limit\",\n \"billing_not_configured\",\n \"billing_provider_unavailable\",\n \"billing_not_at_provider\",\n \"billing_already_subscribed\",\n \"billing_plan_not_sold\",\n]);\n\nconst CODES: ReadonlySet<string> = new Set<KitErrorCode>([\n \"invalid_credentials\",\n \"registration_closed\",\n \"email_taken\",\n \"invitation_invalid\",\n \"invitation_expired\",\n \"token_invalid\",\n \"token_expired\",\n \"account_inactive\",\n \"last_admin\",\n \"self_action\",\n \"other_companies\",\n \"household_has_members\",\n \"confirmation_required\",\n \"confirmation_mismatch\",\n \"password_incorrect\",\n \"demo_disabled\",\n \"demo_rate_limited\",\n \"demo_capacity\",\n \"demo_not_ready\",\n \"demo_read_only\",\n \"demo_refused\",\n ...BILLING_CODES,\n]);\n\ntype Bag = Record<string, unknown>;\n\nconst isBag = (value: unknown): value is Bag => typeof value === \"object\" && value !== null;\n\n/** A known code, or undefined. */\nfunction known(value: unknown): KitErrorCode | undefined {\n return typeof value === \"string\" && CODES.has(value) ? (value as KitErrorCode) : undefined;\n}\n\n/** `{code}` on a parsed body, or FastAPI's `{detail: {code}}` — what an\n * `HTTPException(detail={\"code\": …})` serialises to. */\nfunction codeOfBody(body: unknown): KitErrorCode | undefined {\n if (!isBag(body)) return undefined;\n return known(body.code) ?? (isBag(body.detail) ? known(body.detail.code) : undefined);\n}\n\n/**\n * The code an error carries — an {@link AuthErrorCode}, since 0.30.0 an\n * {@link AccountErrorCode}, since 0.31.0 a {@link DemoErrorCode}, since 0.32.0 a\n * {@link BillingErrorCode} — or `undefined` when it carries none.\n *\n * Reads the parsed response body wherever the apps' HTTP clients put it, without\n * depending on any of them:\n *\n * 1. `err.response.data` — axios (keksdose's, kastlan's and Kurvenschmiede's clients;\n * keksdose's `isPlanBudgetLimitRefusal` reads the same path);\n * 2. `err.data` — ofetch's `FetchError`, and most `fetch` wrappers that parse the body;\n * 3. `err.body` — the generated OpenAPI clients' `ApiError`;\n * 4. `err` itself — a body thrown as it came (`throw await res.json()`).\n *\n * In each, `code` or FastAPI's nested `detail.code`. Last, `err.code` — but only when\n * it is one of the codes above: axios writes its OWN codes there (`ERR_NETWORK`,\n * `ECONNABORTED`, `ERR_BAD_REQUEST`), and so does Node, so an unknown value is never\n * read as a refusal. The HTTP status is not checked: the code is the contract, and the\n * status differs per refusal (401, 402, 403, 404, 409, 410).\n */\nexport function authErrorCode(err: unknown): KitErrorCode | undefined {\n if (!isBag(err)) return undefined;\n const response = err.response;\n return (\n (isBag(response) ? codeOfBody(response.data) : undefined) ??\n codeOfBody(err.data) ??\n codeOfBody(err.body) ??\n codeOfBody(err)\n );\n}\n\n/**\n * Whether `err` is a coded auth refusal — any of them, or the one named:\n *\n * ```ts\n * try { await api.register(values) }\n * catch (err) { if (isAuthError(err, \"email_taken\")) … }\n * ```\n *\n * The kit's `SignInForm` and `RegisterForm` call it on what their callbacks reject\n * with, so an app's `onSubmit` can simply let its client's error through. See\n * {@link authErrorCode} for the shapes it reads. Since 0.30.0 it knows the account codes\n * too: `isAuthError(err, \"last_admin\")`; since 0.31.0 the demo's:\n * `isAuthError(err, \"demo_read_only\")`; since 0.32.0 billing's:\n * `isAuthError(err, \"billing_read_only\")` (or {@link isBillingError}).\n */\nexport function isAuthError(err: unknown, code?: KitErrorCode): boolean {\n const found = authErrorCode(err);\n return found !== undefined && (code === undefined || found === code);\n}\n\n/**\n * Whether `err` is one of billing's coded refusals (0.32.0, docs/billing-harmonization.md\n * §10, §14.2) — any of them, or the one named. {@link isAuthError} answers the same for a\n * named code; this one also answers \"is it billing's at all\", which an app's error\n * handler asks before it decides between the write lock, a `PlanLimitNotice` and a toast.\n */\nexport function isBillingError(err: unknown, code?: BillingErrorCode): boolean {\n const found = authErrorCode(err);\n return found !== undefined && BILLING_CODES.has(found as BillingErrorCode) && (code === undefined || found === code);\n}\n\n/**\n * The parsed body that carries a code, wherever {@link authErrorCode} would find it (in\n * the same order) — the object with the `code`, so FastAPI's nested `detail` when the code\n * is there. For a reader of a refusal's EXTRA fields (`isPlanLimit`: `dimension`, `limit`,\n * `used` sit beside the code). `accept` decides which codes count; default, the known ones.\n *\n * @internal Not part of the barrel.\n */\nexport function errorBodyWithCode(\n err: unknown,\n accept: (code: unknown) => boolean = (code) => known(code) !== undefined,\n): Record<string, unknown> | undefined {\n if (!isBag(err)) return undefined;\n const response = err.response;\n for (const body of [isBag(response) ? response.data : undefined, err.data, err.body, err]) {\n if (!isBag(body)) continue;\n if (accept(body.code)) return body;\n if (isBag(body.detail) && accept(body.detail.code)) return body.detail;\n }\n return undefined;\n}\n\n/** An HTTP status as a number, or undefined. */\nfunction statusOf(value: unknown): number | undefined {\n return typeof value === \"number\" && Number.isInteger(value) ? value : undefined;\n}\n\n/**\n * Whether `err` is a throttled request — HTTP `429 Too Many Requests` (0.30.0, from the\n * apps' 0.29 adoption: every app answered a throttled sign-in, sign-up or reset through\n * its own `describeError`, with three wordings of one sentence).\n *\n * A throttle carries no `code` in the contract — the STATUS is the answer, set by the\n * apps' limiters (server-kit's `AuthLimiters`, keksdose's per-IP limit) — so this reads\n * the status, wherever the apps' HTTP clients put it, without depending on any of them:\n *\n * 1. `err.response.status` — axios (all three apps' clients);\n * 2. `err.status` — ofetch's `FetchError`, the generated OpenAPI clients' `ApiError`, and\n * a `Response` thrown as it came;\n * 3. `err.statusCode` — ofetch's alias, and Node-style errors.\n *\n * There is no `rate_limited` code: keksdose answers its 429s uncoded, with a\n * `Retry-After` header, and the status is the one signal every limiter gives.\n *\n * The kit's `SignInForm`, `RegisterForm`, `ForgotPasswordForm` and `ResetPasswordForm`\n * call it AFTER the app's `describeError` — an app with words of its own keeps them —\n * and before their generic failure, so \"Too many attempts. Try again in 30 s.\" (with\n * {@link retryAfterSeconds}) or \"… Wait a moment and try again.\" needs no app code.\n */\nexport function isRateLimited(err: unknown): boolean {\n if (!isBag(err)) return false;\n const response = err.response;\n const status =\n (isBag(response) ? statusOf(response.status) : undefined) ?? statusOf(err.status) ?? statusOf(err.statusCode);\n return status === 429;\n}\n\n/** A header's value from a `Headers` (fetch, ofetch's `response`), axios' `AxiosHeaders`\n * or a plain record — whose keys may come in any case. */\nfunction headerOf(headers: unknown, name: string): unknown {\n if (!isBag(headers)) return undefined;\n if (typeof headers.get === \"function\") {\n try {\n const value: unknown = (headers.get as (key: string) => unknown).call(headers, name);\n if (value !== undefined && value !== null) return value;\n } catch {\n // A `get` that is not a header lookup; the record below is.\n }\n }\n for (const [key, value] of Object.entries(headers)) {\n if (key.toLowerCase() === name) return value;\n }\n return undefined;\n}\n\n/** `Retry-After` as seconds from `now`: delta-seconds (\"30\"), or an HTTP date\n * (\"Wed, 07 Oct 2026 10:00:00 GMT\") counted from now, never below 0 (RFC 9110 §10.2.3). */\nfunction parseRetryAfter(value: unknown, now: number): number | undefined {\n const raw = Array.isArray(value) ? (value as unknown[])[0] : value;\n if (typeof raw === \"number\") return Number.isFinite(raw) && raw >= 0 ? Math.ceil(raw) : undefined;\n if (typeof raw !== \"string\") return undefined;\n const text = raw.trim();\n if (/^\\d+$/.test(text)) return Number(text);\n // An HTTP date names its day and month (\"Wed, 07 Oct 2026 …\"). Without a letter it is\n // a malformed number (\"-5\", \"1.5\"), which `Date.parse` would happily read as a year.\n if (!/[a-z]/i.test(text)) return undefined;\n const at = Date.parse(text);\n if (Number.isNaN(at)) return undefined;\n return Math.max(0, Math.ceil((at - now) / 1000));\n}\n\n/**\n * How long a throttled request asks to wait, in whole seconds — its `Retry-After`\n * header (0.30.0, keksdose: its 429s carry no code, only the header) — or `undefined`\n * when there is none, or none that parses.\n *\n * Read where the apps' clients keep the response headers, without depending on any of\n * them: `err.response.headers` (axios' `AxiosHeaders` or a plain record; ofetch's\n * `FetchError.response`, a fetch `Headers`), then `err.headers` (a `Response` thrown as\n * it came). The value is delta-seconds, or an HTTP date turned into seconds from `now`\n * (default: the present moment) — never below 0.\n *\n * The forms hand it to their `rateLimited` label when {@link isRateLimited} is true:\n * \"Too many attempts. Try again in 30 s.\" — and, without one, \"… Wait a moment and try\n * again.\" A browser only exposes `Retry-After` to a cross-origin page when the server\n * lists it in `Access-Control-Expose-Headers`.\n */\nexport function retryAfterSeconds(err: unknown, now: number | Date = Date.now()): number | undefined {\n if (!isBag(err)) return undefined;\n const at = typeof now === \"number\" ? now : now.getTime();\n const response = err.response;\n const value =\n (isBag(response) ? headerOf(response.headers, \"retry-after\") : undefined) ?? headerOf(err.headers, \"retry-after\");\n return value === undefined ? undefined : parseRetryAfter(value, at);\n}\n\n/**\n * The English of every `rateLimited` label (0.30.0): \"Too many attempts. Try again in\n * 30 s.\" with a wait under a minute, in whole minutes from one minute up (keksdose's\n * reset throttle answers in hours, and \"3600 s\" is a number nobody reads), and \"Wait a\n * moment and try again.\" without one — or with a `0`.\n *\n * @internal The namespaces' English; not part of the barrel.\n */\nexport function englishRateLimited(seconds?: number): string {\n if (!seconds || seconds <= 0) return \"Too many attempts. Wait a moment and try again.\";\n return `Too many attempts. Try again in ${englishWait(seconds)}.`;\n}\n\n/** \"30 s\", \"2 min\" — a wait in English, rounded up. @internal */\nexport function englishWait(seconds: number): string {\n return seconds < 60 ? `${Math.ceil(seconds)} s` : `${Math.ceil(seconds / 60)} min`;\n}\n"],"mappings":";AAkIA,MAAM,gBAA+C,oBAAI,IAAsB;AAAA,EAC7E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,MAAM,QAA6B,oBAAI,IAAkB;AAAA,EACvD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,CAAC;AAID,MAAM,QAAQ,CAAC,UAAiC,OAAO,UAAU,YAA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,GAAG,EAAG,QAAO;AACxB,QAAM,KAAK,OAAO,QAAQ,WAAW,MAAM,IAAI,QAAQ;AACvD,QAAM,WAAW,IAAI;AACrB,QAAM,SACH,MAAM,QAAQ,IAAI,SAAS,SAAS,SAAS,aAAa,IAAI,WAAc,SAAS,IAAI,SAAS,aAAa;AAClH,SAAO,UAAU,SAAY,SAAY,gBAAgB,OAAO,EAAE;AACpE;AAUO,SAAS,mBAAmB,SAA0B;AAC3D,MAAI,CAAC,WAAW,WAAW,EAAG,QAAO;AACrC,SAAO,mCAAmC,YAAY,OAAO,CAAC;AAChE;AAGO,SAAS,YAAY,SAAyB;AACnD,SAAO,UAAU,KAAK,GAAG,KAAK,KAAK,OAAO,CAAC,OAAO,GAAG,KAAK,KAAK,UAAU,EAAE,CAAC;AAC9E;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/auth/auth-errors.ts"],"sourcesContent":["/**\n * The coded refusals of sign-in and sign-up (docs/auth-harmonization.md §5.2): every\n * refusal the auth routes answer carries a machine-readable `code`, and the pages\n * recognise the CODE, never the server's sentence.\n *\n * Today each app's pages print the server's `detail` string (keksdose's\n * `extractApiErrorMessage`), which is English on every locale and, on a credential\n * check, would be an account-enumeration oracle if it ever said more than one thing.\n * keksdose already keys one refusal on a code (`features/budgets/plan-limit.ts`,\n * `402 {detail, code: \"plan_budget_limit\"}`); §5.2 makes that the rule for auth. Each\n * app switches its server and its pages together (§9).\n *\n * - `invalid_credentials` — unknown address, wrong password AND deactivated account:\n * one answer, in the same time (§2.10). `401`.\n * - `registration_closed` — the sign-up gate refused the address. `403`.\n * - `email_taken` — an account with this address exists. `409`.\n * - `invitation_invalid`, `invitation_expired` — the `invite` token of a sign-up or an\n * accept (§4.4).\n * - `token_invalid` — a one-time token (reset, verification, a sign-in challenge) is\n * unknown, spent or expired.\n * - `account_inactive` — **no server answers it.** §2.10 decided that a deactivated\n * account gets `invalid_credentials`, because a separate answer after a correct\n * password would confirm a leaked one. It stays in the union only for a future server\n * step that is past the password (an admin view, a signed-in refresh) and may say so.\n * - `session_ended` — 0.34.0 (§11.2, decision 7; server-kit 0.8): every definitive\n * refusal of `POST /auth/refresh`, a `401`. No form shows it, so it has no label: the\n * kit's `attachSessionRefresh` decides by the STATUS, so an app whose server has not\n * switched yet keeps working.\n */\nexport type AuthErrorCode =\n | \"invalid_credentials\"\n | \"registration_closed\"\n | \"email_taken\"\n | \"invitation_invalid\"\n | \"invitation_expired\"\n | \"token_invalid\"\n /** 0.30.0: a link that WAS valid and ran out (verification, reset) — keksdose's step-3\n * refusals tell it from `token_invalid`, so a page can say \"expired, ask for a new one\". */\n | \"token_expired\"\n | \"account_inactive\"\n | \"session_ended\";\n\n/**\n * 0.30.0: the coded refusals of user administration and the account's own settings\n * (docs/user-admin-harmonization.md §4, §6) — server-kit 0.4.0's `AccountErrorCode`,\n * value for value. The same family of answer as the sign-in codes (`{detail, code}`,\n * plus `companies` on kastlan's `last_admin`), read by the same {@link authErrorCode}.\n *\n * - `last_admin` — the action would leave no active admin: deactivating, demoting or\n * deleting the last one (in kastlan, of a company; the answer names the `companies`).\n * - `self_action` — an admin acting on their own account where that is never allowed.\n * - `other_companies` — kastlan: the account belongs to other companies too, so a\n * company admin may not deactivate it; \"Remove from company\" instead (§9.6).\n * - `household_has_members` — keksdose's guard on a deletion request (§6.4).\n * - `confirmation_required`, `confirmation_mismatch` — the action's confirmation level\n * asked for a typed address (or a tick), and the request carried none, or another\n * address (§4.2).\n * - `password_incorrect` — the CURRENT password is wrong on a signed-in route (the email\n * change, the deletion request). `400`, not `401`: an app's client reads a 401 as an\n * ended session and signs the user out, the wrong answer to a typo. Every other one\n * is a `409`.\n */\nexport type AccountErrorCode =\n | \"last_admin\"\n | \"self_action\"\n | \"other_companies\"\n | \"household_has_members\"\n | \"confirmation_required\"\n | \"confirmation_mismatch\"\n | \"password_incorrect\";\n\n/**\n * 0.31.0: the demo's coded refusals (docs/landing-demo-harmonization.md §6.2) —\n * server-kit 0.5's `DemoErrorCode`, value for value, answered as `{detail, code}` like\n * the others and read by the same {@link authErrorCode}.\n *\n * - `demo_disabled` — `404`: the demo switch is off (it is \"not there\", not forbidden).\n * - `demo_rate_limited` — `429` with `Retry-After`: the per-IP window of demo starts.\n * - `demo_capacity` — `429`, no `Retry-After`: the cap of live demo users.\n * - `demo_not_ready` — `503`: the demo data has not been seeded yet.\n * - `demo_read_only` — `403`, model R: any write by a demo user. The app's write lock\n * already explains it, so it shows no toast (§5.4).\n * - `demo_refused` — `403`, both models: an action a demo never may — a way in or out,\n * mail, uploads, the account export (§6.4).\n */\nexport type DemoErrorCode =\n | \"demo_disabled\"\n | \"demo_rate_limited\"\n | \"demo_capacity\"\n | \"demo_not_ready\"\n | \"demo_read_only\"\n | \"demo_refused\";\n\n/**\n * 0.32.0: billing's coded refusals (docs/billing-harmonization.md §3.3, §3.4, §4, §12.3) —\n * server-kit 0.6's `BillingError` and `PlanLimitError`, value for value, answered as\n * `{detail, code}` like the others and read by the same {@link authErrorCode}.\n *\n * - `billing_disabled` — `404`: the billing switch is off (§2.9), so every billing route\n * but `GET /billing/status` is \"not there\", as a switched-off demo is.\n * - `billing_read_only` — `402`: a write by (or into the data of) a payer out of good\n * standing (§3.3, §12.1). Inside a sync reply it marks the changes that were refused\n * and not applied (§12.5). The app's write lock and banner already say why, so — like\n * `demo_read_only` — it needs no toast of its own.\n * - `plan_limit` — `402`: a create past the plan's limit (§3.4), with the extra fields\n * `dimension`, `plan`, `limit` and `used` — read them with `isPlanLimit`. A lapsed payer\n * creating gets `billing_read_only` instead, never this (§12.3).\n * - `billing_not_configured` — billing is switched on but the provider's settings are\n * missing (the secrets, a price id): the operator's mistake, not the payer's.\n *\n * 0.33.0 (server-kit 0.7, §14.2): the provider's refusals, with the `billing_` prefix of\n * the others (decision 22).\n * - `billing_provider_unavailable` — `502`: Paddle didn't answer, or refused the request.\n * Try again.\n * - `billing_not_at_provider` — `409`: a portal request before the payer reached the\n * provider (§14.5) — a stale page; the overview's `at_provider` says it first.\n * - `billing_already_subscribed` — `409`: a checkout while a provider subscription runs\n * (§14.6). Plan changes go through the portal.\n * - `billing_plan_not_sold` — `422`: a checkout for a plan, currency or interval the\n * catalogue doesn't sell.\n */\nexport type BillingErrorCode =\n | \"billing_disabled\"\n | \"billing_read_only\"\n | \"plan_limit\"\n | \"billing_not_configured\"\n | \"billing_provider_unavailable\"\n | \"billing_not_at_provider\"\n | \"billing_already_subscribed\"\n | \"billing_plan_not_sold\";\n\n/** Every code the kit reads: the sign-in refusals, the account ones (0.30.0), the demo's\n * (0.31.0) and billing's (0.32.0). */\nexport type KitErrorCode = AuthErrorCode | AccountErrorCode | DemoErrorCode | BillingErrorCode;\n\nconst BILLING_CODES: ReadonlySet<BillingErrorCode> = new Set<BillingErrorCode>([\n \"billing_disabled\",\n \"billing_read_only\",\n \"plan_limit\",\n \"billing_not_configured\",\n \"billing_provider_unavailable\",\n \"billing_not_at_provider\",\n \"billing_already_subscribed\",\n \"billing_plan_not_sold\",\n]);\n\nconst CODES: ReadonlySet<string> = new Set<KitErrorCode>([\n \"invalid_credentials\",\n \"registration_closed\",\n \"email_taken\",\n \"invitation_invalid\",\n \"invitation_expired\",\n \"token_invalid\",\n \"token_expired\",\n \"account_inactive\",\n \"session_ended\",\n \"last_admin\",\n \"self_action\",\n \"other_companies\",\n \"household_has_members\",\n \"confirmation_required\",\n \"confirmation_mismatch\",\n \"password_incorrect\",\n \"demo_disabled\",\n \"demo_rate_limited\",\n \"demo_capacity\",\n \"demo_not_ready\",\n \"demo_read_only\",\n \"demo_refused\",\n ...BILLING_CODES,\n]);\n\ntype Bag = Record<string, unknown>;\n\nconst isBag = (value: unknown): value is Bag => typeof value === \"object\" && value !== null;\n\n/** A known code, or undefined. */\nfunction known(value: unknown): KitErrorCode | undefined {\n return typeof value === \"string\" && CODES.has(value) ? (value as KitErrorCode) : undefined;\n}\n\n/** `{code}` on a parsed body, or FastAPI's `{detail: {code}}` — what an\n * `HTTPException(detail={\"code\": …})` serialises to. */\nfunction codeOfBody(body: unknown): KitErrorCode | undefined {\n if (!isBag(body)) return undefined;\n return known(body.code) ?? (isBag(body.detail) ? known(body.detail.code) : undefined);\n}\n\n/**\n * The code an error carries — an {@link AuthErrorCode}, since 0.30.0 an\n * {@link AccountErrorCode}, since 0.31.0 a {@link DemoErrorCode}, since 0.32.0 a\n * {@link BillingErrorCode} — or `undefined` when it carries none.\n *\n * Reads the parsed response body wherever the apps' HTTP clients put it, without\n * depending on any of them:\n *\n * 1. `err.response.data` — axios (keksdose's, kastlan's and Kurvenschmiede's clients;\n * keksdose's `isPlanBudgetLimitRefusal` reads the same path);\n * 2. `err.data` — ofetch's `FetchError`, and most `fetch` wrappers that parse the body;\n * 3. `err.body` — the generated OpenAPI clients' `ApiError`;\n * 4. `err` itself — a body thrown as it came (`throw await res.json()`).\n *\n * In each, `code` or FastAPI's nested `detail.code`. Last, `err.code` — but only when\n * it is one of the codes above: axios writes its OWN codes there (`ERR_NETWORK`,\n * `ECONNABORTED`, `ERR_BAD_REQUEST`), and so does Node, so an unknown value is never\n * read as a refusal. The HTTP status is not checked: the code is the contract, and the\n * status differs per refusal (401, 402, 403, 404, 409, 410).\n */\nexport function authErrorCode(err: unknown): KitErrorCode | undefined {\n if (!isBag(err)) return undefined;\n const response = err.response;\n return (\n (isBag(response) ? codeOfBody(response.data) : undefined) ??\n codeOfBody(err.data) ??\n codeOfBody(err.body) ??\n codeOfBody(err)\n );\n}\n\n/**\n * Whether `err` is a coded auth refusal — any of them, or the one named:\n *\n * ```ts\n * try { await api.register(values) }\n * catch (err) { if (isAuthError(err, \"email_taken\")) … }\n * ```\n *\n * The kit's `SignInForm` and `RegisterForm` call it on what their callbacks reject\n * with, so an app's `onSubmit` can simply let its client's error through. See\n * {@link authErrorCode} for the shapes it reads. Since 0.30.0 it knows the account codes\n * too: `isAuthError(err, \"last_admin\")`; since 0.31.0 the demo's:\n * `isAuthError(err, \"demo_read_only\")`; since 0.32.0 billing's:\n * `isAuthError(err, \"billing_read_only\")` (or {@link isBillingError}).\n */\nexport function isAuthError(err: unknown, code?: KitErrorCode): boolean {\n const found = authErrorCode(err);\n return found !== undefined && (code === undefined || found === code);\n}\n\n/**\n * Whether `err` is one of billing's coded refusals (0.32.0, docs/billing-harmonization.md\n * §10, §14.2) — any of them, or the one named. {@link isAuthError} answers the same for a\n * named code; this one also answers \"is it billing's at all\", which an app's error\n * handler asks before it decides between the write lock, a `PlanLimitNotice` and a toast.\n */\nexport function isBillingError(err: unknown, code?: BillingErrorCode): boolean {\n const found = authErrorCode(err);\n return found !== undefined && BILLING_CODES.has(found as BillingErrorCode) && (code === undefined || found === code);\n}\n\n/**\n * The parsed body that carries a code, wherever {@link authErrorCode} would find it (in\n * the same order) — the object with the `code`, so FastAPI's nested `detail` when the code\n * is there. For a reader of a refusal's EXTRA fields (`isPlanLimit`: `dimension`, `limit`,\n * `used` sit beside the code). `accept` decides which codes count; default, the known ones.\n *\n * @internal Not part of the barrel.\n */\nexport function errorBodyWithCode(\n err: unknown,\n accept: (code: unknown) => boolean = (code) => known(code) !== undefined,\n): Record<string, unknown> | undefined {\n if (!isBag(err)) return undefined;\n const response = err.response;\n for (const body of [isBag(response) ? response.data : undefined, err.data, err.body, err]) {\n if (!isBag(body)) continue;\n if (accept(body.code)) return body;\n if (isBag(body.detail) && accept(body.detail.code)) return body.detail;\n }\n return undefined;\n}\n\n/** An HTTP status as a number, or undefined. */\nfunction statusOf(value: unknown): number | undefined {\n return typeof value === \"number\" && Number.isInteger(value) ? value : undefined;\n}\n\n/**\n * The HTTP status a thrown error carries, wherever the apps' HTTP clients put it —\n * without depending on any of them:\n *\n * 1. `err.response.status` — axios (all three apps' clients);\n * 2. `err.status` — ofetch's `FetchError`, the generated OpenAPI clients' `ApiError`, and\n * a `Response` thrown as it came;\n * 3. `err.statusCode` — ofetch's alias, and Node-style errors.\n *\n * `undefined` when none is a whole number. Package-private — not re-exported from the\n * barrel; {@link isRateLimited} and the session refresh's classifier read it (DUP-11,\n * refactor audit 2026-10: the refresh carried its own copy of this probe).\n */\nexport function httpStatusOf(err: unknown): number | undefined {\n if (!isBag(err)) return undefined;\n const response = err.response;\n return (isBag(response) ? statusOf(response.status) : undefined) ?? statusOf(err.status) ?? statusOf(err.statusCode);\n}\n\n/**\n * Whether `err` is a throttled request — HTTP `429 Too Many Requests` (0.30.0, from the\n * apps' 0.29 adoption: every app answered a throttled sign-in, sign-up or reset through\n * its own `describeError`, with three wordings of one sentence).\n *\n * A throttle carries no `code` in the contract — the STATUS is the answer, set by the\n * apps' limiters (server-kit's `AuthLimiters`, keksdose's per-IP limit) — so this reads\n * the status, wherever the apps' HTTP clients put it ({@link httpStatusOf}).\n *\n * There is no `rate_limited` code: keksdose answers its 429s uncoded, with a\n * `Retry-After` header, and the status is the one signal every limiter gives.\n *\n * The kit's `SignInForm`, `RegisterForm`, `ForgotPasswordForm` and `ResetPasswordForm`\n * call it AFTER the app's `describeError` — an app with words of its own keeps them —\n * and before their generic failure, so \"Too many attempts. Try again in 30 s.\" (with\n * {@link retryAfterSeconds}) or \"… Wait a moment and try again.\" needs no app code.\n */\nexport function isRateLimited(err: unknown): boolean {\n return httpStatusOf(err) === 429;\n}\n\n/** A header's value from a `Headers` (fetch, ofetch's `response`), axios' `AxiosHeaders`\n * or a plain record — whose keys may come in any case. */\nfunction headerOf(headers: unknown, name: string): unknown {\n if (!isBag(headers)) return undefined;\n if (typeof headers.get === \"function\") {\n try {\n const value: unknown = (headers.get as (key: string) => unknown).call(headers, name);\n if (value !== undefined && value !== null) return value;\n } catch {\n // A `get` that is not a header lookup; the record below is.\n }\n }\n for (const [key, value] of Object.entries(headers)) {\n if (key.toLowerCase() === name) return value;\n }\n return undefined;\n}\n\n/** `Retry-After` as seconds from `now`: delta-seconds (\"30\"), or an HTTP date\n * (\"Wed, 07 Oct 2026 10:00:00 GMT\") counted from now, never below 0 (RFC 9110 §10.2.3). */\nfunction parseRetryAfter(value: unknown, now: number): number | undefined {\n const raw = Array.isArray(value) ? (value as unknown[])[0] : value;\n if (typeof raw === \"number\") return Number.isFinite(raw) && raw >= 0 ? Math.ceil(raw) : undefined;\n if (typeof raw !== \"string\") return undefined;\n const text = raw.trim();\n if (/^\\d+$/.test(text)) return Number(text);\n // An HTTP date names its day and month (\"Wed, 07 Oct 2026 …\"). Without a letter it is\n // a malformed number (\"-5\", \"1.5\"), which `Date.parse` would happily read as a year.\n if (!/[a-z]/i.test(text)) return undefined;\n const at = Date.parse(text);\n if (Number.isNaN(at)) return undefined;\n return Math.max(0, Math.ceil((at - now) / 1000));\n}\n\n/**\n * How long a throttled request asks to wait, in whole seconds — its `Retry-After`\n * header (0.30.0, keksdose: its 429s carry no code, only the header) — or `undefined`\n * when there is none, or none that parses.\n *\n * Read where the apps' clients keep the response headers, without depending on any of\n * them: `err.response.headers` (axios' `AxiosHeaders` or a plain record; ofetch's\n * `FetchError.response`, a fetch `Headers`), then `err.headers` (a `Response` thrown as\n * it came). The value is delta-seconds, or an HTTP date turned into seconds from `now`\n * (default: the present moment) — never below 0.\n *\n * The forms hand it to their `rateLimited` label when {@link isRateLimited} is true:\n * \"Too many attempts. Try again in 30 s.\" — and, without one, \"… Wait a moment and try\n * again.\" A browser only exposes `Retry-After` to a cross-origin page when the server\n * lists it in `Access-Control-Expose-Headers`.\n */\nexport function retryAfterSeconds(err: unknown, now: number | Date = Date.now()): number | undefined {\n if (!isBag(err)) return undefined;\n const at = typeof now === \"number\" ? now : now.getTime();\n const response = err.response;\n const value =\n (isBag(response) ? headerOf(response.headers, \"retry-after\") : undefined) ?? headerOf(err.headers, \"retry-after\");\n return value === undefined ? undefined : parseRetryAfter(value, at);\n}\n\n/**\n * The English of every `rateLimited` label (0.30.0): \"Too many attempts. Try again in\n * 30 s.\" with a wait under a minute, in whole minutes from one minute up (keksdose's\n * reset throttle answers in hours, and \"3600 s\" is a number nobody reads), and \"Wait a\n * moment and try again.\" without one — or with a `0`.\n *\n * @internal The namespaces' English; not part of the barrel.\n */\nexport function englishRateLimited(seconds?: number): string {\n if (!seconds || seconds <= 0) return \"Too many attempts. Wait a moment and try again.\";\n return `Too many attempts. Try again in ${englishWait(seconds)}.`;\n}\n\n/** \"30 s\", \"2 min\" — a wait in English, rounded up. @internal */\nexport function englishWait(seconds: number): string {\n return seconds < 60 ? `${Math.ceil(seconds)} s` : `${Math.ceil(seconds / 60)} min`;\n}\n"],"mappings":";AAuIA,MAAM,gBAA+C,oBAAI,IAAsB;AAAA,EAC7E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,MAAM,QAA6B,oBAAI,IAAkB;AAAA,EACvD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,CAAC;AAID,MAAM,QAAQ,CAAC,UAAiC,OAAO,UAAU,YAAY,UAAU;AAGvF,SAAS,MAAM,OAA0C;AACvD,SAAO,OAAO,UAAU,YAAY,MAAM,IAAI,KAAK,IAAK,QAAyB;AACnF;AAIA,SAAS,WAAW,MAAyC;AAC3D,MAAI,CAAC,MAAM,IAAI,EAAG,QAAO;AACzB,SAAO,MAAM,KAAK,IAAI,MAAM,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,OAAO,IAAI,IAAI;AAC7E;AAsBO,SAAS,cAAc,KAAwC;AACpE,MAAI,CAAC,MAAM,GAAG,EAAG,QAAO;AACxB,QAAM,WAAW,IAAI;AACrB,UACG,MAAM,QAAQ,IAAI,WAAW,SAAS,IAAI,IAAI,WAC/C,WAAW,IAAI,IAAI,KACnB,WAAW,IAAI,IAAI,KACnB,WAAW,GAAG;AAElB;AAiBO,SAAS,YAAY,KAAc,MA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