@eifi1/ui-kit 0.31.1 → 0.32.1
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 +51 -28
- package/dist/account/delete-account-setting.d.ts +8 -3
- package/dist/admin/admin-action-confirm.d.ts +8 -3
- package/dist/admin/admin-action-log.d.ts +1 -1
- package/dist/admin/admin-action-log.js +4 -2
- package/dist/admin/admin-action-log.js.map +1 -1
- package/dist/admin/invitations-panel.d.ts +8 -3
- package/dist/admin/invitations-panel.js +29 -26
- package/dist/admin/invitations-panel.js.map +1 -1
- package/dist/admin/reviewer-scope-editor.d.ts +8 -3
- package/dist/admin/role-select.d.ts +10 -5
- package/dist/admin/transfer-ownership-dialog.d.ts +8 -3
- package/dist/admin/user-roster.d.ts +10 -5
- package/dist/admin/user-roster.js +8 -47
- package/dist/admin/user-roster.js.map +1 -1
- package/dist/auth/auth-errors.d.ts +43 -8
- package/dist/auth/auth-errors.js +24 -1
- package/dist/auth/auth-errors.js.map +1 -1
- package/dist/auth/register-form.d.ts +8 -3
- package/dist/billing/billing-banner.d.ts +184 -0
- package/dist/billing/billing-banner.js +98 -0
- package/dist/billing/billing-banner.js.map +1 -0
- package/dist/billing/billing-labels.d.ts +100 -0
- package/dist/billing/billing-labels.js +76 -0
- package/dist/billing/billing-labels.js.map +1 -0
- package/dist/billing/billing-lock.d.ts +158 -0
- package/dist/billing/billing-lock.js +17 -0
- package/dist/billing/billing-lock.js.map +1 -0
- package/dist/billing/billing-standing.d.ts +149 -0
- package/dist/billing/billing-standing.js +28 -0
- package/dist/billing/billing-standing.js.map +1 -0
- package/dist/billing/plan-card.d.ts +248 -0
- package/dist/billing/plan-card.js +248 -0
- package/dist/billing/plan-card.js.map +1 -0
- package/dist/billing/plan-limit-notice.d.ts +156 -0
- package/dist/billing/plan-limit-notice.js +76 -0
- package/dist/billing/plan-limit-notice.js.map +1 -0
- package/dist/billing/plan-limit.d.ts +34 -0
- package/dist/billing/plan-limit.js +20 -0
- package/dist/billing/plan-limit.js.map +1 -0
- package/dist/billing/plan-price.d.ts +61 -0
- package/dist/billing/plan-price.js +45 -0
- package/dist/billing/plan-price.js.map +1 -0
- package/dist/billing/subscription-actions.d.ts +133 -0
- package/dist/billing/subscription-actions.js +28 -0
- package/dist/billing/subscription-actions.js.map +1 -0
- package/dist/billing/subscription-status-chip.d.ts +149 -0
- package/dist/billing/subscription-status-chip.js +48 -0
- package/dist/billing/subscription-status-chip.js.map +1 -0
- package/dist/chart.d.ts +9 -3
- package/dist/chart.js.map +1 -1
- package/dist/components/account-chips.d.ts +16 -4
- package/dist/components/account-chips.js +21 -3
- package/dist/components/account-chips.js.map +1 -1
- package/dist/components/alert-banner.d.ts +6 -1
- package/dist/components/alert-banner.js +5 -4
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.d.ts +8 -3
- package/dist/components/amount-input.js +5 -5
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/appearance-labels.d.ts +38 -0
- package/dist/components/appearance-labels.js +19 -0
- package/dist/components/appearance-labels.js.map +1 -0
- package/dist/components/autocomplete.js +2 -2
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/breadcrumbs.js +3 -2
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/bulk-action-bar.d.ts +2 -2
- package/dist/components/bulk-action-bar.js +7 -12
- package/dist/components/bulk-action-bar.js.map +1 -1
- package/dist/components/button-group.d.ts +8 -3
- package/dist/components/button-group.js +7 -1
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/calculator.d.ts +8 -3
- package/dist/components/calculator.js +4 -3
- package/dist/components/calculator.js.map +1 -1
- package/dist/components/calendar-heatmap.js +5 -5
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/chart-height.d.ts +23 -0
- package/dist/components/chart-height.js +15 -0
- package/dist/components/chart-height.js.map +1 -0
- package/dist/components/chart-zoom.js +6 -1
- package/dist/components/chart-zoom.js.map +1 -1
- package/dist/components/checkbox-group.js +2 -2
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/checkbox.d.ts +10 -0
- package/dist/components/checkbox.js +25 -10
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/chip.d.ts +19 -3
- package/dist/components/chip.js +54 -23
- package/dist/components/chip.js.map +1 -1
- package/dist/components/choice-card.d.ts +1 -1
- package/dist/components/choice-card.js +9 -8
- package/dist/components/choice-card.js.map +1 -1
- package/dist/components/column-mapper.js +1 -1
- package/dist/components/column-mapper.js.map +1 -1
- package/dist/components/combobox-core.js +8 -7
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.js +8 -8
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +8 -3
- package/dist/components/copy-button.d.ts +10 -5
- package/dist/components/country-select.js +1 -1
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/currency-select.js +3 -3
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm.d.ts +8 -3
- package/dist/components/data-table-cells.d.ts +1 -1
- package/dist/components/data-table-filter-popover.d.ts +1 -1
- package/dist/components/data-table-filter-popover.js +4 -1
- package/dist/components/data-table-filter-popover.js.map +1 -1
- package/dist/components/data-table-filters.d.ts +1 -1
- package/dist/components/data-table-labels.d.ts +1 -1
- package/dist/components/data-table-pagination.d.ts +3 -2
- package/dist/components/data-table-pagination.js +15 -6
- package/dist/components/data-table-pagination.js.map +1 -1
- package/dist/components/data-table.d.ts +1 -1
- package/dist/components/data-table.js +123 -52
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +1 -1
- package/dist/components/date-picker.js +18 -6
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/description-list.js +2 -2
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog-frame.js +2 -1
- package/dist/components/dialog-frame.js.map +1 -1
- package/dist/components/disclosure.js +3 -2
- package/dist/components/disclosure.js.map +1 -1
- package/dist/components/dropdown.d.ts +1 -1
- package/dist/components/dropdown.js +7 -1
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/facing-pair.d.ts +19 -6
- package/dist/components/facing-pair.js +3 -2
- package/dist/components/facing-pair.js.map +1 -1
- package/dist/components/field-parts.d.ts +102 -6
- package/dist/components/field-parts.js +81 -6
- package/dist/components/field-parts.js.map +1 -1
- package/dist/components/field-sync.d.ts +4 -1
- package/dist/components/field-sync.js +12 -2
- package/dist/components/field-sync.js.map +1 -1
- package/dist/components/field.js +2 -2
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-button.d.ts +8 -3
- package/dist/components/file-dropzone.d.ts +8 -3
- package/dist/components/floating-panel.js +7 -4
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/focus-ring.d.ts +12 -0
- package/dist/components/focus-ring.js +8 -0
- package/dist/components/focus-ring.js.map +1 -0
- package/dist/components/form-actions.d.ts +8 -3
- package/dist/components/form-actions.js +33 -19
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/full-bleed-dialog.d.ts +11 -1
- package/dist/components/full-bleed-dialog.js +3 -1
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/iban-input.d.ts +8 -3
- package/dist/components/image-grid.js +1 -1
- package/dist/components/image-grid.js.map +1 -1
- package/dist/components/inline-edit-field.js +10 -4
- package/dist/components/inline-edit-field.js.map +1 -1
- package/dist/components/language-select.d.ts +8 -3
- package/dist/components/legal-page.d.ts +26 -5
- package/dist/components/legal-page.js +3 -1
- package/dist/components/legal-page.js.map +1 -1
- package/dist/components/legal.d.ts +8 -3
- package/dist/components/legal.js +2 -1
- package/dist/components/legal.js.map +1 -1
- package/dist/components/lightbox.js +24 -2
- package/dist/components/lightbox.js.map +1 -1
- package/dist/components/line-items.js +2 -1
- package/dist/components/line-items.js.map +1 -1
- package/dist/components/list.d.ts +5 -0
- package/dist/components/list.js +13 -9
- package/dist/components/list.js.map +1 -1
- package/dist/components/measured-grid.d.ts +3 -1
- package/dist/components/measured-grid.js +38 -20
- package/dist/components/measured-grid.js.map +1 -1
- package/dist/components/menu-item.js +2 -1
- package/dist/components/menu-item.js.map +1 -1
- package/dist/components/mini-calendar.js +8 -4
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/money-field.d.ts +8 -3
- package/dist/components/month-picker.js +50 -39
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/nav-pills.js +1 -1
- package/dist/components/nav-pills.js.map +1 -1
- package/dist/components/number-field.d.ts +8 -3
- package/dist/components/number-input.d.ts +11 -4
- package/dist/components/number-input.js +8 -6
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.d.ts +8 -3
- package/dist/components/numpad-sheet.js +2 -1
- package/dist/components/numpad-sheet.js.map +1 -1
- package/dist/components/one-time-code-input.js +2 -2
- package/dist/components/one-time-code-input.js.map +1 -1
- package/dist/components/page-contents.js +2 -2
- package/dist/components/page-contents.js.map +1 -1
- package/dist/components/phone-input.d.ts +8 -3
- package/dist/components/phone-input.js +4 -4
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/pie-chart.d.ts +8 -2
- package/dist/components/pie-chart.js +11 -7
- package/dist/components/pie-chart.js.map +1 -1
- package/dist/components/popover.d.ts +9 -1
- package/dist/components/popover.js +8 -4
- package/dist/components/popover.js.map +1 -1
- package/dist/components/row-actions.d.ts +100 -0
- package/dist/components/row-actions.js +231 -0
- package/dist/components/row-actions.js.map +1 -0
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/search-field.js +3 -2
- package/dist/components/search-field.js.map +1 -1
- package/dist/components/series-chart-budget.d.ts +30 -7
- package/dist/components/series-chart-budget.js +12 -4
- package/dist/components/series-chart-budget.js.map +1 -1
- package/dist/components/series-chart-ticks.d.ts +7 -1
- package/dist/components/series-chart-ticks.js +6 -0
- package/dist/components/series-chart-ticks.js.map +1 -1
- package/dist/components/series-chart.d.ts +58 -28
- package/dist/components/series-chart.js +42 -32
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/settings-fields.d.ts +57 -8
- package/dist/components/settings-fields.js +39 -1
- package/dist/components/settings-fields.js.map +1 -1
- package/dist/components/share-card.d.ts +11 -6
- package/dist/components/share-card.js +8 -2
- package/dist/components/share-card.js.map +1 -1
- package/dist/components/sign-chip.d.ts +4 -0
- package/dist/components/sign-chip.js +17 -4
- package/dist/components/sign-chip.js.map +1 -1
- package/dist/components/signature-pad.d.ts +3 -1
- package/dist/components/signature-pad.js +8 -5
- package/dist/components/signature-pad.js.map +1 -1
- package/dist/components/slider.js +7 -6
- package/dist/components/slider.js.map +1 -1
- package/dist/components/sparkline.d.ts +5 -1
- package/dist/components/sparkline.js +4 -2
- package/dist/components/sparkline.js.map +1 -1
- package/dist/components/stat-tile.d.ts +17 -1
- package/dist/components/stat-tile.js +48 -20
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/status-dot.d.ts +4 -0
- package/dist/components/status-dot.js +9 -2
- package/dist/components/status-dot.js.map +1 -1
- package/dist/components/swipeable-row.js +10 -2
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/switch.d.ts +21 -7
- package/dist/components/switch.js +24 -11
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.js +2 -2
- package/dist/components/table.js.map +1 -1
- package/dist/components/text-link.d.ts +8 -3
- package/dist/components/text-link.js +1 -1
- package/dist/components/text-link.js.map +1 -1
- package/dist/components/text.d.ts +7 -2
- package/dist/components/text.js +5 -5
- package/dist/components/text.js.map +1 -1
- package/dist/components/tile-radio.js +2 -1
- package/dist/components/tile-radio.js.map +1 -1
- package/dist/components/time-input.d.ts +8 -3
- package/dist/components/toast.d.ts +18 -2
- package/dist/components/toast.js +8 -5
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.d.ts +25 -3
- package/dist/components/toggle-group.js +40 -11
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle-legend.d.ts +10 -1
- package/dist/components/toggle-legend.js +21 -7
- package/dist/components/toggle-legend.js.map +1 -1
- package/dist/components/translation-review-editor.js +1 -1
- package/dist/components/translation-review-editor.js.map +1 -1
- package/dist/components/translation-review-parts.d.ts +4 -0
- package/dist/components/translation-review.d.ts +4 -0
- package/dist/components/translation-review.js +3 -3
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/tree-view.js +3 -2
- package/dist/components/tree-view.js.map +1 -1
- package/dist/components/treemap.d.ts +5 -2
- package/dist/components/treemap.js +33 -16
- package/dist/components/treemap.js.map +1 -1
- package/dist/components/ui.d.ts +8 -3
- package/dist/components/ui.js +207 -119
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +1 -1
- package/dist/components/user-avatar.d.ts +5 -1
- package/dist/components/user-avatar.js +1 -1
- package/dist/components/user-avatar.js.map +1 -1
- package/dist/components/wizard-stepper.js +20 -14
- package/dist/components/wizard-stepper.js.map +1 -1
- package/dist/{data-table-labels-DUELeXpa.d.ts → data-table-labels-kpAAVi6g.d.ts} +26 -2
- package/dist/data-table.d.ts +1 -1
- package/dist/{delete-account-setting-CpIhzxxZ.d.ts → delete-account-setting-FLyJf-kZ.d.ts} +642 -60
- package/dist/demo/demo-banner.js +1 -0
- package/dist/demo/demo-banner.js.map +1 -1
- package/dist/feedback/feedback-attachment.d.ts +8 -3
- package/dist/feedback/feedback-context.d.ts +8 -3
- package/dist/feedback/feedback-crash.d.ts +8 -3
- package/dist/feedback/feedback-dialog.d.ts +8 -3
- package/dist/feedback/feedback-dialog.js +3 -3
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.d.ts +8 -3
- package/dist/feedback/feedback-inbox.js +2 -2
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback/feedback-labels.d.ts +8 -3
- package/dist/feedback/feedback-menu.d.ts +9 -4
- package/dist/feedback/feedback-record.d.ts +8 -3
- package/dist/feedback/feedback-row-detail.d.ts +8 -3
- package/dist/feedback/feedback-status-undo.d.ts +8 -3
- package/dist/feedback/feedback-submit.d.ts +8 -3
- package/dist/feedback/feedback-swipe.d.ts +8 -3
- package/dist/feedback/feedback-table.d.ts +8 -3
- package/dist/feedback/feedback-thread.d.ts +8 -3
- package/dist/feedback/feedback-thread.js +3 -3
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/feedback.d.ts +8 -3
- package/dist/hooks/use-anchored-panel.d.ts +32 -3
- package/dist/hooks/use-anchored-panel.js +21 -3
- package/dist/hooks/use-anchored-panel.js.map +1 -1
- package/dist/hooks/use-breakpoint.d.ts +88 -0
- package/dist/hooks/use-breakpoint.js +50 -0
- package/dist/hooks/use-breakpoint.js.map +1 -0
- package/dist/hooks/use-file-drop.d.ts +8 -3
- package/dist/hooks/use-large-text.d.ts +29 -0
- package/dist/hooks/use-large-text.js +20 -0
- package/dist/hooks/use-large-text.js.map +1 -0
- package/dist/hooks/use-windowed-rows.d.ts +52 -8
- package/dist/hooks/use-windowed-rows.js +94 -5
- package/dist/hooks/use-windowed-rows.js.map +1 -1
- package/dist/i18n/defaults.d.ts +8 -3
- package/dist/i18n/defaults.js +8 -0
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.d.ts +8 -3
- package/dist/i18n/german.js +94 -3
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +8 -3
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/languages.d.ts +10 -5
- package/dist/i18n/locales/de-CH.d.ts +8 -3
- package/dist/i18n/locales/en.d.ts +8 -3
- package/dist/i18n/locales/es.d.ts +8 -3
- package/dist/i18n/locales/es.js +89 -3
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +8 -3
- package/dist/i18n/locales/fr.js +91 -3
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +8 -3
- package/dist/i18n/locales/hu.js +91 -3
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +8 -3
- package/dist/i18n/locales/it.js +92 -3
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +8 -3
- package/dist/i18n/locales/zh.js +89 -3
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.d.ts +8 -3
- package/dist/i18n/review.js +15 -1
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +27 -11
- package/dist/index.js +77 -4
- package/dist/index.js.map +1 -1
- package/dist/landing/landing-actions.d.ts +8 -3
- package/dist/landing/landing-sections.d.ts +8 -3
- package/dist/landing/landing-sections.js +7 -3
- package/dist/landing/landing-sections.js.map +1 -1
- package/dist/landing/public-header.d.ts +9 -4
- package/dist/landing/public-header.js +3 -3
- package/dist/landing/public-header.js.map +1 -1
- package/dist/landing/routing.d.ts +8 -3
- package/dist/lib/cn.js +3 -2
- package/dist/lib/cn.js.map +1 -1
- package/dist/rhf/fields.d.ts +8 -3
- package/dist/rhf/fields.js +1 -1
- package/dist/rhf/fields.js.map +1 -1
- package/dist/rhf/form.d.ts +8 -3
- package/dist/rhf/form.js +2 -2
- package/dist/rhf/form.js.map +1 -1
- package/dist/rhf.d.ts +8 -3
- package/dist/search/command-palette.d.ts +1 -1
- package/dist/search/command-palette.js +9 -8
- package/dist/search/command-palette.js.map +1 -1
- package/dist/settings/settings-layout.js +2 -1
- package/dist/settings/settings-layout.js.map +1 -1
- package/dist/settings/settings-section.d.ts +8 -3
- package/dist/settings/use-account-appearance.d.ts +92 -0
- package/dist/settings/use-account-appearance.js +63 -0
- package/dist/settings/use-account-appearance.js.map +1 -0
- package/dist/settings/use-settings-route.d.ts +1 -1
- package/dist/settings/use-settings-route.js +2 -3
- package/dist/settings/use-settings-route.js.map +1 -1
- package/dist/shell/app-shell.d.ts +12 -171
- package/dist/shell/app-shell.js +144 -28
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/auth-layout.js +1 -1
- package/dist/shell/auth-layout.js.map +1 -1
- package/dist/shell/option-switcher-menu.js +1 -1
- package/dist/shell/option-switcher-menu.js.map +1 -1
- package/dist/shell/top-bar-brand.d.ts +8 -3
- package/dist/shell/top-bar-brand.js +3 -1
- package/dist/shell/top-bar-brand.js.map +1 -1
- package/dist/shell/topbar-action-menu.d.ts +4 -0
- package/dist/shell/topbar-action-menu.js +3 -3
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell/topbar-controls.js +4 -4
- package/dist/shell/topbar-controls.js.map +1 -1
- package/dist/shell.d.ts +9 -5
- package/dist/theme/contrast-tokens.d.ts +41 -0
- package/dist/theme/contrast-tokens.js +59 -0
- package/dist/theme/contrast-tokens.js.map +1 -0
- package/dist/theme/contrast.d.ts +110 -0
- package/dist/theme/contrast.js +128 -0
- package/dist/theme/contrast.js.map +1 -0
- package/dist/theme/palette-presets.d.ts +12 -1
- package/dist/theme/palette-presets.js +9 -4
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/theme/palette-store.js.map +1 -1
- package/dist/theme/text-size.d.ts +173 -0
- package/dist/theme/text-size.js +121 -0
- package/dist/theme/text-size.js.map +1 -0
- package/dist/wizard/stepper-nav.d.ts +8 -3
- package/dist/wizard/wizard-summary.js +1 -1
- package/dist/wizard/wizard-summary.js.map +1 -1
- package/dist/wizard.d.ts +8 -3
- package/package.json +1 -1
- package/src/admin/admin-action-log.tsx +6 -1
- package/src/admin/invitations-panel.tsx +36 -29
- package/src/admin/user-roster.tsx +17 -72
- package/src/auth/auth-errors.ts +68 -7
- package/src/billing/billing-banner.tsx +205 -0
- package/src/billing/billing-labels.ts +240 -0
- package/src/billing/billing-lock.ts +75 -0
- package/src/billing/billing-standing.ts +72 -0
- package/src/billing/plan-card.tsx +458 -0
- package/src/billing/plan-limit-notice.tsx +145 -0
- package/src/billing/plan-limit.ts +53 -0
- package/src/billing/plan-price.ts +101 -0
- package/src/billing/subscription-actions.tsx +76 -0
- package/src/billing/subscription-status-chip.tsx +95 -0
- package/src/chart.ts +2 -0
- package/src/components/account-chips.tsx +36 -10
- package/src/components/alert-banner.tsx +16 -7
- package/src/components/amount-input.tsx +5 -5
- package/src/components/appearance-labels.ts +47 -0
- package/src/components/autocomplete.tsx +2 -2
- package/src/components/breadcrumbs.tsx +3 -3
- package/src/components/bulk-action-bar.tsx +11 -14
- package/src/components/button-group.tsx +21 -0
- package/src/components/calculator.tsx +4 -3
- package/src/components/calendar-heatmap.tsx +5 -5
- package/src/components/chart-height.ts +30 -0
- package/src/components/chart-zoom.tsx +6 -1
- package/src/components/checkbox-group.tsx +2 -2
- package/src/components/checkbox.tsx +62 -20
- package/src/components/chip.tsx +139 -30
- package/src/components/choice-card.tsx +16 -11
- package/src/components/column-mapper.tsx +1 -1
- package/src/components/combobox-core.tsx +8 -7
- package/src/components/combobox.tsx +8 -8
- package/src/components/country-select.tsx +1 -1
- package/src/components/currency-select.tsx +3 -3
- package/src/components/data-table-filter-popover.tsx +7 -1
- package/src/components/data-table-pagination.tsx +60 -31
- package/src/components/data-table.tsx +164 -43
- package/src/components/date-picker.tsx +44 -10
- package/src/components/description-list.tsx +2 -2
- package/src/components/dialog-frame.tsx +2 -1
- package/src/components/disclosure.tsx +3 -2
- package/src/components/dropdown.tsx +10 -2
- package/src/components/facing-pair.ts +12 -5
- package/src/components/field-parts.tsx +190 -7
- package/src/components/field-sync.tsx +17 -3
- package/src/components/field.tsx +2 -2
- package/src/components/floating-panel.tsx +7 -4
- package/src/components/focus-ring.ts +12 -0
- package/src/components/form-actions.tsx +55 -18
- package/src/components/full-bleed-dialog.tsx +18 -4
- package/src/components/image-grid.tsx +1 -1
- package/src/components/inline-edit-field.tsx +26 -4
- package/src/components/legal-page.tsx +28 -2
- package/src/components/legal.tsx +19 -1
- package/src/components/lightbox.tsx +24 -2
- package/src/components/line-items.tsx +7 -1
- package/src/components/list.tsx +36 -10
- package/src/components/measured-grid.tsx +49 -24
- package/src/components/menu-item.tsx +2 -2
- package/src/components/mini-calendar.tsx +8 -4
- package/src/components/month-picker.tsx +15 -6
- package/src/components/nav-pills.tsx +1 -1
- package/src/components/number-input.tsx +14 -7
- package/src/components/numpad-sheet.tsx +2 -2
- package/src/components/one-time-code-input.tsx +2 -2
- package/src/components/page-contents.tsx +2 -2
- package/src/components/phone-input.tsx +9 -4
- package/src/components/pie-chart.tsx +19 -9
- package/src/components/popover.tsx +22 -5
- package/src/components/row-actions.tsx +450 -0
- package/src/components/scroll-area.tsx +1 -1
- package/src/components/search-field.tsx +4 -2
- package/src/components/series-chart-budget.ts +40 -8
- package/src/components/series-chart-ticks.ts +10 -0
- package/src/components/series-chart.tsx +123 -72
- package/src/components/settings-fields.tsx +89 -5
- package/src/components/share-card.tsx +31 -2
- package/src/components/sign-chip.tsx +28 -4
- package/src/components/signature-pad.tsx +13 -7
- package/src/components/slider.tsx +22 -9
- package/src/components/sparkline.tsx +11 -3
- package/src/components/stat-tile.tsx +70 -14
- package/src/components/status-dot.tsx +25 -2
- package/src/components/swipeable-row.tsx +10 -2
- package/src/components/switch.tsx +57 -23
- package/src/components/table.tsx +2 -2
- package/src/components/text-link.tsx +1 -1
- package/src/components/text.tsx +11 -6
- package/src/components/tile-radio.tsx +4 -1
- package/src/components/toast.tsx +27 -7
- package/src/components/toggle-group.tsx +115 -14
- package/src/components/toggle-legend.tsx +53 -8
- package/src/components/translation-review-editor.tsx +1 -1
- package/src/components/translation-review.tsx +11 -5
- package/src/components/tree-view.tsx +3 -2
- package/src/components/treemap.tsx +27 -10
- package/src/components/ui.tsx +353 -153
- package/src/components/user-avatar.tsx +1 -1
- package/src/components/wizard-stepper.tsx +5 -1
- package/src/demo/demo-banner.tsx +5 -0
- package/src/feedback/feedback-dialog.tsx +3 -3
- package/src/feedback/feedback-inbox.tsx +2 -2
- package/src/feedback/feedback-thread.tsx +3 -3
- package/src/hooks/use-anchored-panel.ts +67 -5
- package/src/hooks/use-breakpoint.ts +132 -0
- package/src/hooks/use-large-text.ts +41 -0
- package/src/hooks/use-windowed-rows.ts +168 -12
- package/src/i18n/defaults.ts +8 -0
- package/src/i18n/german.ts +107 -0
- package/src/i18n/kit-labels.tsx +12 -0
- package/src/i18n/locales/es.ts +98 -0
- package/src/i18n/locales/fr.ts +102 -0
- package/src/i18n/locales/hu.ts +100 -0
- package/src/i18n/locales/it.ts +103 -0
- package/src/i18n/locales/zh.ts +94 -0
- package/src/i18n/review.ts +14 -0
- package/src/index.ts +76 -6
- package/src/landing/landing-sections.tsx +7 -3
- package/src/landing/public-header.tsx +4 -4
- package/src/lib/cn.ts +13 -2
- package/src/rhf/fields.tsx +1 -1
- package/src/rhf/form.tsx +2 -2
- package/src/search/command-palette.tsx +10 -9
- package/src/settings/settings-layout.tsx +2 -1
- package/src/settings/use-account-appearance.ts +148 -0
- package/src/settings/use-settings-route.ts +3 -4
- package/src/shell/app-shell.tsx +278 -54
- package/src/shell/auth-layout.tsx +1 -1
- package/src/shell/option-switcher-menu.tsx +1 -1
- package/src/shell/top-bar-brand.tsx +3 -1
- package/src/shell/topbar-action-menu.tsx +3 -3
- package/src/shell/topbar-controls.tsx +4 -4
- package/src/theme/contrast-tokens.ts +112 -0
- package/src/theme/contrast.ts +225 -0
- package/src/theme/palette-presets.ts +24 -4
- package/src/theme/palette-store.ts +6 -1
- package/src/theme/text-size.ts +283 -0
- package/src/wizard/wizard-summary.tsx +4 -2
- package/tokens.css +158 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/admin/invitations-panel.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { FormEvent, ReactNode } from \"react\";\nimport { RefreshCw, Trash2, UserPlus } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport type { DateInput } from \"../lib/format\";\nimport { useKitLabels, useKitLocale } from \"../i18n/kit-labels\";\nimport { KIT_LANGUAGES, resolveLanguage } from \"../i18n/languages\";\nimport type { KitLanguageCode } from \"../i18n/languages\";\nimport { RoleChip } from \"../components/account-chips\";\nimport type { RoleVocabulary } from \"../components/account-chips\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { Chip } from \"../components/chip\";\nimport type { ChipTone } from \"../components/chip\";\nimport { CopyButton } from \"../components/copy-button\";\nimport { LanguageSelect } from \"../components/language-select\";\nimport { SectionLabel, Caption } from \"../components/text\";\nimport { Button, IconButton, Input, Select, Spinner } from \"../components/ui\";\nimport { useWriteLock } from \"../components/write-lock\";\nimport { hasMessage, settle, useDayText, usePersonLabel } from \"./admin-parts\";\nimport type { AdminPerson, MaybePromise } from \"./admin-parts\";\nimport { RoleSelect } from \"./role-select\";\n\n/**\n * Who is invited, and the form that invites (docs/user-admin-harmonization.md §5; auth\n * §4.4: a hashed one-time token, 14 days, an address with a role and a scope).\n *\n * Kurvenschmiede's `invitations-panel.tsx` with its parts made props: a form (the address,\n * a role from the app's vocabulary, an optional scope — a team, a company — the language\n * the invitation is written in, a note), then one row per invitation with its status, when\n * it was sent and until when it works, and resend / copy link / revoke.\n *\n * - **It assumes nothing about who invites.** Admins do, team managers into their team,\n * kastlan's company admins into their company — and in keksdose ANY budget owner, from\n * the budget's sharing (Marcel, 2026-10-07). So no word here says \"admin\"; the roles,\n * the scopes and the callbacks are the app's, and so is the frame around it.\n * - **The address is someone else's.** No `+app` tag is offered (auth §4.5): a tag is\n * the owner's own choice, made when they sign up.\n * - **The link is shown once.** The token is stored hashed, so the server can show a link\n * only in the answer that minted it — on creation and on resend, and only while mail\n * goes to the console (dev, a deploy without mail). The panel keeps such a link for as\n * long as it is mounted and offers to copy it on its row; reloading the page loses it,\n * and \"resend\" mints a new one. With the console backend the panel says so up front.\n * - **Revoked is optional.** An app that deletes the row instead (kastlan) never sends\n * `revoked`; the status chip simply never says it (§5).\n *\n * It never sends a request: `onInvite`, `onResend` and `onRevoke` do.\n */\n\nexport type InvitationStatus = \"open\" | \"accepted\" | \"expired\" | \"revoked\";\n\n/** One row of `GET /admin/invitations` (§5), in the wire's own field names. */\nexport interface InvitationRow<R extends string = string> {\n id: string | number;\n email: string;\n role?: R | null;\n /** The scope's value — a team's or a company's id, matched against `scopes`. */\n scope?: string | number | null;\n note?: string | null;\n /** The language it was written in. */\n locale?: string | null;\n /** Who sent it: a name, or the person. */\n invited_by?: string | AdminPerson | null;\n created_at: DateInput;\n expires_at?: DateInput;\n status: InvitationStatus;\n /** The one-time link, while mail goes to the console — in the answer that minted it. */\n link?: string | null;\n}\n\n/** What the form sends — `POST /admin/invitations {email, role, scope?, note?, locale}`. */\nexport interface InvitationDraft<R extends string = string> {\n email: string;\n /** Absent when the app offers no role choice (`roles` left out). */\n role?: R;\n scope?: string;\n note?: string;\n locale: KitLanguageCode;\n}\n\n/** What `onInvite` / `onResend` may answer, so the panel can keep a shown-once link. */\nexport interface InvitationSentAnswer {\n /** The invitation the answer is about — `onInvite` needs it for the link to find its\n * row; `onResend` knows it already. */\n id?: string | number;\n /** The one-time link, while mail goes to the console. */\n link?: string | null;\n /** `false`: the invitation exists but the mail failed — say so, resend it. */\n sent?: boolean;\n}\n\n/** A scope an invitation can carry. */\nexport interface InvitationScope {\n value: string;\n label: string;\n}\n\n/** The `invitations` namespace. */\nexport interface InvitationsLabels {\n /** The form's address field. */\n email: string;\n /** Under it while what was typed is not an address. */\n invalidEmail: string;\n role: string;\n /** The scope select's label — the app's word (\"Team\", \"Company\") goes over it. */\n scope: string;\n /** The scope select's empty choice. */\n scopeNone: string;\n /** The language select's label. */\n language: string;\n note: string;\n /** The form's button. */\n invite: string;\n /** Heading over the rows. */\n listTitle: string;\n empty: string;\n loading: string;\n /** The status chip, per status. */\n status: Record<InvitationStatus, string>;\n /** \"Sent 6 Oct 2026\". */\n sent: (date: string) => string;\n /** \"Expires 20 Oct 2026\" — on an open invitation. */\n expires: (date: string) => string;\n /** \"by Ada Example\". */\n invitedBy: (name: string) => string;\n /** The resend button — \"Send ben@example.com a new link\". */\n resend: (email: string) => string;\n /** The copy button. */\n copyLink: string;\n /** The revoke button — \"Revoke the invitation for ben@example.com\". */\n revoke: (email: string) => string;\n /** Over everything while mail goes to the console. */\n consoleHint: string;\n /** Beside a link the answer carried with no row to put it on. */\n linkReady: (email: string) => string;\n /** The answer said the mail was not sent. */\n notSent: (email: string) => string;\n /** A rejected callback, unless `describeError` says better. */\n failed: string;\n}\n\nexport const DEFAULT_INVITATIONS_LABELS: InvitationsLabels = {\n email: \"Email address\",\n invalidEmail: \"Enter a complete email address.\",\n role: \"Role\",\n scope: \"Scope\",\n scopeNone: \"None\",\n language: \"Language of the invitation\",\n note: \"Note\",\n invite: \"Invite\",\n listTitle: \"Invitations\",\n empty: \"Nobody has been invited yet.\",\n loading: \"Loading…\",\n status: { open: \"Open\", accepted: \"Accepted\", expired: \"Expired\", revoked: \"Revoked\" },\n sent: (date) => `Sent ${date}`,\n expires: (date) => `Expires ${date}`,\n invitedBy: (name) => `by ${name}`,\n resend: (email) => `Send ${email} a new link`,\n copyLink: \"Copy invitation link\",\n revoke: (email) => `Revoke the invitation for ${email}`,\n consoleHint:\n \"Mail isn’t sent on this server — it is written to the server log. Copy each invitation link from here and pass it on yourself: it is shown only once.\",\n linkReady: (email) => `The invitation link for ${email}, shown only this once:`,\n notSent: (email) => `${email} is invited, but the mail couldn’t be sent. Resend it.`,\n failed: \"That didn’t work. Please try again.\",\n};\n\n/** The tone of each status. */\nconst STATUS_TONES: Readonly<Record<InvitationStatus, ChipTone>> = {\n open: \"info\",\n accepted: \"success\",\n expired: \"warning\",\n revoked: \"neutral\",\n};\n\nexport interface InvitationsPanelProps<R extends string = string> {\n invitations: readonly InvitationRow<R>[];\n /** The app's roles. Left out: no role choice, and no role chip on a row. */\n roles?: RoleVocabulary<R>;\n /** The roles an invitation may carry — Kurvenschmiede's member or customer. Default:\n * the whole vocabulary. One role: no choice is drawn, and it is sent. */\n invitableRoles?: readonly R[];\n /** The role the form starts with. Default: the first invitable one. */\n defaultRole?: R;\n /** The scopes an invitation may carry — teams, companies. Left out: no scope field. */\n scopes?: readonly InvitationScope[];\n /** A scope must be chosen (no \"None\"). */\n scopeRequired?: boolean;\n /** The languages offered. Default: all seven of the kit's. */\n languages?: readonly KitLanguageCode[];\n /** The language the form starts with. Default: the page's, resolved to `languages`. */\n defaultLocale?: string;\n /** The server's `mail_backend`. `\"console\"` draws the hint. */\n mailBackend?: string | null;\n /** Creates one (resolve to clear the form; reject to keep it and say why). Left out:\n * no form — a list someone may look at but not add to. */\n onInvite?: (draft: InvitationDraft<R>) => MaybePromise<InvitationSentAnswer | void>;\n /** Mints a new link and mails it. Left out: no resend button. */\n onResend?: (invitation: InvitationRow<R>) => MaybePromise<InvitationSentAnswer | void>;\n /** Revokes an open or an expired invitation (level `none`, §4.2: re-inviting undoes\n * it). An expired row can be resent, and since 0.31 also removed: in an app that\n * keeps the rows it would otherwise stay listed for good (Kurvenschmiede's 0.30\n * adoption). Left out: no revoke button. */\n onRevoke?: (invitation: InvitationRow<R>) => MaybePromise;\n /** The list is being fetched. */\n loading?: boolean;\n /** The app's words for a rejected callback. */\n describeError?: (error: unknown) => ReactNode | undefined;\n /** Over the form: who can be invited and what happens, in the app's words. */\n intro?: ReactNode;\n /** The list's visible heading. Default: the `listTitle` label. `null` leaves it out,\n * for a page whose card is already headed \"Invitations\" (Kurvenschmiede's 0.30\n * adoption); the list keeps the label as its accessible name either way. */\n listTitle?: ReactNode | null;\n className?: string;\n labels?: Partial<InvitationsLabels>;\n}\n\n// Shape only — whether the address may be invited is the server's question.\nconst EMAIL_SHAPE = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\nconst ALL_CODES: readonly KitLanguageCode[] = KIT_LANGUAGES.map((language) => language.code);\n\n/** A failed run, told apart from an answer of `undefined`. */\nconst FAILED = Symbol(\"failed\");\n\nexport function InvitationsPanel<R extends string = string>({\n invitations,\n roles,\n invitableRoles,\n defaultRole,\n scopes,\n scopeRequired = false,\n languages = ALL_CODES,\n defaultLocale,\n mailBackend,\n onInvite,\n onResend,\n onRevoke,\n loading = false,\n describeError,\n intro,\n listTitle,\n className,\n labels: labelsProp,\n}: InvitationsPanelProps<R>) {\n const labels = useKitLabels(\"invitations\", DEFAULT_INVITATIONS_LABELS, labelsProp);\n const kitLocale = useKitLocale();\n const dayText = useDayText();\n const nameOf = usePersonLabel();\n const lock = useWriteLock();\n const offered: readonly R[] = invitableRoles ?? (roles ? (Object.keys(roles) as R[]) : []);\n const [email, setEmail] = useState(\"\");\n const [invalid, setInvalid] = useState(false);\n const [role, setRole] = useState<R | undefined>(defaultRole ?? offered[0]);\n const [scope, setScope] = useState(\"\");\n const [locale, setLocale] = useState<KitLanguageCode>(() =>\n resolveLanguage([defaultLocale, kitLocale], languages),\n );\n const [note, setNote] = useState(\"\");\n // One request at a time, for the whole panel; the key says which control spins.\n const [busy, setBusy] = useState<string | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const [notice, setNotice] = useState<ReactNode>(null);\n // Links the answers carried, by invitation — shown once, kept while mounted.\n const [links, setLinks] = useState<Record<string, string>>({});\n // A link whose answer named no invitation: shown above the list instead.\n const [looseLink, setLooseLink] = useState<{ email: string; link: string } | null>(null);\n\n const run = async <T,>(key: string, call: () => MaybePromise<T>): Promise<T | void | typeof FAILED> => {\n setBusy(key);\n setFailure(null);\n setNotice(null);\n try {\n return await settle(call);\n } catch (error) {\n const own = describeError?.(error);\n setFailure(hasMessage(own) ? own : labels.failed);\n return FAILED;\n } finally {\n setBusy(null);\n }\n };\n\n /** Keep what an answer carried: its link, and whether the mail went. */\n const took = (answer: InvitationSentAnswer | void, address: string, id?: string | number) => {\n if (!answer) return;\n const key = answer.id ?? id;\n if (answer.link) {\n if (key !== undefined) setLinks((known) => ({ ...known, [String(key)]: answer.link as string }));\n else setLooseLink({ email: address, link: answer.link });\n }\n if (answer.sent === false) setNotice(labels.notSent(address));\n };\n\n const address = email.trim();\n const choosesRole = roles !== undefined && offered.length > 1;\n const canInvite = onInvite !== undefined;\n\n const submit = async (event: FormEvent) => {\n event.preventDefault();\n // Enter in a field is a commit too — the button's lock does not see it.\n if (!onInvite || busy || lock.locked || address === \"\") return;\n if (!EMAIL_SHAPE.test(address)) {\n setInvalid(true);\n return;\n }\n if (scopes && scopeRequired && scope === \"\") return;\n const draft: InvitationDraft<R> = {\n email: address,\n locale,\n ...(role !== undefined && roles !== undefined ? { role } : {}),\n ...(scope !== \"\" ? { scope } : {}),\n ...(note.trim() !== \"\" ? { note: note.trim() } : {}),\n };\n const answer = await run(\"invite\", () => onInvite(draft));\n if (answer === FAILED) return;\n took(answer, address);\n setEmail(\"\");\n setNote(\"\");\n };\n\n const scopeLabel = (value: InvitationRow[\"scope\"]) =>\n value === null || value === undefined || value === \"\"\n ? null\n : (scopes?.find((s) => s.value === String(value))?.label ?? String(value));\n\n return (\n <div className={cn(\"space-y-3\", className)}>\n {intro && <div className=\"text-sm text-[var(--text-secondary)]\">{intro}</div>}\n {mailBackend === \"console\" && (\n <AlertBanner tone=\"info\" size=\"sm\">\n {labels.consoleHint}\n </AlertBanner>\n )}\n\n {canInvite && (\n <form noValidate onSubmit={submit} className=\"@container space-y-2\">\n <div className=\"grid grid-cols-1 gap-2 @md:grid-cols-2\">\n <Input\n label={labels.email}\n type=\"email\"\n inputMode=\"email\"\n autoComplete=\"off\"\n autoCapitalize=\"none\"\n spellCheck={false}\n required\n value={email}\n error={invalid ? labels.invalidEmail : undefined}\n data-private\n onChange={(event) => {\n setInvalid(false);\n setEmail(event.target.value);\n }}\n />\n {choosesRole && (\n <RoleSelect<R>\n label={labels.role}\n value={role}\n roles={roles}\n offered={offered}\n onChange={setRole}\n />\n )}\n {scopes && scopes.length > 0 && (\n <Select\n label={labels.scope}\n value={scope}\n required={scopeRequired}\n onChange={(event) => setScope(event.target.value)}\n >\n <option value=\"\" disabled={scopeRequired}>\n {labels.scopeNone}\n </option>\n {scopes.map((s) => (\n <option key={s.value} value={s.value}>\n {s.label}\n </option>\n ))}\n </Select>\n )}\n {languages.length > 1 && (\n <LanguageSelect label={labels.language} codes={languages} value={locale} onChange={setLocale} />\n )}\n <Input\n label={labels.note}\n value={note}\n maxLength={255}\n onChange={(event) => setNote(event.target.value)}\n className=\"@md:col-span-2\"\n />\n </div>\n <div className=\"flex justify-end\">\n <Button\n type=\"submit\"\n variant=\"brand\"\n commit\n pending={busy === \"invite\"}\n disabled={busy !== null || address === \"\" || (scopeRequired && scopes !== undefined && scope === \"\")}\n >\n <UserPlus className=\"size-4\" aria-hidden />\n {labels.invite}\n </Button>\n </div>\n </form>\n )}\n\n {failure && (\n <AlertBanner tone=\"danger\" size=\"sm\">\n {failure}\n </AlertBanner>\n )}\n {notice && (\n <AlertBanner tone=\"warning\" size=\"sm\" onDismiss={() => setNotice(null)}>\n {notice}\n </AlertBanner>\n )}\n {looseLink && (\n <AlertBanner tone=\"info\" size=\"sm\" onDismiss={() => setLooseLink(null)}>\n <div className=\"flex min-w-0 flex-wrap items-center gap-2\">\n <span data-private>{labels.linkReady(looseLink.email)}</span>\n <code className=\"min-w-0 break-all text-xs\">{looseLink.link}</code>\n <CopyButton size=\"xs\" text={looseLink.link} label={labels.copyLink} />\n </div>\n </AlertBanner>\n )}\n\n <div className=\"space-y-2\">\n {listTitle !== null && <SectionLabel as=\"h4\">{listTitle ?? labels.listTitle}</SectionLabel>}\n {loading && invitations.length === 0 ? (\n <div className=\"flex justify-center py-3\">\n <Spinner label={labels.loading} />\n </div>\n ) : invitations.length === 0 ? (\n <Caption>{labels.empty}</Caption>\n ) : (\n <ul aria-label={labels.listTitle} className=\"divide-y divide-[var(--border)]\">\n {invitations.map((invitation) => {\n const key = String(invitation.id);\n const link = invitation.link ?? links[key];\n const open = invitation.status === \"open\";\n const resendable = onResend && (open || invitation.status === \"expired\");\n const revocable = onRevoke && (open || invitation.status === \"expired\");\n const scopeText = scopeLabel(invitation.scope);\n const by =\n typeof invitation.invited_by === \"string\" ? invitation.invited_by : nameOf(invitation.invited_by);\n const facts = [\n dayText(invitation.created_at) && labels.sent(dayText(invitation.created_at)),\n open && dayText(invitation.expires_at ?? null) && labels.expires(dayText(invitation.expires_at ?? null)),\n by && labels.invitedBy(by),\n ].filter(Boolean);\n return (\n <li key={key} data-status={invitation.status} className=\"py-2 first:pt-0 last:pb-0\">\n <div className=\"flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5\">\n <div className=\"min-w-0 flex-1 basis-48 space-y-1\">\n <div data-private className=\"truncate text-sm font-medium text-[var(--text-primary)]\">\n {invitation.email}\n </div>\n <div className=\"flex flex-wrap items-center gap-1\">\n <Chip size=\"xs\" shape=\"square\" caps tone={STATUS_TONES[invitation.status]}>\n {labels.status[invitation.status]}\n </Chip>\n {roles && invitation.role && <RoleChip<R> value={invitation.role} roles={roles} size=\"xs\" />}\n {scopeText && (\n <Chip size=\"xs\" shape=\"square\">\n {scopeText}\n </Chip>\n )}\n </div>\n {(facts.length > 0 || invitation.note) && (\n <div className=\"text-xs text-[var(--text-muted)]\">\n {facts.join(\" · \")}\n {invitation.note && (\n <>\n {facts.length > 0 && \" · \"}\n <span data-private>{invitation.note}</span>\n </>\n )}\n </div>\n )}\n </div>\n {(link || resendable || revocable) && (\n <div className=\"ms-auto flex shrink-0 items-center gap-1\">\n {link && open && <CopyButton size=\"xs\" tone=\"muted\" text={link} label={labels.copyLink} />}\n {resendable && (\n <IconButton\n size=\"xs\"\n commit\n label={labels.resend(invitation.email)}\n pending={busy === `resend:${key}`}\n disabled={busy !== null}\n onClick={async () => {\n const answer = await run(`resend:${key}`, () => onResend(invitation));\n if (answer !== FAILED) took(answer, invitation.email, invitation.id);\n }}\n >\n <RefreshCw />\n </IconButton>\n )}\n {revocable && (\n <IconButton\n size=\"xs\"\n tone=\"danger\"\n commit\n label={labels.revoke(invitation.email)}\n pending={busy === `revoke:${key}`}\n disabled={busy !== null}\n onClick={() => void run(`revoke:${key}`, () => onRevoke(invitation))}\n >\n <Trash2 />\n </IconButton>\n )}\n </div>\n )}\n </div>\n </li>\n );\n })}\n </ul>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";AAwUgB,SAgJY,UAhJZ,KAoCF,YApCE;AAxUhB,SAAS,gBAAgB;AAEzB,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,UAAU;AAEnB,SAAS,cAAc,oBAAoB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":["import { useState } from \"react\";\nimport type { FormEvent, ReactNode } from \"react\";\nimport { RefreshCw, Trash2, UserPlus } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport type { DateInput } from \"../lib/format\";\nimport { useKitLabels, useKitLocale } from \"../i18n/kit-labels\";\nimport { KIT_LANGUAGES, resolveLanguage } from \"../i18n/languages\";\nimport type { KitLanguageCode } from \"../i18n/languages\";\nimport { RoleChip } from \"../components/account-chips\";\nimport type { RoleVocabulary } from \"../components/account-chips\";\nimport { AlertBanner } from \"../components/alert-banner\";\nimport { Chip } from \"../components/chip\";\nimport type { ChipTone } from \"../components/chip\";\nimport { CopyButton } from \"../components/copy-button\";\nimport { LanguageSelect } from \"../components/language-select\";\nimport { SectionLabel, Caption } from \"../components/text\";\nimport { RowActions } from \"../components/row-actions\";\nimport { Button, Input, Select, Spinner } from \"../components/ui\";\nimport { useWriteLock } from \"../components/write-lock\";\nimport { hasMessage, settle, useDayText, usePersonLabel } from \"./admin-parts\";\nimport type { AdminPerson, MaybePromise } from \"./admin-parts\";\nimport { RoleSelect } from \"./role-select\";\n\n/**\n * Who is invited, and the form that invites (docs/user-admin-harmonization.md §5; auth\n * §4.4: a hashed one-time token, 14 days, an address with a role and a scope).\n *\n * Kurvenschmiede's `invitations-panel.tsx` with its parts made props: a form (the address,\n * a role from the app's vocabulary, an optional scope — a team, a company — the language\n * the invitation is written in, a note), then one row per invitation with its status, when\n * it was sent and until when it works, and resend / copy link / revoke.\n *\n * - **It assumes nothing about who invites.** Admins do, team managers into their team,\n * kastlan's company admins into their company — and in keksdose ANY budget owner, from\n * the budget's sharing (Marcel, 2026-10-07). So no word here says \"admin\"; the roles,\n * the scopes and the callbacks are the app's, and so is the frame around it.\n * - **The address is someone else's.** No `+app` tag is offered (auth §4.5): a tag is\n * the owner's own choice, made when they sign up.\n * - **The link is shown once.** The token is stored hashed, so the server can show a link\n * only in the answer that minted it — on creation and on resend, and only while mail\n * goes to the console (dev, a deploy without mail). The panel keeps such a link for as\n * long as it is mounted and offers to copy it on its row; reloading the page loses it,\n * and \"resend\" mints a new one. With the console backend the panel says so up front.\n * - **Revoked is optional.** An app that deletes the row instead (kastlan) never sends\n * `revoked`; the status chip simply never says it (§5).\n *\n * It never sends a request: `onInvite`, `onResend` and `onRevoke` do.\n */\n\nexport type InvitationStatus = \"open\" | \"accepted\" | \"expired\" | \"revoked\";\n\n/** One row of `GET /admin/invitations` (§5), in the wire's own field names. */\nexport interface InvitationRow<R extends string = string> {\n id: string | number;\n email: string;\n role?: R | null;\n /** The scope's value — a team's or a company's id, matched against `scopes`. */\n scope?: string | number | null;\n note?: string | null;\n /** The language it was written in. */\n locale?: string | null;\n /** Who sent it: a name, or the person. */\n invited_by?: string | AdminPerson | null;\n created_at: DateInput;\n expires_at?: DateInput;\n status: InvitationStatus;\n /** The one-time link, while mail goes to the console — in the answer that minted it. */\n link?: string | null;\n}\n\n/** What the form sends — `POST /admin/invitations {email, role, scope?, note?, locale}`. */\nexport interface InvitationDraft<R extends string = string> {\n email: string;\n /** Absent when the app offers no role choice (`roles` left out). */\n role?: R;\n scope?: string;\n note?: string;\n locale: KitLanguageCode;\n}\n\n/** What `onInvite` / `onResend` may answer, so the panel can keep a shown-once link. */\nexport interface InvitationSentAnswer {\n /** The invitation the answer is about — `onInvite` needs it for the link to find its\n * row; `onResend` knows it already. */\n id?: string | number;\n /** The one-time link, while mail goes to the console. */\n link?: string | null;\n /** `false`: the invitation exists but the mail failed — say so, resend it. */\n sent?: boolean;\n}\n\n/** A scope an invitation can carry. */\nexport interface InvitationScope {\n value: string;\n label: string;\n}\n\n/** The `invitations` namespace. */\nexport interface InvitationsLabels {\n /** The form's address field. */\n email: string;\n /** Under it while what was typed is not an address. */\n invalidEmail: string;\n role: string;\n /** The scope select's label — the app's word (\"Team\", \"Company\") goes over it. */\n scope: string;\n /** The scope select's empty choice. */\n scopeNone: string;\n /** The language select's label. */\n language: string;\n note: string;\n /** The form's button. */\n invite: string;\n /** Heading over the rows. */\n listTitle: string;\n empty: string;\n loading: string;\n /** The status chip, per status. */\n status: Record<InvitationStatus, string>;\n /** \"Sent 6 Oct 2026\". */\n sent: (date: string) => string;\n /** \"Expires 20 Oct 2026\" — on an open invitation. */\n expires: (date: string) => string;\n /** \"by Ada Example\". */\n invitedBy: (name: string) => string;\n /** The resend button — \"Send ben@example.com a new link\". */\n resend: (email: string) => string;\n /** The copy button. */\n copyLink: string;\n /** The revoke button — \"Revoke the invitation for ben@example.com\". */\n revoke: (email: string) => string;\n /** Over everything while mail goes to the console. */\n consoleHint: string;\n /** Beside a link the answer carried with no row to put it on. */\n linkReady: (email: string) => string;\n /** The answer said the mail was not sent. */\n notSent: (email: string) => string;\n /** A rejected callback, unless `describeError` says better. */\n failed: string;\n}\n\nexport const DEFAULT_INVITATIONS_LABELS: InvitationsLabels = {\n email: \"Email address\",\n invalidEmail: \"Enter a complete email address.\",\n role: \"Role\",\n scope: \"Scope\",\n scopeNone: \"None\",\n language: \"Language of the invitation\",\n note: \"Note\",\n invite: \"Invite\",\n listTitle: \"Invitations\",\n empty: \"Nobody has been invited yet.\",\n loading: \"Loading…\",\n status: { open: \"Open\", accepted: \"Accepted\", expired: \"Expired\", revoked: \"Revoked\" },\n sent: (date) => `Sent ${date}`,\n expires: (date) => `Expires ${date}`,\n invitedBy: (name) => `by ${name}`,\n resend: (email) => `Send ${email} a new link`,\n copyLink: \"Copy invitation link\",\n revoke: (email) => `Revoke the invitation for ${email}`,\n consoleHint:\n \"Mail isn’t sent on this server — it is written to the server log. Copy each invitation link from here and pass it on yourself: it is shown only once.\",\n linkReady: (email) => `The invitation link for ${email}, shown only this once:`,\n notSent: (email) => `${email} is invited, but the mail couldn’t be sent. Resend it.`,\n failed: \"That didn’t work. Please try again.\",\n};\n\n/** The tone of each status. */\nconst STATUS_TONES: Readonly<Record<InvitationStatus, ChipTone>> = {\n open: \"info\",\n accepted: \"success\",\n expired: \"warning\",\n revoked: \"neutral\",\n};\n\nexport interface InvitationsPanelProps<R extends string = string> {\n invitations: readonly InvitationRow<R>[];\n /** The app's roles. Left out: no role choice, and no role chip on a row. */\n roles?: RoleVocabulary<R>;\n /** The roles an invitation may carry — Kurvenschmiede's member or customer. Default:\n * the whole vocabulary. One role: no choice is drawn, and it is sent. */\n invitableRoles?: readonly R[];\n /** The role the form starts with. Default: the first invitable one. */\n defaultRole?: R;\n /** The scopes an invitation may carry — teams, companies. Left out: no scope field. */\n scopes?: readonly InvitationScope[];\n /** A scope must be chosen (no \"None\"). */\n scopeRequired?: boolean;\n /** The languages offered. Default: all seven of the kit's. */\n languages?: readonly KitLanguageCode[];\n /** The language the form starts with. Default: the page's, resolved to `languages`. */\n defaultLocale?: string;\n /** The server's `mail_backend`. `\"console\"` draws the hint. */\n mailBackend?: string | null;\n /** Creates one (resolve to clear the form; reject to keep it and say why). Left out:\n * no form — a list someone may look at but not add to. */\n onInvite?: (draft: InvitationDraft<R>) => MaybePromise<InvitationSentAnswer | void>;\n /** Mints a new link and mails it. Left out: no resend button. */\n onResend?: (invitation: InvitationRow<R>) => MaybePromise<InvitationSentAnswer | void>;\n /** Revokes an open or an expired invitation (level `none`, §4.2: re-inviting undoes\n * it). An expired row can be resent, and since 0.31 also removed: in an app that\n * keeps the rows it would otherwise stay listed for good (Kurvenschmiede's 0.30\n * adoption). Left out: no revoke button. */\n onRevoke?: (invitation: InvitationRow<R>) => MaybePromise;\n /** The list is being fetched. */\n loading?: boolean;\n /** The app's words for a rejected callback. */\n describeError?: (error: unknown) => ReactNode | undefined;\n /** Over the form: who can be invited and what happens, in the app's words. */\n intro?: ReactNode;\n /** The list's visible heading. Default: the `listTitle` label. `null` leaves it out,\n * for a page whose card is already headed \"Invitations\" (Kurvenschmiede's 0.30\n * adoption); the list keeps the label as its accessible name either way. */\n listTitle?: ReactNode | null;\n className?: string;\n labels?: Partial<InvitationsLabels>;\n}\n\n// Shape only — whether the address may be invited is the server's question.\nconst EMAIL_SHAPE = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\nconst ALL_CODES: readonly KitLanguageCode[] = KIT_LANGUAGES.map((language) => language.code);\n\n/** A failed run, told apart from an answer of `undefined`. */\nconst FAILED = Symbol(\"failed\");\n\nexport function InvitationsPanel<R extends string = string>({\n invitations,\n roles,\n invitableRoles,\n defaultRole,\n scopes,\n scopeRequired = false,\n languages = ALL_CODES,\n defaultLocale,\n mailBackend,\n onInvite,\n onResend,\n onRevoke,\n loading = false,\n describeError,\n intro,\n listTitle,\n className,\n labels: labelsProp,\n}: InvitationsPanelProps<R>) {\n const labels = useKitLabels(\"invitations\", DEFAULT_INVITATIONS_LABELS, labelsProp);\n const kitLocale = useKitLocale();\n const dayText = useDayText();\n const nameOf = usePersonLabel();\n const lock = useWriteLock();\n const offered: readonly R[] = invitableRoles ?? (roles ? (Object.keys(roles) as R[]) : []);\n const [email, setEmail] = useState(\"\");\n const [invalid, setInvalid] = useState(false);\n const [role, setRole] = useState<R | undefined>(defaultRole ?? offered[0]);\n const [scope, setScope] = useState(\"\");\n const [locale, setLocale] = useState<KitLanguageCode>(() =>\n resolveLanguage([defaultLocale, kitLocale], languages),\n );\n const [note, setNote] = useState(\"\");\n // One request at a time, for the whole panel; the key says which control spins.\n const [busy, setBusy] = useState<string | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n const [notice, setNotice] = useState<ReactNode>(null);\n // Links the answers carried, by invitation — shown once, kept while mounted.\n const [links, setLinks] = useState<Record<string, string>>({});\n // A link whose answer named no invitation: shown above the list instead.\n const [looseLink, setLooseLink] = useState<{ email: string; link: string } | null>(null);\n\n const run = async <T,>(key: string, call: () => MaybePromise<T>): Promise<T | void | typeof FAILED> => {\n setBusy(key);\n setFailure(null);\n setNotice(null);\n try {\n return await settle(call);\n } catch (error) {\n const own = describeError?.(error);\n setFailure(hasMessage(own) ? own : labels.failed);\n return FAILED;\n } finally {\n setBusy(null);\n }\n };\n\n /** Keep what an answer carried: its link, and whether the mail went. */\n const took = (answer: InvitationSentAnswer | void, address: string, id?: string | number) => {\n if (!answer) return;\n const key = answer.id ?? id;\n if (answer.link) {\n if (key !== undefined) setLinks((known) => ({ ...known, [String(key)]: answer.link as string }));\n else setLooseLink({ email: address, link: answer.link });\n }\n if (answer.sent === false) setNotice(labels.notSent(address));\n };\n\n const address = email.trim();\n const choosesRole = roles !== undefined && offered.length > 1;\n const canInvite = onInvite !== undefined;\n\n const submit = async (event: FormEvent) => {\n event.preventDefault();\n // Enter in a field is a commit too — the button's lock does not see it.\n if (!onInvite || busy || lock.locked || address === \"\") return;\n if (!EMAIL_SHAPE.test(address)) {\n setInvalid(true);\n return;\n }\n if (scopes && scopeRequired && scope === \"\") return;\n const draft: InvitationDraft<R> = {\n email: address,\n locale,\n ...(role !== undefined && roles !== undefined ? { role } : {}),\n ...(scope !== \"\" ? { scope } : {}),\n ...(note.trim() !== \"\" ? { note: note.trim() } : {}),\n };\n const answer = await run(\"invite\", () => onInvite(draft));\n if (answer === FAILED) return;\n took(answer, address);\n setEmail(\"\");\n setNote(\"\");\n };\n\n const scopeLabel = (value: InvitationRow[\"scope\"]) =>\n value === null || value === undefined || value === \"\"\n ? null\n : (scopes?.find((s) => s.value === String(value))?.label ?? String(value));\n\n return (\n <div className={cn(\"space-y-3\", className)}>\n {intro && <div className=\"text-sm text-[var(--text-secondary)]\">{intro}</div>}\n {mailBackend === \"console\" && (\n <AlertBanner tone=\"info\" size=\"sm\">\n {labels.consoleHint}\n </AlertBanner>\n )}\n\n {canInvite && (\n <form noValidate onSubmit={submit} className=\"@container space-y-2\">\n <div className=\"grid grid-cols-1 gap-2 @md:grid-cols-2\">\n <Input\n label={labels.email}\n type=\"email\"\n inputMode=\"email\"\n autoComplete=\"off\"\n autoCapitalize=\"none\"\n spellCheck={false}\n required\n value={email}\n error={invalid ? labels.invalidEmail : undefined}\n data-private\n onChange={(event) => {\n setInvalid(false);\n setEmail(event.target.value);\n }}\n />\n {choosesRole && (\n <RoleSelect<R>\n label={labels.role}\n value={role}\n roles={roles}\n offered={offered}\n onChange={setRole}\n />\n )}\n {scopes && scopes.length > 0 && (\n <Select\n label={labels.scope}\n value={scope}\n required={scopeRequired}\n onChange={(event) => setScope(event.target.value)}\n >\n <option value=\"\" disabled={scopeRequired}>\n {labels.scopeNone}\n </option>\n {scopes.map((s) => (\n <option key={s.value} value={s.value}>\n {s.label}\n </option>\n ))}\n </Select>\n )}\n {languages.length > 1 && (\n <LanguageSelect label={labels.language} codes={languages} value={locale} onChange={setLocale} />\n )}\n <Input\n label={labels.note}\n value={note}\n maxLength={255}\n onChange={(event) => setNote(event.target.value)}\n className=\"@md:col-span-2\"\n />\n </div>\n <div className=\"flex justify-end\">\n <Button\n type=\"submit\"\n variant=\"brand\"\n commit\n pending={busy === \"invite\"}\n disabled={busy !== null || address === \"\" || (scopeRequired && scopes !== undefined && scope === \"\")}\n >\n <UserPlus className=\"size-4\" aria-hidden />\n {labels.invite}\n </Button>\n </div>\n </form>\n )}\n\n {failure && (\n <AlertBanner tone=\"danger\" size=\"sm\">\n {failure}\n </AlertBanner>\n )}\n {notice && (\n <AlertBanner tone=\"warning\" size=\"sm\" onDismiss={() => setNotice(null)}>\n {notice}\n </AlertBanner>\n )}\n {looseLink && (\n <AlertBanner tone=\"info\" size=\"sm\" onDismiss={() => setLooseLink(null)}>\n <div className=\"flex min-w-0 flex-wrap items-center gap-2\">\n <span data-private>{labels.linkReady(looseLink.email)}</span>\n <code className=\"min-w-0 break-all text-xs\">{looseLink.link}</code>\n <CopyButton size=\"xs\" text={looseLink.link} label={labels.copyLink} />\n </div>\n </AlertBanner>\n )}\n\n <div className=\"space-y-2\">\n {listTitle !== null && <SectionLabel as=\"h4\">{listTitle ?? labels.listTitle}</SectionLabel>}\n {loading && invitations.length === 0 ? (\n <div className=\"flex justify-center py-3\">\n <Spinner label={labels.loading} />\n </div>\n ) : invitations.length === 0 ? (\n <Caption>{labels.empty}</Caption>\n ) : (\n <ul aria-label={labels.listTitle} className=\"divide-y divide-[var(--border)]\">\n {invitations.map((invitation) => {\n const key = String(invitation.id);\n const link = invitation.link ?? links[key];\n const open = invitation.status === \"open\";\n const resendable = onResend && (open || invitation.status === \"expired\");\n const revocable = onRevoke && (open || invitation.status === \"expired\");\n const scopeText = scopeLabel(invitation.scope);\n const by =\n typeof invitation.invited_by === \"string\" ? invitation.invited_by : nameOf(invitation.invited_by);\n const facts = [\n dayText(invitation.created_at) && labels.sent(dayText(invitation.created_at)),\n open && dayText(invitation.expires_at ?? null) && labels.expires(dayText(invitation.expires_at ?? null)),\n by && labels.invitedBy(by),\n ].filter(Boolean);\n return (\n <li key={key} data-status={invitation.status} className=\"py-2 first:pt-0 last:pb-0\">\n <div className=\"flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5\">\n <div className=\"min-w-0 flex-1 basis-48 space-y-1\">\n <div data-private className=\"truncate text-sm font-medium text-[var(--text-primary)]\">\n {invitation.email}\n </div>\n <div className=\"flex flex-wrap items-center gap-1\">\n <Chip size=\"xs\" shape=\"square\" caps tone={STATUS_TONES[invitation.status]}>\n {labels.status[invitation.status]}\n </Chip>\n {roles && invitation.role && <RoleChip<R> value={invitation.role} roles={roles} size=\"xs\" />}\n {scopeText && (\n <Chip size=\"xs\" shape=\"square\">\n {scopeText}\n </Chip>\n )}\n </div>\n {(facts.length > 0 || invitation.note) && (\n <div className=\"text-xs text-[var(--text-muted)]\">\n {facts.join(\" · \")}\n {invitation.note && (\n <>\n {facts.length > 0 && \" · \"}\n <span data-private>{invitation.note}</span>\n </>\n )}\n </div>\n )}\n </div>\n {(link || resendable || revocable) && (\n <div className=\"ms-auto flex shrink-0 items-center gap-1\">\n {/* The copy stays its own icon: it says \"Copied\" where it was\n pressed, which a menu entry that closes cannot. */}\n {link && open && <CopyButton size=\"xs\" tone=\"muted\" text={link} label={labels.copyLink} />}\n {/* Resend and revoke are the row's actions (docs/text-size-\n harmonization.md §10.8): two icons at Normal, one \"⋯\" menu at\n Large, where both names as text (\"Send … a new link\") would\n not fit a phone's row beside the copy icon. */}\n <RowActions\n name={invitation.email}\n actions={[\n resendable && {\n key: \"resend\",\n label: labels.resend(invitation.email),\n icon: RefreshCw,\n commit: true,\n pending: busy === `resend:${key}`,\n disabled: busy !== null,\n onSelect: () =>\n void (async () => {\n const answer = await run(`resend:${key}`, () => onResend(invitation));\n if (answer !== FAILED) took(answer, invitation.email, invitation.id);\n })(),\n },\n revocable && {\n key: \"revoke\",\n label: labels.revoke(invitation.email),\n icon: Trash2,\n tone: \"danger\",\n commit: true,\n pending: busy === `revoke:${key}`,\n disabled: busy !== null,\n onSelect: () => void run(`revoke:${key}`, () => onRevoke(invitation)),\n },\n ]}\n />\n </div>\n )}\n </div>\n </li>\n );\n })}\n </ul>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";AAyUgB,SAgJY,UAhJZ,KAoCF,YApCE;AAzUhB,SAAS,gBAAgB;AAEzB,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,UAAU;AAEnB,SAAS,cAAc,oBAAoB;AAC3C,SAAS,eAAe,uBAAuB;AAE/C,SAAS,gBAAgB;AAEzB,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AAErB,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,cAAc,eAAe;AACtC,SAAS,kBAAkB;AAC3B,SAAS,QAAQ,OAAO,QAAQ,eAAe;AAC/C,SAAS,oBAAoB;AAC7B,SAAS,YAAY,QAAQ,YAAY,sBAAsB;AAE/D,SAAS,kBAAkB;AAwHpB,MAAM,6BAAgD;AAAA,EAC3D,OAAO;AAAA,EACP,cAAc;AAAA,EACd,MAAM;AAAA,EACN,OAAO;AAAA,EACP,WAAW;AAAA,EACX,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ,EAAE,MAAM,QAAQ,UAAU,YAAY,SAAS,WAAW,SAAS,UAAU;AAAA,EACrF,MAAM,CAAC,SAAS,QAAQ,IAAI;AAA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ACnB,UAAU,MACR,MAAM,YAAY;AAChB,4BAAM,SAAS,MAAM,IAAI,UAAU,GAAG,IAAI,MAAM,SAAS,UAAU,CAAC;AACpE,0BAAI,WAAW,OAAQ,MAAK,QAAQ,WAAW,OAAO,WAAW,EAAE;AAAA,oBACrE,GAAG;AAAA,kBACP;AAAA,kBACA,aAAa;AAAA,oBACX,KAAK;AAAA,oBACL,OAAO,OAAO,OAAO,WAAW,KAAK;AAAA,oBACrC,MAAM;AAAA,oBACN,MAAM;AAAA,oBACN,QAAQ;AAAA,oBACR,SAAS,SAAS,UAAU,GAAG;AAAA,oBAC/B,UAAU,SAAS;AAAA,oBACnB,UAAU,MAAM,KAAK,IAAI,UAAU,GAAG,IAAI,MAAM,SAAS,UAAU,CAAC;AAAA,kBACtE;AAAA,gBACF;AAAA;AAAA,YACF;AAAA,aACF;AAAA,WAEJ,KApEO,GAqET;AAAA,MAEJ,CAAC,GACH;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":["address"]}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
export {
|
|
2
|
+
export { cM as DEFAULT_REVIEWER_SCOPE_LABELS, ez as ReviewerScope, eA as ReviewerScopeArea, eB as ReviewerScopeEditor, eC as ReviewerScopeEditorProps, eD as ReviewerScopeLabels, eE as ReviewerScopeLanguage } from '../delete-account-setting-FLyJf-kZ.js';
|
|
3
3
|
import './admin-parts.js';
|
|
4
4
|
import '../components/tooltip.js';
|
|
5
5
|
import '../hooks/use-anchored-rect.js';
|
|
6
6
|
import '../lib/clipping.js';
|
|
7
|
-
import '../data-table-labels-
|
|
7
|
+
import '../data-table-labels-kpAAVi6g.js';
|
|
8
8
|
import '../components/data-table-sort.js';
|
|
9
9
|
import '../components/swipeable-row.js';
|
|
10
10
|
import '../components/mini-calendar.js';
|
|
11
11
|
import '../components/calendar-heatmap.js';
|
|
12
12
|
import '../components/popover.js';
|
|
13
|
+
import '../hooks/use-breakpoint.js';
|
|
13
14
|
import '../components/chip.js';
|
|
14
15
|
import 'lucide-react';
|
|
16
|
+
import '../components/field-parts.js';
|
|
15
17
|
import '../components/field-sync.js';
|
|
16
18
|
import '../wizard/types.js';
|
|
17
19
|
import '../tour/tour.js';
|
|
@@ -79,6 +81,9 @@ import '../components/account-chips.js';
|
|
|
79
81
|
import './admin-action-log.js';
|
|
80
82
|
import '../settings/settings-labels.js';
|
|
81
83
|
import '../demo/demo-labels.js';
|
|
84
|
+
import '../components/appearance-labels.js';
|
|
85
|
+
import '../theme/contrast.js';
|
|
86
|
+
import '../theme/text-size.js';
|
|
82
87
|
import '../components/reauth-dialog.js';
|
|
83
88
|
import '../components/server-wake.js';
|
|
84
89
|
import '../lib/server-wake.js';
|
|
@@ -92,4 +97,4 @@ import '../components/sign-chip.js';
|
|
|
92
97
|
import '../components/column-mapper.js';
|
|
93
98
|
import '../lib/column-mapping.js';
|
|
94
99
|
import '../lib/table-text.js';
|
|
95
|
-
import '../components/
|
|
100
|
+
import '../components/focus-ring.js';
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import 'react';
|
|
2
2
|
import '../components/account-chips.js';
|
|
3
|
-
export {
|
|
3
|
+
export { cN as DEFAULT_ROLE_SELECT_LABELS, eG as RoleLock, eH as RoleLockCode, eI as RoleSelect, eJ as RoleSelectLabels, eK as RoleSelectProps, eL as RolesEditor, eM as RolesEditorProps } from '../delete-account-setting-FLyJf-kZ.js';
|
|
4
4
|
import 'lucide-react';
|
|
5
5
|
import '../lib/format.js';
|
|
6
6
|
import '../components/chip.js';
|
|
7
|
-
import '../
|
|
8
|
-
import '../components/data-table-sort.js';
|
|
9
|
-
import '../components/swipeable-row.js';
|
|
7
|
+
import '../components/field-parts.js';
|
|
10
8
|
import '../components/tooltip.js';
|
|
11
9
|
import '../hooks/use-anchored-rect.js';
|
|
12
10
|
import '../lib/clipping.js';
|
|
11
|
+
import '../data-table-labels-kpAAVi6g.js';
|
|
12
|
+
import '../components/data-table-sort.js';
|
|
13
|
+
import '../components/swipeable-row.js';
|
|
13
14
|
import '../components/mini-calendar.js';
|
|
14
15
|
import '../components/calendar-heatmap.js';
|
|
15
16
|
import '../components/popover.js';
|
|
17
|
+
import '../hooks/use-breakpoint.js';
|
|
16
18
|
import '../components/field-sync.js';
|
|
17
19
|
import '../wizard/types.js';
|
|
18
20
|
import '../tour/tour.js';
|
|
@@ -79,6 +81,9 @@ import './admin-parts.js';
|
|
|
79
81
|
import './admin-action-log.js';
|
|
80
82
|
import '../settings/settings-labels.js';
|
|
81
83
|
import '../demo/demo-labels.js';
|
|
84
|
+
import '../components/appearance-labels.js';
|
|
85
|
+
import '../theme/contrast.js';
|
|
86
|
+
import '../theme/text-size.js';
|
|
82
87
|
import '../components/reauth-dialog.js';
|
|
83
88
|
import '../components/server-wake.js';
|
|
84
89
|
import '../lib/server-wake.js';
|
|
@@ -92,4 +97,4 @@ import '../components/sign-chip.js';
|
|
|
92
97
|
import '../components/column-mapper.js';
|
|
93
98
|
import '../lib/column-mapping.js';
|
|
94
99
|
import '../lib/table-text.js';
|
|
95
|
-
import '../components/
|
|
100
|
+
import '../components/focus-ring.js';
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
export {
|
|
2
|
+
export { cT as DEFAULT_TRANSFER_OWNERSHIP_LABELS, fl as TransferCandidate, fm as TransferOwnershipDialog, fn as TransferOwnershipDialogProps, fo as TransferOwnershipLabels, fp as TransferUnavailable, fq as TransferValues } from '../delete-account-setting-FLyJf-kZ.js';
|
|
3
3
|
import './admin-parts.js';
|
|
4
4
|
import '../components/tooltip.js';
|
|
5
5
|
import '../hooks/use-anchored-rect.js';
|
|
6
6
|
import '../lib/clipping.js';
|
|
7
|
-
import '../data-table-labels-
|
|
7
|
+
import '../data-table-labels-kpAAVi6g.js';
|
|
8
8
|
import '../components/data-table-sort.js';
|
|
9
9
|
import '../components/swipeable-row.js';
|
|
10
10
|
import '../components/mini-calendar.js';
|
|
11
11
|
import '../components/calendar-heatmap.js';
|
|
12
12
|
import '../components/popover.js';
|
|
13
|
+
import '../hooks/use-breakpoint.js';
|
|
13
14
|
import '../components/chip.js';
|
|
14
15
|
import 'lucide-react';
|
|
16
|
+
import '../components/field-parts.js';
|
|
15
17
|
import '../components/field-sync.js';
|
|
16
18
|
import '../wizard/types.js';
|
|
17
19
|
import '../tour/tour.js';
|
|
@@ -79,6 +81,9 @@ import '../components/account-chips.js';
|
|
|
79
81
|
import './admin-action-log.js';
|
|
80
82
|
import '../settings/settings-labels.js';
|
|
81
83
|
import '../demo/demo-labels.js';
|
|
84
|
+
import '../components/appearance-labels.js';
|
|
85
|
+
import '../theme/contrast.js';
|
|
86
|
+
import '../theme/text-size.js';
|
|
82
87
|
import '../components/reauth-dialog.js';
|
|
83
88
|
import '../components/server-wake.js';
|
|
84
89
|
import '../lib/server-wake.js';
|
|
@@ -92,4 +97,4 @@ import '../components/sign-chip.js';
|
|
|
92
97
|
import '../components/column-mapper.js';
|
|
93
98
|
import '../lib/column-mapping.js';
|
|
94
99
|
import '../lib/table-text.js';
|
|
95
|
-
import '../components/
|
|
100
|
+
import '../components/focus-ring.js';
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import 'react';
|
|
2
|
-
import 'lucide-react';
|
|
3
2
|
import '../lib/format.js';
|
|
4
3
|
import '../lib/person-name.js';
|
|
5
4
|
import '../components/account-chips.js';
|
|
6
5
|
import '../components/chip.js';
|
|
7
|
-
import '../data-table-labels-
|
|
6
|
+
import '../data-table-labels-kpAAVi6g.js';
|
|
8
7
|
import '../components/data-table-sort.js';
|
|
9
|
-
export { bz as AdminUserStateFields,
|
|
10
|
-
import '
|
|
8
|
+
export { bz as AdminUserStateFields, cU as DEFAULT_USER_ROSTER_LABELS, eF as RoleEditing, eN as RosterState, fv as USER_ROSTER_SORT_KEYS, fC as UserIdentityCell, fD as UserIdentityCellProps, fE as UserRosterColumnsOptions, fF as UserRosterLabels, fG as UserRosterRow, fH as UserRosterSortKey, fI as UserRowAction, fJ as UserRowActionList, fK as UserRowActions, fL as UserRowActionsProps, fM as adminUserStates, gc as useUserRosterColumns, gd as userRosterColumns, ge as userRosterSort } from '../delete-account-setting-FLyJf-kZ.js';
|
|
9
|
+
import 'lucide-react';
|
|
10
|
+
import '../components/field-parts.js';
|
|
11
11
|
import '../components/tooltip.js';
|
|
12
12
|
import '../hooks/use-anchored-rect.js';
|
|
13
13
|
import '../lib/clipping.js';
|
|
14
|
+
import '../components/swipeable-row.js';
|
|
14
15
|
import '../components/mini-calendar.js';
|
|
15
16
|
import '../components/calendar-heatmap.js';
|
|
16
17
|
import '../components/popover.js';
|
|
18
|
+
import '../hooks/use-breakpoint.js';
|
|
17
19
|
import '../components/field-sync.js';
|
|
18
20
|
import '../wizard/types.js';
|
|
19
21
|
import '../tour/tour.js';
|
|
@@ -79,6 +81,9 @@ import './admin-parts.js';
|
|
|
79
81
|
import './admin-action-log.js';
|
|
80
82
|
import '../settings/settings-labels.js';
|
|
81
83
|
import '../demo/demo-labels.js';
|
|
84
|
+
import '../components/appearance-labels.js';
|
|
85
|
+
import '../theme/contrast.js';
|
|
86
|
+
import '../theme/text-size.js';
|
|
82
87
|
import '../components/reauth-dialog.js';
|
|
83
88
|
import '../components/server-wake.js';
|
|
84
89
|
import '../lib/server-wake.js';
|
|
@@ -92,4 +97,4 @@ import '../components/sign-chip.js';
|
|
|
92
97
|
import '../components/column-mapper.js';
|
|
93
98
|
import '../lib/column-mapping.js';
|
|
94
99
|
import '../lib/table-text.js';
|
|
95
|
-
import '../components/
|
|
100
|
+
import '../components/focus-ring.js';
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
import { MoreHorizontal } from "lucide-react";
|
|
5
4
|
import { cn } from "../lib/cn.js";
|
|
6
5
|
import { useKitLabels, useKitLocale } from "../i18n/kit-labels.js";
|
|
7
6
|
import { AccountStateChip, RoleChip, dateColumn } from "../components/account-chips.js";
|
|
8
7
|
import { encodeSorts } from "../components/data-table-sort.js";
|
|
9
|
-
import {
|
|
10
|
-
import { Button, IconButton } from "../components/ui.js";
|
|
8
|
+
import { RowActions } from "../components/row-actions.js";
|
|
11
9
|
import { UserAvatar } from "../components/user-avatar.js";
|
|
12
10
|
import { personLabel } from "./admin-parts.js";
|
|
13
11
|
import { RoleSelect } from "./role-select.js";
|
|
@@ -63,51 +61,13 @@ function UserIdentityCell({
|
|
|
63
61
|
}
|
|
64
62
|
function UserRowActions({ actions, name, labels: labelsProp }) {
|
|
65
63
|
const labels = useKitLabels("userRoster", DEFAULT_USER_ROSTER_LABELS, labelsProp);
|
|
66
|
-
const entries = actions.filter((a) => Boolean(a) && !a.hidden);
|
|
67
|
-
if (entries.length === 0) return null;
|
|
68
|
-
const title = labels.actionsFor(name);
|
|
69
64
|
return /* @__PURE__ */ jsx(
|
|
70
|
-
|
|
65
|
+
RowActions,
|
|
71
66
|
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
IconButton,
|
|
77
|
-
{
|
|
78
|
-
ref,
|
|
79
|
-
size: "xs",
|
|
80
|
-
label: title,
|
|
81
|
-
"aria-haspopup": "dialog",
|
|
82
|
-
"aria-expanded": open,
|
|
83
|
-
stopPropagation: true,
|
|
84
|
-
onClick: toggle,
|
|
85
|
-
children: /* @__PURE__ */ jsx(MoreHorizontal, {})
|
|
86
|
-
}
|
|
87
|
-
),
|
|
88
|
-
children: (close) => /* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: entries.map((action) => {
|
|
89
|
-
const Icon = action.icon;
|
|
90
|
-
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
91
|
-
Button,
|
|
92
|
-
{
|
|
93
|
-
type: "button",
|
|
94
|
-
variant: "ghost",
|
|
95
|
-
size: "sm",
|
|
96
|
-
stretch: true,
|
|
97
|
-
tone: action.tone === "danger" ? "danger" : void 0,
|
|
98
|
-
disabledReason: action.disabledReason,
|
|
99
|
-
className: "justify-start",
|
|
100
|
-
onClick: () => {
|
|
101
|
-
close();
|
|
102
|
-
action.onSelect();
|
|
103
|
-
},
|
|
104
|
-
children: [
|
|
105
|
-
Icon && /* @__PURE__ */ jsx(Icon, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
106
|
-
action.label
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
) }, action.key ?? action.label);
|
|
110
|
-
}) })
|
|
67
|
+
actions,
|
|
68
|
+
name,
|
|
69
|
+
collapse: "menu",
|
|
70
|
+
labels: { actionsFor: labels.actionsFor }
|
|
111
71
|
}
|
|
112
72
|
);
|
|
113
73
|
}
|
|
@@ -219,7 +179,8 @@ function userRosterColumns({
|
|
|
219
179
|
column: { mobileHidden: true }
|
|
220
180
|
}),
|
|
221
181
|
// How long ago rather than a date — the question is "recently?" — with the exact
|
|
222
|
-
// time
|
|
182
|
+
// time beside it (keksdose's last-seen column, Kurvenschmiede's; 0.32 §4: never only
|
|
183
|
+
// in a tooltip).
|
|
223
184
|
dateColumn({
|
|
224
185
|
key: "last_login",
|
|
225
186
|
header: labels.lastLogin,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/admin/user-roster.tsx"],"sourcesContent":["import { useMemo } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { MoreHorizontal } from \"lucide-react\";\nimport type { LucideIcon } from \"lucide-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 { Popover } from \"../components/popover\";\nimport { Button, IconButton } from \"../components/ui\";\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.\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 font-medium text-[var(--text-primary)]\">\n {named || address}\n </span>\n {badge}\n </div>\n {named && address && (\n <div data-private className=\"truncate 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). */\nexport interface UserRowAction {\n /** React key. Default: the label. */\n key?: string;\n label: string;\n /** Runs it — usually opens `AdminActionConfirm` with the level the server states. */\n onSelect: () => void;\n icon?: LucideIcon;\n /** `danger` for deactivate, transfer, erase. */\n tone?: \"default\" | \"danger\";\n /** Why it is not available for this row (\"You can’t deactivate yourself\"). The entry\n * stays in the menu, focusable, and says so — an action that silently vanished\n * would leave the admin looking for it. */\n disabledReason?: ReactNode;\n /** Leave it out for this row. */\n hidden?: boolean;\n}\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 = readonly (UserRowAction | false | null | undefined)[];\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 */\nexport function UserRowActions({ actions, name, labels: labelsProp }: UserRowActionsProps) {\n const labels = useKitLabels(\"userRoster\", DEFAULT_USER_ROSTER_LABELS, labelsProp);\n const entries = actions.filter((a): a is UserRowAction => Boolean(a) && !(a as UserRowAction).hidden);\n if (entries.length === 0) return null;\n const title = labels.actionsFor(name);\n return (\n <Popover\n width={240}\n aria-label={title}\n className=\"p-1\"\n trigger={({ open, toggle, ref }) => (\n <IconButton\n ref={ref}\n size=\"xs\"\n label={title}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n stopPropagation\n onClick={toggle}\n >\n <MoreHorizontal />\n </IconButton>\n )}\n >\n {(close) => (\n <ul className=\"space-y-0.5\">\n {entries.map((action) => {\n const Icon = action.icon;\n return (\n <li key={action.key ?? action.label}>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n stretch\n tone={action.tone === \"danger\" ? \"danger\" : undefined}\n disabledReason={action.disabledReason}\n className=\"justify-start\"\n onClick={() => {\n close();\n action.onSelect();\n }}\n >\n {Icon && <Icon className=\"size-4 shrink-0\" aria-hidden />}\n {action.label}\n </Button>\n </li>\n );\n })}\n </ul>\n )}\n </Popover>\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 in a tooltip (keksdose's last-seen column, Kurvenschmiede's).\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,SA0KR,UA1KQ,KAET,YAFS;AAnMjB,SAAS,eAAe;AAExB,SAAS,sBAAsB;AAE/B,SAAS,UAAU;AAGnB,SAAS,cAAc,oBAAoB;AAC3C,SAAS,kBAAkB,UAAU,kBAAkB;AAIvD,SAAS,mBAAmB;AAE5B,SAAS,eAAe;AACxB,SAAS,QAAQ,kBAAkB;AACnC,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,MAAM,IAAI,yBAAyB,KAAK,CAAC;AAAA,EACzE,WAAW,IAAI,cAAc,QAAW;AACtC,QAAI,KAAK,IAAI,YAAY,WAAW,UAAU;AAAA,EAChD;AACA,MAAI,IAAI,mBAAmB,MAAO,KAAI,KAAK,YAAY;AACvD,MAAI,IAAI,4BAA6B,KAAI,KAAK,gBAAgB;AAC9D,SAAO;AACT;AAGO,MAAM,wBAAwB,CAAC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AAQ;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 } 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.\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 font-medium text-[var(--text-primary)]\">\n {named || address}\n </span>\n {badge}\n </div>\n {named && address && (\n <div data-private className=\"truncate 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":";AAiMiB,SAoHR,UApHQ,KAET,YAFS;AAjMjB,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,MAAM,IAAI,yBAAyB,KAAK,CAAC;AAAA,EACzE,WAAW,IAAI,cAAc,QAAW;AACtC,QAAI,KAAK,IAAI,YAAY,WAAW,UAAU;AAAA,EAChD;AACA,MAAI,IAAI,mBAAmB,MAAO,KAAI,KAAK,YAAY;AACvD,MAAI,IAAI,4BAA6B,KAAI,KAAK,gBAAgB;AAC9D,SAAO;AACT;AAGO,MAAM,wBAAwB,CAAC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