@eifi1/ui-kit 0.54.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -76
- package/dist/admin/plan-change.js +2 -2
- package/dist/admin/plan-change.js.map +1 -1
- package/dist/admin/user-roster.d.ts +6 -0
- package/dist/admin/user-roster.js +4 -0
- package/dist/admin/user-roster.js.map +1 -1
- package/dist/billing/billing-labels.d.ts +26 -0
- package/dist/billing/billing-labels.js +9 -0
- package/dist/billing/billing-labels.js.map +1 -1
- package/dist/billing/subscription-standing.d.ts +61 -0
- package/dist/billing/subscription-standing.js +51 -0
- package/dist/billing/subscription-standing.js.map +1 -0
- package/dist/billing/usage-meter.d.ts +52 -0
- package/dist/billing/usage-meter.js +52 -0
- package/dist/billing/usage-meter.js.map +1 -0
- package/dist/chart.d.ts +1 -0
- package/dist/chart.js +4 -0
- package/dist/chart.js.map +1 -1
- package/dist/components/alert-banner.js +2 -3
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.js +3 -15
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/autocomplete.js +2 -2
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/bulk-action-bar.js +2 -1
- package/dist/components/bulk-action-bar.js.map +1 -1
- package/dist/components/button.d.ts +35 -1
- package/dist/components/button.js +5 -9
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-heatmap.js +2 -2
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/camera-button.d.ts +89 -0
- package/dist/components/camera-button.js +122 -0
- package/dist/components/camera-button.js.map +1 -0
- package/dist/components/camera-capture.d.ts +66 -0
- package/dist/components/camera-capture.js +190 -0
- package/dist/components/camera-capture.js.map +1 -0
- package/dist/components/camera-labels.d.ts +20 -0
- package/dist/components/camera-labels.js +15 -0
- package/dist/components/camera-labels.js.map +1 -0
- package/dist/components/chart-edge.d.ts +9 -0
- package/dist/components/chart-edge.js +14 -3
- package/dist/components/chart-edge.js.map +1 -1
- package/dist/components/chart-zoom-core.js +34 -29
- package/dist/components/chart-zoom-core.js.map +1 -1
- package/dist/components/checkbox-group.js +1 -1
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/combobox-core.js +3 -2
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.js +2 -2
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/consent-again-notice-labels.d.ts +25 -0
- package/dist/components/consent-again-notice-labels.js +15 -0
- package/dist/components/consent-again-notice-labels.js.map +1 -0
- package/dist/components/consent-again-notice.d.ts +85 -0
- package/dist/components/consent-again-notice.js +94 -0
- package/dist/components/consent-again-notice.js.map +1 -0
- package/dist/components/country-select.js +2 -7
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/currency-select.js +2 -2
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm.js +2 -2
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-column-settings.js +2 -2
- package/dist/components/data-table-column-settings.js.map +1 -1
- package/dist/components/data-table-fit.js.map +1 -1
- package/dist/components/data-table-virtual.js +13 -3
- package/dist/components/data-table-virtual.js.map +1 -1
- package/dist/components/date-field.js +2 -2
- package/dist/components/date-field.js.map +1 -1
- package/dist/components/date-picker.js +2 -2
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.js +2 -6
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/dialog-frame.d.ts +3 -1
- package/dist/components/dialog-frame.js.map +1 -1
- package/dist/components/dropdown.js +7 -3
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/entity-combobox.js +2 -2
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/field-parts.d.ts +108 -6
- package/dist/components/field-parts.js +59 -6
- package/dist/components/field-parts.js.map +1 -1
- package/dist/components/field-suggestion-labels.d.ts +2 -0
- package/dist/components/field-suggestion-labels.js +10 -0
- package/dist/components/field-suggestion-labels.js.map +1 -0
- package/dist/components/field.js +1 -1
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-button.d.ts +1 -1
- package/dist/components/file-button.js.map +1 -1
- package/dist/components/floating-panel.d.ts +7 -6
- package/dist/components/floating-panel.js +3 -17
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/form-actions.d.ts +3 -2
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/hover-menu.js +3 -2
- package/dist/components/hover-menu.js.map +1 -1
- package/dist/components/icon-button.d.ts +23 -5
- package/dist/components/icon-button.js +6 -8
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/inline-confirm.js +2 -1
- package/dist/components/inline-confirm.js.map +1 -1
- package/dist/components/inline-entity-combobox.js +2 -2
- package/dist/components/inline-entity-combobox.js.map +1 -1
- package/dist/components/input.js +2 -2
- package/dist/components/input.js.map +1 -1
- package/dist/components/jump-calendar.js +3 -3
- package/dist/components/jump-calendar.js.map +1 -1
- package/dist/components/legal.d.ts +13 -1
- package/dist/components/legal.js +12 -0
- package/dist/components/legal.js.map +1 -1
- package/dist/components/legended-series-chart.d.ts +80 -0
- package/dist/components/legended-series-chart.js +70 -0
- package/dist/components/legended-series-chart.js.map +1 -0
- package/dist/components/lightbox.js +2 -1
- package/dist/components/lightbox.js.map +1 -1
- package/dist/components/mini-calendar.js +13 -5
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.d.ts +23 -2
- package/dist/components/modal.js +24 -6
- package/dist/components/modal.js.map +1 -1
- package/dist/components/month-picker.d.ts +1 -1
- package/dist/components/month-picker.js +6 -6
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.js +2 -2
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/multi-select.js +2 -6
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/number-input.js +2 -2
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/page-header-layout.d.ts +18 -0
- package/dist/components/page-header-layout.js +23 -0
- package/dist/components/page-header-layout.js.map +1 -0
- package/dist/components/page-header-skeleton.d.ts +41 -0
- package/dist/components/page-header-skeleton.js +52 -0
- package/dist/components/page-header-skeleton.js.map +1 -0
- package/dist/components/page-header.js +4 -17
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/popover.js +7 -2
- package/dist/components/popover.js.map +1 -1
- package/dist/components/release-notes-labels.d.ts +16 -0
- package/dist/components/release-notes-labels.js +18 -0
- package/dist/components/release-notes-labels.js.map +1 -0
- package/dist/components/release-notes.d.ts +65 -0
- package/dist/components/release-notes.js +65 -0
- package/dist/components/release-notes.js.map +1 -0
- package/dist/components/select.js +2 -2
- package/dist/components/select.js.map +1 -1
- package/dist/components/series-chart-labels.d.ts +9 -0
- package/dist/components/series-chart-labels.js +3 -1
- package/dist/components/series-chart-labels.js.map +1 -1
- package/dist/components/series-chart.d.ts +5 -0
- package/dist/components/series-chart.js +89 -36
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/toggle-group.js +3 -2
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/treemap-layout.js.map +1 -1
- package/dist/components/treemap.d.ts +17 -15
- package/dist/components/treemap.js +167 -85
- package/dist/components/treemap.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/eslint/role-utilities.d.ts +2 -2
- package/dist/eslint/role-utilities.js.map +1 -1
- package/dist/feedback/feedback-inbox-page.d.ts +260 -0
- package/dist/feedback/feedback-inbox-page.js +207 -0
- package/dist/feedback/feedback-inbox-page.js.map +1 -0
- package/dist/feedback/feedback-vocabulary.js +2 -2
- package/dist/feedback/feedback-vocabulary.js.map +1 -1
- package/dist/feedback.d.ts +1 -0
- package/dist/feedback.js +6 -0
- package/dist/feedback.js.map +1 -1
- package/dist/hooks/use-debounce.d.ts +32 -5
- package/dist/hooks/use-debounce.js +6 -5
- package/dist/hooks/use-debounce.js.map +1 -1
- package/dist/hooks/use-file-picker.d.ts +3 -1
- package/dist/hooks/use-file-picker.js.map +1 -1
- package/dist/hooks/use-focus-trap.d.ts +19 -3
- package/dist/hooks/use-focus-trap.js +15 -5
- package/dist/hooks/use-focus-trap.js.map +1 -1
- package/dist/hooks/use-has-camera.d.ts +36 -0
- package/dist/hooks/use-has-camera.js +53 -0
- package/dist/hooks/use-has-camera.js.map +1 -0
- package/dist/hooks/use-hotkey.js +1 -10
- package/dist/hooks/use-hotkey.js.map +1 -1
- package/dist/hooks/use-overlay-history.d.ts +6 -1
- package/dist/hooks/use-overlay-history.js +10 -2
- package/dist/hooks/use-overlay-history.js.map +1 -1
- package/dist/i18n/defaults.js +11 -1
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.js +75 -3
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +20 -0
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/en.js +92 -4
- package/dist/i18n/locales/en.js.map +3 -3
- package/dist/i18n/locales/es.js +71 -3
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +72 -2
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +74 -3
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +74 -3
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +71 -3
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +22 -1
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +24 -5
- package/dist/index.js +35 -1
- package/dist/index.js.map +1 -1
- package/dist/landing/landing-labels.d.ts +8 -0
- package/dist/landing/landing-labels.js +2 -1
- package/dist/landing/landing-labels.js.map +1 -1
- package/dist/lib/changelog.d.ts +130 -0
- package/dist/lib/changelog.js +137 -0
- package/dist/lib/changelog.js.map +1 -0
- package/dist/lib/clipboard-minus.js +2 -2
- package/dist/lib/clipboard-minus.js.map +1 -1
- package/dist/lib/dates.d.ts +29 -3
- package/dist/lib/dates.js +41 -12
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/editable-content.d.ts +33 -0
- package/dist/lib/editable-content.js +15 -0
- package/dist/lib/editable-content.js.map +1 -0
- package/dist/lib/focus-left.d.ts +47 -1
- package/dist/lib/focus-left.js +11 -2
- package/dist/lib/focus-left.js.map +1 -1
- package/dist/lib/server-wake.d.ts +49 -9
- package/dist/lib/server-wake.js +25 -14
- package/dist/lib/server-wake.js.map +1 -1
- package/dist/lib/session-refresh.d.ts +53 -0
- package/dist/lib/session-refresh.js +27 -1
- package/dist/lib/session-refresh.js.map +1 -1
- package/dist/rhf/fields.js +3 -3
- package/dist/rhf/fields.js.map +1 -1
- package/dist/shell/app-shell.d.ts +25 -1
- package/dist/shell/app-shell.js +3 -1
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/dev-menu.d.ts +3 -0
- package/dist/shell/dev-menu.js +4 -2
- package/dist/shell/dev-menu.js.map +1 -1
- package/dist/shell/held-changes-banner-labels.d.ts +23 -0
- package/dist/shell/held-changes-banner-labels.js +14 -0
- package/dist/shell/held-changes-banner-labels.js.map +1 -0
- package/dist/shell/held-changes-banner.d.ts +75 -0
- package/dist/shell/held-changes-banner.js +106 -0
- package/dist/shell/held-changes-banner.js.map +1 -0
- package/dist/shell/sync-status-indicator.d.ts +27 -12
- package/dist/shell/sync-status-indicator.js +13 -4
- package/dist/shell/sync-status-indicator.js.map +1 -1
- package/dist/shell/top-bar-parts-labels.d.ts +5 -0
- package/dist/shell/top-bar-parts-labels.js +3 -1
- package/dist/shell/top-bar-parts-labels.js.map +1 -1
- package/dist/shell.d.ts +2 -0
- package/dist/shell.js +3 -0
- package/dist/shell.js.map +1 -1
- package/dist/sync/engine.d.ts +11 -2
- package/dist/sync/engine.js +13 -5
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync/hooks.d.ts +3 -2
- package/dist/sync/hooks.js +4 -2
- package/dist/sync/hooks.js.map +1 -1
- package/dist/testing/css-variables.generated.d.ts +2 -2
- package/dist/testing/css-variables.generated.js +1 -1
- package/dist/testing/css-variables.generated.js.map +1 -1
- package/dist/theme/chart-palette.d.ts +18 -0
- package/dist/theme/chart-palette.js +17 -1
- package/dist/theme/chart-palette.js.map +1 -1
- package/dist/theme/contrast-tokens.d.ts +3 -3
- package/dist/theme/contrast-tokens.js.map +1 -1
- package/dist/theme/contrast.d.ts +4 -4
- package/dist/theme/contrast.js.map +1 -1
- package/dist/tour/tour-overlay.js +2 -1
- package/dist/tour/tour-overlay.js.map +1 -1
- package/package.json +5 -9
- package/tokens.css +19 -54
- package/src/account/account-parts.ts +0 -47
- package/src/account/account-settings-labels.ts +0 -240
- package/src/account/account-settings.tsx +0 -698
- package/src/account/data-export-setting-labels.ts +0 -20
- package/src/account/data-export-setting.tsx +0 -200
- package/src/account/delete-account-setting-labels.ts +0 -33
- package/src/account/delete-account-setting.tsx +0 -342
- package/src/account/email-change-setting-labels.ts +0 -31
- package/src/account/email-change-setting.tsx +0 -443
- package/src/account/passkeys-setting.tsx +0 -445
- package/src/account/sessions-setting-labels.ts +0 -24
- package/src/account/sessions-setting.tsx +0 -283
- package/src/admin/admin-action-confirm-labels.ts +0 -19
- package/src/admin/admin-action-confirm.tsx +0 -509
- package/src/admin/admin-action-log-labels.ts +0 -83
- package/src/admin/admin-action-log.tsx +0 -464
- package/src/admin/admin-area-labels.ts +0 -114
- package/src/admin/admin-forbidden.tsx +0 -75
- package/src/admin/admin-overview.tsx +0 -258
- package/src/admin/admin-parts.ts +0 -68
- package/src/admin/admin-sections.tsx +0 -208
- package/src/admin/admin-tool-links.tsx +0 -90
- package/src/admin/invitations-panel-labels.ts +0 -31
- package/src/admin/invitations-panel.tsx +0 -516
- package/src/admin/mail-test-card-labels.ts +0 -19
- package/src/admin/mail-test-card.tsx +0 -189
- package/src/admin/plan-change-labels.ts +0 -5
- package/src/admin/plan-change.tsx +0 -474
- package/src/admin/reviewer-scope-editor-labels.ts +0 -16
- package/src/admin/reviewer-scope-editor.tsx +0 -224
- package/src/admin/role-select-labels.ts +0 -16
- package/src/admin/role-select.tsx +0 -282
- package/src/admin/transfer-ownership-dialog-labels.ts +0 -20
- package/src/admin/transfer-ownership-dialog.tsx +0 -162
- package/src/admin/user-roster-labels.ts +0 -17
- package/src/admin/user-roster.tsx +0 -559
- package/src/auth/accept-invitation-labels.ts +0 -21
- package/src/auth/accept-invitation.tsx +0 -210
- package/src/auth/auth-errors-labels.ts +0 -23
- package/src/auth/auth-errors.ts +0 -439
- package/src/auth/complete-name-dialog-labels.ts +0 -16
- package/src/auth/complete-name-dialog.tsx +0 -253
- package/src/auth/email-tag.ts +0 -75
- package/src/auth/forgot-password-form-labels.ts +0 -20
- package/src/auth/forgot-password-form.tsx +0 -221
- package/src/auth/form-rules.ts +0 -40
- package/src/auth/new-password-fields.tsx +0 -85
- package/src/auth/not-found-page-labels.ts +0 -12
- package/src/auth/not-found-page.tsx +0 -95
- package/src/auth/register-form-labels.ts +0 -31
- package/src/auth/register-form.tsx +0 -456
- package/src/auth/reset-password-form-labels.ts +0 -27
- package/src/auth/reset-password-form.tsx +0 -341
- package/src/auth/sign-in-form-labels.ts +0 -44
- package/src/auth/sign-in-form.tsx +0 -858
- package/src/auth/status-parts.tsx +0 -132
- package/src/auth/verify-email-labels.ts +0 -26
- package/src/auth/verify-email.tsx +0 -445
- package/src/billing/billing-banner.tsx +0 -258
- package/src/billing/billing-labels.ts +0 -381
- package/src/billing/billing-lock.ts +0 -108
- package/src/billing/billing-overview.ts +0 -157
- package/src/billing/billing-standing.ts +0 -80
- package/src/billing/cancel-request.ts +0 -97
- package/src/billing/cancel-subscription.tsx +0 -98
- package/src/billing/checkout-processing.ts +0 -394
- package/src/billing/checkout-return.ts +0 -90
- package/src/billing/pay-page.ts +0 -330
- package/src/billing/plan-card.tsx +0 -562
- package/src/billing/plan-change-labels.ts +0 -66
- package/src/billing/plan-limit-notice.tsx +0 -148
- package/src/billing/plan-limit-toast.tsx +0 -90
- package/src/billing/plan-limit.ts +0 -52
- package/src/billing/plan-price.ts +0 -98
- package/src/billing/plan-switch.tsx +0 -216
- package/src/billing/provider-page.ts +0 -84
- package/src/billing/subscription-actions.tsx +0 -247
- package/src/billing/subscription-status-chip.tsx +0 -95
- package/src/chart.ts +0 -103
- package/src/components/account-chips-labels.ts +0 -16
- package/src/components/account-chips.tsx +0 -474
- package/src/components/alert-banner.tsx +0 -670
- package/src/components/amount-input.tsx +0 -816
- package/src/components/appearance-labels.ts +0 -63
- package/src/components/authed-image-labels.ts +0 -11
- package/src/components/authed-image.tsx +0 -209
- package/src/components/autocomplete.tsx +0 -645
- package/src/components/breadcrumbs-labels.ts +0 -10
- package/src/components/breadcrumbs.tsx +0 -205
- package/src/components/bulk-action-bar-labels.ts +0 -11
- package/src/components/bulk-action-bar.tsx +0 -443
- package/src/components/button-group.tsx +0 -223
- package/src/components/button-look.ts +0 -256
- package/src/components/button.tsx +0 -339
- package/src/components/calculator.tsx +0 -341
- package/src/components/calendar-heatmap-labels.ts +0 -15
- package/src/components/calendar-heatmap.tsx +0 -600
- package/src/components/card.tsx +0 -377
- package/src/components/chart-edge.ts +0 -106
- package/src/components/chart-figure.tsx +0 -35
- package/src/components/chart-height.ts +0 -30
- package/src/components/chart-zoom-core.tsx +0 -627
- package/src/components/chart-zoom.tsx +0 -22
- package/src/components/chart.tsx +0 -554
- package/src/components/checkbox-group.tsx +0 -247
- package/src/components/checkbox.tsx +0 -346
- package/src/components/chip-input.tsx +0 -370
- package/src/components/chip-labels.ts +0 -13
- package/src/components/chip.tsx +0 -843
- package/src/components/choice-card.tsx +0 -544
- package/src/components/column-mapper-labels.ts +0 -38
- package/src/components/column-mapper.tsx +0 -655
- package/src/components/combobox-core.tsx +0 -1321
- package/src/components/combobox-suggestions.tsx +0 -131
- package/src/components/combobox.tsx +0 -716
- package/src/components/confirm-context.ts +0 -7
- package/src/components/confirm-dialog-labels.ts +0 -13
- package/src/components/confirm-dialog.tsx +0 -341
- package/src/components/copy-button-labels.ts +0 -13
- package/src/components/copy-button.tsx +0 -192
- package/src/components/country-select-labels.ts +0 -11
- package/src/components/country-select.tsx +0 -539
- package/src/components/currency-option-list.tsx +0 -188
- package/src/components/currency-select.tsx +0 -343
- package/src/components/danger-confirm-labels.ts +0 -20
- package/src/components/danger-confirm.tsx +0 -987
- package/src/components/data-table-cells.tsx +0 -118
- package/src/components/data-table-column-settings.tsx +0 -198
- package/src/components/data-table-filter-popover.tsx +0 -289
- package/src/components/data-table-filters.ts +0 -315
- package/src/components/data-table-fit.ts +0 -301
- package/src/components/data-table-groups.tsx +0 -288
- package/src/components/data-table-head.tsx +0 -280
- package/src/components/data-table-labels.ts +0 -198
- package/src/components/data-table-leading-row.tsx +0 -58
- package/src/components/data-table-mobile.tsx +0 -1117
- package/src/components/data-table-pagination.tsx +0 -202
- package/src/components/data-table-resize.ts +0 -188
- package/src/components/data-table-row-actions.tsx +0 -302
- package/src/components/data-table-row.tsx +0 -496
- package/src/components/data-table-selection.ts +0 -71
- package/src/components/data-table-shared.tsx +0 -287
- package/src/components/data-table-sort.ts +0 -163
- package/src/components/data-table-virtual.ts +0 -576
- package/src/components/data-table.tsx +0 -2598
- package/src/components/date-field.tsx +0 -684
- package/src/components/date-format-setting.tsx +0 -64
- package/src/components/date-picker.tsx +0 -404
- package/src/components/date-range-picker.tsx +0 -518
- package/src/components/description-list-labels.ts +0 -9
- package/src/components/description-list.tsx +0 -386
- package/src/components/dialog-frame-labels.ts +0 -7
- package/src/components/dialog-frame.tsx +0 -284
- package/src/components/disclosure.tsx +0 -476
- package/src/components/dropdown.tsx +0 -461
- package/src/components/empty-state.tsx +0 -136
- package/src/components/entity-combobox.tsx +0 -422
- package/src/components/error-boundary-labels.ts +0 -20
- package/src/components/error-boundary.tsx +0 -675
- package/src/components/facing-pair.ts +0 -93
- package/src/components/field-base-labels.ts +0 -20
- package/src/components/field-base.tsx +0 -656
- package/src/components/field-parts.tsx +0 -825
- package/src/components/field-strip.tsx +0 -129
- package/src/components/field.tsx +0 -206
- package/src/components/file-button.tsx +0 -295
- package/src/components/file-dropzone.tsx +0 -559
- package/src/components/floating-panel-labels.ts +0 -10
- package/src/components/floating-panel.tsx +0 -828
- package/src/components/focus-ring.ts +0 -16
- package/src/components/form-actions-labels.ts +0 -11
- package/src/components/form-actions.tsx +0 -578
- package/src/components/full-bleed-dialog.tsx +0 -294
- package/src/components/grouped-picker.tsx +0 -184
- package/src/components/help-popover.tsx +0 -117
- package/src/components/hover-menu.tsx +0 -343
- package/src/components/iban-input-labels.ts +0 -14
- package/src/components/iban-input.tsx +0 -236
- package/src/components/icon-button.tsx +0 -959
- package/src/components/icon-picker-labels.ts +0 -13
- package/src/components/icon-picker.tsx +0 -232
- package/src/components/image-grid-labels.ts +0 -11
- package/src/components/image-grid.tsx +0 -202
- package/src/components/inline-confirm.tsx +0 -116
- package/src/components/inline-edit-field-labels.ts +0 -11
- package/src/components/inline-edit-field.tsx +0 -552
- package/src/components/inline-entity-combobox.tsx +0 -849
- package/src/components/input.tsx +0 -394
- package/src/components/jump-calendar.tsx +0 -265
- package/src/components/language-select.tsx +0 -93
- package/src/components/legal-labels.ts +0 -105
- package/src/components/legal-page.tsx +0 -711
- package/src/components/legal.tsx +0 -668
- package/src/components/lightbox-labels.ts +0 -18
- package/src/components/lightbox.tsx +0 -399
- package/src/components/line-items-labels.ts +0 -14
- package/src/components/line-items.tsx +0 -602
- package/src/components/list-labels.ts +0 -12
- package/src/components/list.tsx +0 -870
- package/src/components/loading-state.tsx +0 -78
- package/src/components/measured-grid-labels.ts +0 -25
- package/src/components/measured-grid.tsx +0 -837
- package/src/components/menu-item.tsx +0 -241
- package/src/components/mini-calendar-labels.ts +0 -17
- package/src/components/mini-calendar.tsx +0 -792
- package/src/components/modal.tsx +0 -534
- package/src/components/money-draft.ts +0 -83
- package/src/components/money-field.tsx +0 -76
- package/src/components/month-grid.tsx +0 -229
- package/src/components/month-picker-labels.ts +0 -22
- package/src/components/month-picker.tsx +0 -1087
- package/src/components/multi-entity-combobox.tsx +0 -369
- package/src/components/multi-select.tsx +0 -376
- package/src/components/nav-pills.tsx +0 -198
- package/src/components/number-field.tsx +0 -327
- package/src/components/number-input.tsx +0 -559
- package/src/components/numeric-field.ts +0 -169
- package/src/components/numpad-sheet.tsx +0 -285
- package/src/components/one-time-code-input.tsx +0 -270
- package/src/components/page-contents-labels.ts +0 -9
- package/src/components/page-contents.tsx +0 -282
- package/src/components/page-header-context.ts +0 -8
- package/src/components/page-header.tsx +0 -298
- package/src/components/password-strength-labels.ts +0 -22
- package/src/components/password-strength.tsx +0 -241
- package/src/components/phone-input-labels.ts +0 -10
- package/src/components/phone-input.tsx +0 -282
- package/src/components/picker-sheet.tsx +0 -330
- package/src/components/pie-chart-labels.ts +0 -40
- package/src/components/pie-chart.tsx +0 -480
- package/src/components/popover-labels.ts +0 -14
- package/src/components/popover.tsx +0 -268
- package/src/components/progress-bar-labels.ts +0 -10
- package/src/components/progress-bar.tsx +0 -479
- package/src/components/qr-code.tsx +0 -76
- package/src/components/reauth-dialog-labels.ts +0 -13
- package/src/components/reauth-dialog.tsx +0 -265
- package/src/components/row-actions-labels.ts +0 -12
- package/src/components/row-actions.tsx +0 -795
- package/src/components/scroll-area.tsx +0 -123
- package/src/components/search-field.tsx +0 -192
- package/src/components/select.tsx +0 -294
- package/src/components/separator.tsx +0 -33
- package/src/components/series-chart-axes.ts +0 -342
- package/src/components/series-chart-budget.ts +0 -150
- package/src/components/series-chart-labels.ts +0 -33
- package/src/components/series-chart-thin.ts +0 -180
- package/src/components/series-chart-ticks.ts +0 -194
- package/src/components/series-chart.tsx +0 -1906
- package/src/components/server-wake-labels.ts +0 -11
- package/src/components/server-wake.tsx +0 -129
- package/src/components/settings-fields.tsx +0 -237
- package/src/components/share-card-labels.ts +0 -30
- package/src/components/share-card.tsx +0 -675
- package/src/components/signature-pad-labels.ts +0 -24
- package/src/components/signature-pad.tsx +0 -747
- package/src/components/signed-amount-labels.ts +0 -10
- package/src/components/signed-amount.tsx +0 -336
- package/src/components/skeleton.tsx +0 -80
- package/src/components/slider.tsx +0 -338
- package/src/components/sparkline-labels.ts +0 -14
- package/src/components/sparkline.tsx +0 -322
- package/src/components/spinner.tsx +0 -81
- package/src/components/stat-tile-labels.ts +0 -15
- package/src/components/stat-tile.tsx +0 -754
- package/src/components/status-dot.tsx +0 -170
- package/src/components/swatch-picker-labels.ts +0 -10
- package/src/components/swatch-picker.tsx +0 -283
- package/src/components/swipeable-row.tsx +0 -386
- package/src/components/switch.tsx +0 -273
- package/src/components/table-skeleton.tsx +0 -136
- package/src/components/table.tsx +0 -647
- package/src/components/tabs-labels.ts +0 -13
- package/src/components/tabs.tsx +0 -693
- package/src/components/text-link.tsx +0 -359
- package/src/components/text.tsx +0 -150
- package/src/components/textarea.tsx +0 -330
- package/src/components/tile-radio.tsx +0 -332
- package/src/components/time-input.tsx +0 -121
- package/src/components/toast-labels.ts +0 -12
- package/src/components/toast.tsx +0 -519
- package/src/components/toggle-group.tsx +0 -752
- package/src/components/toggle-legend.tsx +0 -394
- package/src/components/tooltip.tsx +0 -1149
- package/src/components/translation-review-editor.tsx +0 -290
- package/src/components/translation-review-labels.ts +0 -181
- package/src/components/translation-review-parts.tsx +0 -272
- package/src/components/translation-review.tsx +0 -1240
- package/src/components/tree-view.tsx +0 -589
- package/src/components/treemap-labels.ts +0 -47
- package/src/components/treemap-layout.ts +0 -210
- package/src/components/treemap.tsx +0 -1184
- package/src/components/trigger-aria.ts +0 -44
- package/src/components/use-anchor-dir.ts +0 -20
- package/src/components/use-mobile-reveal.ts +0 -62
- package/src/components/use-table-state.ts +0 -753
- package/src/components/user-avatar.tsx +0 -116
- package/src/components/wizard-stepper.tsx +0 -42
- package/src/components/write-lock-labels.ts +0 -10
- package/src/components/write-lock.tsx +0 -253
- package/src/currencies.ts +0 -90
- package/src/data-table.ts +0 -42
- package/src/demo/demo-banner.tsx +0 -153
- package/src/demo/demo-countdown.ts +0 -136
- package/src/demo/demo-ended.tsx +0 -90
- package/src/demo/demo-labels.ts +0 -78
- package/src/demo/demo-session.ts +0 -32
- package/src/demo/demo-start.tsx +0 -156
- package/src/eslint/index.ts +0 -161
- package/src/eslint/role-utilities.generated.ts +0 -146
- package/src/eslint/role-utilities.ts +0 -233
- package/src/feedback/feedback-attachment-download.tsx +0 -77
- package/src/feedback/feedback-attachment-labels.ts +0 -37
- package/src/feedback/feedback-attachment.tsx +0 -1239
- package/src/feedback/feedback-capture.ts +0 -287
- package/src/feedback/feedback-comment-thread.tsx +0 -353
- package/src/feedback/feedback-context-labels.ts +0 -11
- package/src/feedback/feedback-context.tsx +0 -245
- package/src/feedback/feedback-crash.ts +0 -547
- package/src/feedback/feedback-diagnostics.tsx +0 -41
- package/src/feedback/feedback-dialog-labels.ts +0 -29
- package/src/feedback/feedback-dialog.tsx +0 -452
- package/src/feedback/feedback-entry-file.tsx +0 -150
- package/src/feedback/feedback-inbox.tsx +0 -552
- package/src/feedback/feedback-labels.ts +0 -144
- package/src/feedback/feedback-menu-labels.ts +0 -12
- package/src/feedback/feedback-menu.tsx +0 -177
- package/src/feedback/feedback-mutation.ts +0 -20
- package/src/feedback/feedback-page-link.ts +0 -90
- package/src/feedback/feedback-public-labels.ts +0 -81
- package/src/feedback/feedback-public-list.tsx +0 -524
- package/src/feedback/feedback-public-switch.tsx +0 -102
- package/src/feedback/feedback-public-types.ts +0 -101
- package/src/feedback/feedback-record.ts +0 -428
- package/src/feedback/feedback-replies-context.ts +0 -9
- package/src/feedback/feedback-replies.tsx +0 -343
- package/src/feedback/feedback-rework-entry-chip.tsx +0 -18
- package/src/feedback/feedback-row-detail-labels.ts +0 -31
- package/src/feedback/feedback-row-detail.tsx +0 -871
- package/src/feedback/feedback-status-undo.ts +0 -109
- package/src/feedback/feedback-submit-dialog.tsx +0 -131
- package/src/feedback/feedback-submit.tsx +0 -270
- package/src/feedback/feedback-swipe.tsx +0 -192
- package/src/feedback/feedback-table-labels.ts +0 -27
- package/src/feedback/feedback-table.tsx +0 -912
- package/src/feedback/feedback-thread-labels.ts +0 -22
- package/src/feedback/feedback-thread-parts-labels.ts +0 -41
- package/src/feedback/feedback-thread.tsx +0 -905
- package/src/feedback/feedback-vocabulary.ts +0 -263
- package/src/feedback/feedback-vote-button.tsx +0 -124
- package/src/feedback.ts +0 -116
- package/src/hooks/use-anchored-panel.ts +0 -396
- package/src/hooks/use-anchored-rect.ts +0 -77
- package/src/hooks/use-announce.ts +0 -85
- package/src/hooks/use-authed-src.ts +0 -167
- package/src/hooks/use-body-scroll-lock.ts +0 -119
- package/src/hooks/use-breakpoint.ts +0 -133
- package/src/hooks/use-close-transition.ts +0 -107
- package/src/hooks/use-copy-to-clipboard.ts +0 -122
- package/src/hooks/use-debounce.ts +0 -114
- package/src/hooks/use-dismiss.ts +0 -371
- package/src/hooks/use-document-title.ts +0 -33
- package/src/hooks/use-file-drop.ts +0 -121
- package/src/hooks/use-file-picker-labels.ts +0 -28
- package/src/hooks/use-file-picker.tsx +0 -359
- package/src/hooks/use-focus-trap.ts +0 -199
- package/src/hooks/use-hotkey.ts +0 -212
- package/src/hooks/use-large-text.ts +0 -41
- package/src/hooks/use-long-press.ts +0 -140
- package/src/hooks/use-media-query.ts +0 -39
- package/src/hooks/use-mounted.ts +0 -39
- package/src/hooks/use-noindex.ts +0 -37
- package/src/hooks/use-overlay-history.ts +0 -714
- package/src/hooks/use-row-swipe.ts +0 -207
- package/src/hooks/use-search-param-state.ts +0 -434
- package/src/hooks/use-windowed-rows.ts +0 -225
- package/src/i18n/defaults.ts +0 -267
- package/src/i18n/german.ts +0 -2059
- package/src/i18n/kit-labels.tsx +0 -1003
- package/src/i18n/languages.ts +0 -349
- package/src/i18n/locales/de-CH.ts +0 -24
- package/src/i18n/locales/en.ts +0 -267
- package/src/i18n/locales/es.ts +0 -1999
- package/src/i18n/locales/fr.ts +0 -2037
- package/src/i18n/locales/hu.ts +0 -2004
- package/src/i18n/locales/it.ts +0 -2014
- package/src/i18n/locales/zh.ts +0 -1912
- package/src/i18n/plurals.ts +0 -86
- package/src/i18n/review.ts +0 -475
- package/src/i18n/shared-labels.ts +0 -138
- package/src/i18n/swiss.ts +0 -29
- package/src/index.ts +0 -1191
- package/src/landing/access.ts +0 -93
- package/src/landing/landing-actions.tsx +0 -97
- package/src/landing/landing-labels.ts +0 -59
- package/src/landing/landing-sections.tsx +0 -341
- package/src/landing/page-seo.ts +0 -261
- package/src/landing/public-header.tsx +0 -121
- package/src/landing/public-page.tsx +0 -106
- package/src/landing/routing.tsx +0 -225
- package/src/lib/broadcast.ts +0 -52
- package/src/lib/calc.ts +0 -323
- package/src/lib/chip-edge-snap.ts +0 -212
- package/src/lib/clipboard-minus.ts +0 -107
- package/src/lib/clipping.ts +0 -34
- package/src/lib/cn.ts +0 -28
- package/src/lib/column-mapping.ts +0 -234
- package/src/lib/countries.ts +0 -91
- package/src/lib/data-attributes.ts +0 -14
- package/src/lib/date-format.ts +0 -227
- package/src/lib/dates.ts +0 -288
- package/src/lib/day-format.ts +0 -96
- package/src/lib/decimal-marks.ts +0 -108
- package/src/lib/describe-failure.ts +0 -18
- package/src/lib/device-settings.ts +0 -147
- package/src/lib/direction.ts +0 -74
- package/src/lib/document-navigation.ts +0 -17
- package/src/lib/document-title.ts +0 -41
- package/src/lib/download.ts +0 -172
- package/src/lib/float-clearance.ts +0 -70
- package/src/lib/floating-stack.ts +0 -70
- package/src/lib/focus-left.ts +0 -156
- package/src/lib/format.ts +0 -585
- package/src/lib/http-status.ts +0 -38
- package/src/lib/iban.ts +0 -251
- package/src/lib/ime.ts +0 -24
- package/src/lib/intl-cache.ts +0 -27
- package/src/lib/iso-day.ts +0 -13
- package/src/lib/lazy-with-fallback.ts +0 -82
- package/src/lib/logger.ts +0 -69
- package/src/lib/minus.ts +0 -50
- package/src/lib/path-pattern.ts +0 -55
- package/src/lib/person-name.ts +0 -155
- package/src/lib/phone.ts +0 -208
- package/src/lib/plain-text.ts +0 -22
- package/src/lib/presence.ts +0 -18
- package/src/lib/qr-encode.ts +0 -444
- package/src/lib/quiet-focus.ts +0 -32
- package/src/lib/reduced-motion.ts +0 -22
- package/src/lib/refs.ts +0 -22
- package/src/lib/round.ts +0 -43
- package/src/lib/safe-storage.ts +0 -119
- package/src/lib/server-wake.ts +0 -315
- package/src/lib/session-refresh.ts +0 -472
- package/src/lib/share-format.ts +0 -18
- package/src/lib/status-tone.ts +0 -43
- package/src/lib/strip-fade.ts +0 -287
- package/src/lib/table-text.ts +0 -554
- package/src/lib/text-case.ts +0 -19
- package/src/lib/text-match.ts +0 -169
- package/src/lib/thenable.ts +0 -19
- package/src/lib/translation-review.ts +0 -769
- package/src/notifications/device-zone-report.ts +0 -67
- package/src/notifications/feedback-notification-types-labels.ts +0 -33
- package/src/notifications/feedback-notification-types.ts +0 -71
- package/src/notifications/notification-bell.tsx +0 -119
- package/src/notifications/notification-inbox.tsx +0 -309
- package/src/notifications/notification-parts.tsx +0 -81
- package/src/notifications/notification-types-setting.tsx +0 -406
- package/src/notifications/notification-types.ts +0 -89
- package/src/notifications/notifications-labels.ts +0 -287
- package/src/notifications/push-device-setting.tsx +0 -230
- package/src/notifications/push-devices-setting.tsx +0 -374
- package/src/notifications/push-worker.ts +0 -168
- package/src/notifications/quiet-hours-setting.tsx +0 -238
- package/src/notifications/unsubscribe-panel.tsx +0 -200
- package/src/notifications/use-push-device.ts +0 -448
- package/src/offline/local-first.ts +0 -100
- package/src/offline/pwa-update-prompt-labels.ts +0 -9
- package/src/offline/pwa-update-prompt.tsx +0 -78
- package/src/offline/query-persistence.ts +0 -391
- package/src/offline/service-worker-updates.ts +0 -81
- package/src/offline/shared-computer-labels.ts +0 -8
- package/src/offline/shared-computer.tsx +0 -87
- package/src/offline/sign-out-pending-dialog-labels.ts +0 -21
- package/src/offline/sign-out-pending-dialog.tsx +0 -135
- package/src/offline.ts +0 -37
- package/src/push-worker.ts +0 -25
- package/src/rhf/fields.tsx +0 -2187
- package/src/rhf/form-core.tsx +0 -324
- package/src/rhf/form.tsx +0 -12
- package/src/rhf/line-items.tsx +0 -135
- package/src/rhf/use-rhf-wizard-step.ts +0 -104
- package/src/rhf.ts +0 -21
- package/src/search/command-palette-labels.ts +0 -16
- package/src/search/command-palette.tsx +0 -624
- package/src/search/global-search-labels.ts +0 -13
- package/src/search/global-search.tsx +0 -660
- package/src/search/search-index.ts +0 -283
- package/src/search/use-command-key.ts +0 -23
- package/src/search.ts +0 -14
- package/src/settings/device-reset-setting-labels.ts +0 -20
- package/src/settings/device-reset-setting.tsx +0 -116
- package/src/settings/settings-card-classes.ts +0 -11
- package/src/settings/settings-catalogue.ts +0 -150
- package/src/settings/settings-context.ts +0 -33
- package/src/settings/settings-heading.tsx +0 -67
- package/src/settings/settings-labels.ts +0 -87
- package/src/settings/settings-layout.tsx +0 -471
- package/src/settings/settings-section.tsx +0 -108
- package/src/settings/use-account-appearance.ts +0 -148
- package/src/settings/use-account-language.ts +0 -146
- package/src/settings/use-settings-focus.ts +0 -128
- package/src/settings/use-settings-route.ts +0 -258
- package/src/shell/account-menu-language.tsx +0 -130
- package/src/shell/account-menu-text-size.tsx +0 -80
- package/src/shell/admin-menu.tsx +0 -183
- package/src/shell/app-shell-labels.ts +0 -11
- package/src/shell/app-shell.tsx +0 -1560
- package/src/shell/auth-layout.tsx +0 -186
- package/src/shell/company-switcher-labels.ts +0 -13
- package/src/shell/company-switcher.tsx +0 -136
- package/src/shell/dev-menu.tsx +0 -257
- package/src/shell/fill-height.tsx +0 -45
- package/src/shell/language-code.ts +0 -5
- package/src/shell/option-switcher-menu.tsx +0 -84
- package/src/shell/sync-status-indicator.tsx +0 -303
- package/src/shell/top-bar-actions.tsx +0 -87
- package/src/shell/top-bar-brand.tsx +0 -78
- package/src/shell/top-bar-parts-labels.ts +0 -148
- package/src/shell/top-bar.tsx +0 -40
- package/src/shell/topbar-action-menu.tsx +0 -567
- package/src/shell/topbar-controls.tsx +0 -269
- package/src/shell/tour-menu.tsx +0 -187
- package/src/shell.ts +0 -108
- package/src/sync/db.ts +0 -129
- package/src/sync/engine.ts +0 -1011
- package/src/sync/hooks.ts +0 -98
- package/src/sync/testing.ts +0 -73
- package/src/sync/wire.ts +0 -61
- package/src/sync.ts +0 -37
- package/src/table-text.ts +0 -8
- package/src/testing/css-variables.generated.ts +0 -112
- package/src/testing/css-variables.ts +0 -189
- package/src/testing/index.ts +0 -29
- package/src/testing/react.ts +0 -58
- package/src/testing/tour.ts +0 -41
- package/src/testing/viewport.ts +0 -357
- package/src/theme/chart-palette.ts +0 -232
- package/src/theme/color.ts +0 -272
- package/src/theme/contrast-tokens.ts +0 -268
- package/src/theme/contrast.ts +0 -250
- package/src/theme/palette-derive.ts +0 -825
- package/src/theme/palette-presets.ts +0 -544
- package/src/theme/palette-store.ts +0 -108
- package/src/theme/text-size.ts +0 -289
- package/src/theme/theme-store.ts +0 -157
- package/src/tour/tour-catalogue-labels.ts +0 -75
- package/src/tour/tour-catalogue.tsx +0 -335
- package/src/tour/tour-dock.ts +0 -134
- package/src/tour/tour-engine.ts +0 -37
- package/src/tour/tour-gates.ts +0 -218
- package/src/tour/tour-guide-button.tsx +0 -64
- package/src/tour/tour-guide-labels.ts +0 -15
- package/src/tour/tour-info.ts +0 -144
- package/src/tour/tour-labels.ts +0 -23
- package/src/tour/tour-overlay.tsx +0 -1170
- package/src/tour/tour.tsx +0 -750
- package/src/tour/use-tour-progress.ts +0 -671
- package/src/tour/use-tour-url-sync.ts +0 -266
- package/src/tour.ts +0 -21
- package/src/vite-env.d.ts +0 -23
- package/src/wizard/stepper-nav.tsx +0 -360
- package/src/wizard/types.ts +0 -275
- package/src/wizard/use-wizard.ts +0 -560
- package/src/wizard/validation.ts +0 -39
- package/src/wizard/wizard-context.tsx +0 -74
- package/src/wizard/wizard-labels.ts +0 -29
- package/src/wizard/wizard-step.tsx +0 -76
- package/src/wizard/wizard-summary.tsx +0 -84
- package/src/wizard.ts +0 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/legal.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { MouseEvent, ReactNode } from \"react\";\n\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport type { LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { countryName } from \"../lib/countries\";\nimport { AlertBanner } from \"./alert-banner\";\nimport { TextLink } from \"./text-link\";\nimport { DEFAULT_LEGAL_LABELS } from \"./legal-labels\";\n\n/**\n * The legal pages — Imprint, Privacy Policy, Terms — for every app.\n *\n * 0.19 (docs/i18n-harmonization.md H10): keksdose and kastlan each carried the same\n * shell, written twice: a back link, the title, a \"closed beta, not yet reviewed by a\n * lawyer\" notice, sections of heading + running text, and kastlan's row of links to the\n * three pages with the current one marked. That shape moved here; the words stayed in\n * each app.\n *\n * 0.28 (docs/legal-harmonization.md) reverses the second half: the wording that is the\n * same in all three apps is the kit's too, in all seven languages, so there is ONE text\n * to change after the lawyer's review instead of three apps drifting apart sentence by\n * sentence. This module holds the labels (every kit-owned legal word, §4.3/§4.4), the\n * column (`LegalLayout`), the section (`LegalSection`, now numbered and cross-referenced\n * inside a `LegalPage`), the links row and the public footer. The page frame, the\n * kit-owned sections and the terms checkbox are in `./legal-page`.\n *\n * `LegalLayout` stays a CONTENT COLUMN, not a page: before 0.28 keksdose showed it inside\n * its public landing header and footer and kastlan inside `AuthLayout`. `LegalPage` is\n * the frame around it that the contract (§3.2) settled on — keksdose's.\n */\n\n// ── The operator ──────────────────────────────────────────────────────────────\n\n/** The three pages, by the key every app uses for them (§4.1). Kurvenschmiede's\n * `imprint` became `impressum`. */\nexport type LegalPageKey = \"impressum\" | \"privacy\" | \"terms\";\n\n/** The three routes (§3.1): one per page, the language from i18n, no per-language URLs. */\nexport const LEGAL_HREFS: Readonly<Record<LegalPageKey, string>> = Object.freeze({\n impressum: \"/impressum\",\n privacy: \"/privacy\",\n terms: \"/terms\",\n});\n\n/** 0.51.4: the two public pages an app MAY have beside the legal ones, linked after\n * them in the footer (§3.3) — keksdose's /security and /accessibility. Not legal pages:\n * an app draws them with `PublicPage`, in its own words, at routes of its choosing. */\nexport type LegalInfoPageKey = \"security\" | \"accessibility\";\n\n/**\n * Who runs the app — the values the kit's legal sections are filled in with (§5).\n *\n * The kit holds NO personal data: every app passes the same values once, to\n * {@link LegalPage}'s `operator`. Plain strings, so the app's config or env can hold them.\n */\nexport interface LegalOperator {\n /** The operator's name, as the imprint prints it. */\n name: string;\n /** \"9470\"-shaped; printed before the city. */\n postalCode: string;\n /** The place — the imprint's address line and the terms' place of jurisdiction. */\n city: string;\n /** The canton or state, abbreviated as the place of jurisdiction writes it: \"SG\". */\n region: string;\n /**\n * ISO 3166-1 alpha-2: \"CH\". A CODE, not a name — the kit names it in the page's\n * language (`Intl.DisplayNames`, see `countryName`), so \"Switzerland\", \"Schweiz\",\n * \"Suisse\" and \"瑞士\" all come from one value.\n */\n country: string;\n /** The contact address the imprint and the privacy policy print. */\n email: string;\n /**\n * The language whose version of the legal texts is BINDING (\"de-CH\"), a BCP 47 code\n * (0.28.1, Marcel 2026-10-05). The lawyer reviews that one; the others are translations\n * for convenience. With it, {@link LegalPage} shows a note on every page read in\n * another language, and the terms' `language` section says which version prevails.\n * Only the language subtag counts: \"de-CH\" and \"de\" are the same language here.\n */\n bindingLanguage?: string;\n}\n\n/**\n * The operator as the kit's texts read it: {@link LegalOperator} with `country` already\n * NAMED in the page's language (\"Schweiz\", not \"CH\").\n *\n * The label functions take this rather than the code so they stay pure string functions\n * of plain values, like every other function label in the kit: a catalogue never calls\n * `Intl`, and a review row can be rendered from placeholders (`{{country}}`).\n */\nexport type LegalOperatorText = Readonly<Record<keyof LegalOperator, string>>;\n\n/** The language subtag of a BCP 47 code, lower-cased: \"de-CH\" → \"de\". */\nexport function baseLanguage(code: string): string {\n return code.split(/[-_]/)[0]!.toLowerCase();\n}\n\nconst languageNamers = new Map<string, Intl.DisplayNames | null>();\n\n/** The name of a language in `locale` — \"Deutsch\", \"German\", \"allemand\", \"德语\" — from its\n * language subtag, so \"de-CH\" is plain \"German\", not \"Swiss High German\". The code itself\n * when the runtime cannot name it. */\nfunction languageName(code: string, locale: string): string {\n let namer = languageNamers.get(locale);\n if (namer === undefined) {\n try {\n namer = new Intl.DisplayNames([locale], { type: \"language\" });\n } catch {\n namer = null;\n }\n languageNamers.set(locale, namer);\n }\n const base = baseLanguage(code);\n try {\n return namer?.of(base) ?? base;\n } catch {\n return base;\n }\n}\n\n/** The operator as the texts read it: its country named in `locale` (English without one —\n * `countryName`'s rule, so an app that set no locale reads English). Public since 0.28.1,\n * for an app's own footer label in the kit's words; it carried an `@internal` tag the\n * barrel contradicted until 0.52 (API-8, refactor audit 2026-10-30). */\nexport function legalOperatorText(operator: LegalOperator, locale: string = \"en\"): LegalOperatorText {\n return {\n ...operator,\n country: countryName(operator.country, locale),\n bindingLanguage: operator.bindingLanguage ? languageName(operator.bindingLanguage, locale) : \"\",\n };\n}\n\n// ── Labels ────────────────────────────────────────────────────────────────────\n\n/** A kit section whose text is fixed: a heading and one body. */\nexport interface LegalTextSectionLabels {\n title: string;\n body: string;\n}\n\n/**\n * 0.32.0: the imprint's disclaimer, with the body of its COMMERCIAL variant\n * (docs/billing-harmonization.md §8; legal decision 7). The title is the same in both:\n * liability for content and links is the subject either way.\n */\nexport interface LegalDisclaimerSectionLabels extends LegalTextSectionLabels {\n /**\n * The body for `<LegalKitSection section=\"disclaimer\" variant=\"commercial\">`: a paid\n * service sold through a Merchant of Record, which sells in its own name (§2.2), so the\n * \"private, non-commercial … closed beta\" of `body` would be untrue. OPTIONAL, as every\n * key added to a namespace an app may annotate: left out, the provider's, then English.\n */\n commercial?: string;\n}\n\n/** A kit section whose text names the operator (§4.3 `{name}`, `{email}`, …). */\nexport interface LegalOperatorSectionLabels {\n title: string;\n /** Called with the operator, its country already named in the page's language. Line\n * breaks are kept (`white-space: pre-line`): an address is plain lines. */\n body: (operator: LegalOperatorText) => string;\n}\n\n/** A kit section with an app slot (or a list) between its two parts. */\nexport interface LegalFramedSectionLabels {\n title: string;\n /** Before the app's part. */\n lead: string;\n /** After it. */\n tail: string;\n}\n\n/**\n * Every word of the legal pages that is the kit's — docs/legal-harmonization.md §4.3 and\n * §4.4, verbatim. English, British spelling; the other six languages are in the\n * catalogues (`@eifi1/ui-kit/i18n/<code>`).\n *\n * Keys follow the contract: `sections.<page>.<section key>`, the section keys being\n * keksdose's (`legal_basis`, not `legalBasis`), because the same key is the section's\n * `id` (`/privacy#legal_basis`) and the app's own sections sit beside these under the\n * same names in its catalogue. Titles carry NO number: {@link LegalPage} numbers the\n * privacy and terms sections in render order (§4.1).\n */\nexport interface LegalLabels {\n /** The accessible name of {@link LegalLinks}' and {@link LegalFooter}'s `<nav>`. */\n navLabel: string;\n /** The short labels of the three links, everywhere the links appear (§3.3), and since\n * 0.51.4 of the two optional public pages after them (`securityHref`,\n * `accessibilityHref` on {@link LegalLinks}) — optional keys, as every key added to a\n * namespace an app may annotate: left out, the provider's, then English. */\n links: Record<LegalPageKey, string> & Partial<Record<LegalInfoPageKey, string>>;\n /** The pages' titles — the `<h1>`, and the links of the terms checkbox. */\n titles: Record<LegalPageKey, string>;\n /** The back link above the title: \"← Back to home\". */\n backHome: string;\n /**\n * The terms checkbox (§3.4) — ONE template with `{terms}` and `{privacy}`, which\n * become the links (named with `titles`). Not a prefix plus a joiner: a language puts\n * the links where its grammar wants them, articles included, and nothing is added\n * around a placeholder — Italian elides, \"e l’{privacy}\", with no space.\n */\n accept: string;\n /** The notice under the title (§3.2): `beta` on the imprint and the terms, `privacy`\n * on the privacy policy. */\n notice: {\n beta: string;\n privacy: string;\n };\n /**\n * 0.28.1: on a page read in another language than the operator's `bindingLanguage` —\n * `note` under the title, `show` on the button that switches to the binding version\n * (when the app passes `onShowBindingLanguage`). `o.bindingLanguage` is the binding\n * language's NAME in the reader's language (\"German\", \"allemand\").\n */\n translation: {\n note: (o: LegalOperatorText) => string;\n show: (o: LegalOperatorText) => string;\n };\n /**\n * 0.51.3: the as-of line under the title (§3.2), \"Last updated: 29 October 2026\" —\n * {@link LegalPage}'s `updated`, called with the date already written out in the page's\n * locale. OPTIONAL, as every key added to a namespace an app may annotate: left out,\n * the provider's, then English.\n */\n updated?: (date: string) => string;\n /**\n * 0.51.4: the plain-language summary at the top of a page ({@link LegalPage}'s\n * `summary`, §3.2) — its heading, and the line under the points saying that only the\n * full text binds. Optional, as `updated`.\n */\n summary?: {\n title: string;\n note: string;\n };\n /** The kit's sections (§4.3), by page and section key. */\n sections: {\n impressum: {\n operator: LegalOperatorSectionLabels;\n contact: LegalOperatorSectionLabels;\n /** `body` is the default, non-commercial text; `commercial` the 0.32 variant. */\n disclaimer: LegalDisclaimerSectionLabels;\n };\n privacy: {\n controller: LegalOperatorSectionLabels;\n /** The app's paragraph follows the body (§4.2): consent, where an app relies on it. */\n legal_basis: LegalTextSectionLabels;\n /** `lead`, then the app's entries as a list, then `tail`, then the app's paragraph. */\n browser: LegalFramedSectionLabels;\n /** `lead` (the rights), then the app's paragraph (export, deletion), then `tail`\n * (the supervisory authorities). */\n rights: LegalFramedSectionLabels;\n contact: LegalOperatorSectionLabels;\n };\n terms: {\n warranty: LegalTextSectionLabels;\n liability: LegalTextSectionLabels;\n changes: LegalTextSectionLabels;\n /** 0.28.1: which language's version prevails — `o.bindingLanguage`, named. */\n language: LegalOperatorSectionLabels;\n /** The place of jurisdiction is the operator's `{city} ({region}), {country}`. */\n law: LegalOperatorSectionLabels;\n };\n };\n}\n\n// Defined in ./legal-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_LEGAL_LABELS };\n\n/** The `legal` namespace, resolved: defaults < provider < `labels` prop. The prop may be\n * partial at every depth (`{ titles: { terms: \"…\" } }`), as the provider's is. */\nexport function useLegalLabels(labels?: LabelOverride<LegalLabels>): LegalLabels {\n return useKitLabels(\"legal\", DEFAULT_LEGAL_LABELS, labels);\n}\n\n// ── What a LegalPage tells the sections inside it ─────────────────────────────\n\n/** Where a `{ref:key}` points: the section's number on a numbered page, else its heading. */\nexport interface LegalRefTarget {\n number?: number;\n heading: ReactNode;\n}\n\n/** @internal Set by `LegalPage` around its column; `null` outside one. */\nexport interface LegalPageContextValue {\n page: LegalPageKey;\n /** The operator with its country named — what the kit sections are filled in with. */\n operator: LegalOperatorText;\n /** The heading level of a section that does not choose one: one below the title. */\n sectionHeading: \"h2\" | \"h3\";\n /** Every section's key, in render order — known BEFORE any section renders, so a\n * reference can point forward (keksdose's section 2 refers to section 10). */\n targets: ReadonlyMap<string, LegalRefTarget>;\n}\n\n/** @internal */\nexport const LegalPageContext = createContext<LegalPageContextValue | null>(null);\n\n/** @internal The place `LegalPage` gave one section: its key and its number. Reset to\n * `null` inside a section, so a section nested in another's children takes neither. */\nexport interface LegalSectionSlot {\n id?: string;\n number?: number;\n}\n\n/** @internal */\nexport const LegalSlotContext = createContext<LegalSectionSlot | null>(null);\n\n/** @internal `{ref:retention}`. A key is a section key: letters, digits, `_` and `-`. */\nconst REF_TOKEN = /\\{ref:([A-Za-z0-9_-]+)\\}/g;\n\n/**\n * A development build's console note — never in production (the consumer's bundler\n * makes `import.meta.env.DEV` false) and never under vitest. Optional-chained:\n * `import.meta.env` is a Vite injection, absent under plain Node.\n */\nfunction devWarnings(): boolean {\n return Boolean(import.meta.env?.DEV) && !import.meta.env?.VITEST;\n}\nconst warned = new Set<string>();\n/** @internal Once per message. */\nexport function warnLegalOnce(message: string): void {\n if (!devWarnings() || warned.has(message)) return;\n warned.add(message);\n console.warn(`[ui-kit] ${message}`);\n}\n\n/**\n * `text` with every `{ref:key}` replaced by a link to `#key` that reads the section's\n * number — the words around it stay the app's (\"see section {ref:retention}\", \"siehe\n * Abschnitt {ref:retention}\"), so each language keeps its grammar (§4.1). On the imprint,\n * which is not numbered, the link reads the section's heading instead.\n *\n * Outside a {@link LegalPage} the text is returned as it is: there is no order to count.\n * A key the page has no section for stays visible as the raw token — a broken reference\n * an app test can find (`not.toHaveTextContent(\"{ref:\")`), not a silently wrong number.\n */\nexport function resolveLegalRefs(text: string, page: LegalPageContextValue | null): ReactNode {\n if (!page || !text.includes(\"{ref:\")) return text;\n const out: ReactNode[] = [];\n let last = 0;\n for (const match of text.matchAll(REF_TOKEN)) {\n const at = match.index ?? 0;\n if (at > last) out.push(text.slice(last, at));\n const key = match[1];\n const target = page.targets.get(key);\n if (target) {\n out.push(\n <TextLink key={`${key}@${at}`} href={`#${key}`}>\n {target.number ?? target.heading}\n </TextLink>,\n );\n } else {\n warnLegalOnce(`{ref:${key}} on the ${page.page} page points at no section of it.`);\n out.push(match[0]);\n }\n last = at + match[0].length;\n }\n if (last < text.length) out.push(text.slice(last));\n return out;\n}\n\n/** @internal Running text — one translation string — with its line breaks kept and its\n * `{ref:key}` tokens resolved. */\nexport function LegalText({ text, className }: { text: string; className?: string }) {\n const page = useContext(LegalPageContext);\n // `break-words`: an address, an email or a URL in a translation is one long word, and\n // on a 390px phone it would push the column wider than the screen.\n return <p className={cn(\"whitespace-pre-line break-words\", className)}>{resolveLegalRefs(text, page)}</p>;\n}\n\n// ── Links ─────────────────────────────────────────────────────────────────────\n\nexport interface LegalLink {\n href: string;\n /** \"Imprint\", \"Privacy Policy\", \"Terms\". */\n label: ReactNode;\n}\n\nexport interface LegalLinksProps {\n /** Default (0.28): the three routes, `/impressum`, `/privacy` and `/terms`, with the\n * kit's short link labels (`legal.links`), in the contract's order. */\n links?: readonly LegalLink[];\n /**\n * 0.51.4: the app's security page — a \"Security\" link after the others, with the kit's\n * label (`legal.links.security`). Left out, no link: only an app that has the page\n * names its route.\n */\n securityHref?: string;\n /** 0.51.4: the app's accessibility statement — \"Accessibility\", last. As\n * `securityHref`. */\n accessibilityHref?: string;\n /** The page being shown; its link is marked `aria-current=\"page\"`. Usually the\n * router's pathname. */\n currentHref?: string;\n /** `false` renders the links without the `<nav>` landmark — inside `AuthLayout`'s\n * `footer` or `TopBarActionMenu`'s `footer`, which are named `<nav>`s already. The row\n * keeps its spacing and `className` either way (0.27.1: it used to return the bare\n * links, so in a plain container — Kurvenschmiede's account-menu `<li>` — they ran\n * together as \"ImpressumDatenschutzerklärungNutz…\" and overflowed). Default true. */\n nav?: boolean;\n /** Called on a click on any of the links, before it navigates — an account menu closes\n * itself here (0.28.1, keksdose: it had to catch the click on a wrapping `<div>`). */\n onLinkClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n labels?: LabelOverride<LegalLabels>;\n className?: string;\n}\n\n/** The default links: the three routes under the kit's short labels. */\nfunction defaultLinks(labels: LegalLabels): LegalLink[] {\n return ([\"impressum\", \"privacy\", \"terms\"] as const).map((page) => ({\n href: LEGAL_HREFS[page],\n label: labels.links[page],\n }));\n}\n\n/** The optional pages after them, each only where the app named its route. */\nfunction infoLinks(labels: LegalLabels, hrefs: Partial<Record<LegalInfoPageKey, string>>): LegalLink[] {\n return ([\"security\", \"accessibility\"] as const).flatMap((page) => {\n const href = hrefs[page];\n return href ? [{ href, label: labels.links[page] ?? DEFAULT_LEGAL_LABELS.links[page] }] : [];\n });\n}\n\n/**\n * The legal pages as a row of quiet links, the one you are on marked (kastlan's\n * `LegalLinks`). Wraps on a phone.\n *\n * 0.28: `·` separators between the links, keksdose's footer style, wherever the links\n * appear — the account menu included (§3.3). The dots are `aria-hidden`: a screen reader\n * already hears three links, and \"middle dot\" between them is noise. They are flex items\n * of the row like the links, so the row's gap spaces them evenly.\n */\nexport function LegalLinks({\n links,\n securityHref,\n accessibilityHref,\n currentHref,\n nav = true,\n onLinkClick,\n labels: labelsProp,\n className,\n}: LegalLinksProps) {\n const labels = useLegalLabels(labelsProp);\n const shown = [\n ...(links ?? defaultLinks(labels)),\n ...infoLinks(labels, { security: securityHref, accessibility: accessibilityHref }),\n ];\n const items = shown.flatMap((link, i) => [\n ...(i > 0\n ? [\n <span key={`sep-${link.href}`} aria-hidden=\"true\">\n ·\n </span>,\n ]\n : []),\n <TextLink key={link.href} href={link.href} tone=\"muted\" current={link.href === currentHref} onClick={onLinkClick}>\n {link.label}\n </TextLink>,\n ]);\n const rowClass = cn(\"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs\", className);\n if (!nav) return <div className={rowClass}>{items}</div>;\n return (\n <nav aria-label={labels.navLabel} className={rowClass}>\n {items}\n </nav>\n );\n}\n\n// ── Footer ────────────────────────────────────────────────────────────────────\n\nexport interface LegalFooterProps {\n /** Under the links, centred — the app's tagline (keksdose: \"Self-hosted household\n * budgeting & bookkeeping.\"). */\n children?: ReactNode;\n /** Default: the three routes with the kit's link labels — see {@link LegalLinks}. */\n links?: readonly LegalLink[];\n /** 0.51.4: \"Security\" after the others — see {@link LegalLinksProps.securityHref}. */\n securityHref?: string;\n /** 0.51.4: \"Accessibility\", last — see {@link LegalLinksProps.accessibilityHref}. */\n accessibilityHref?: string;\n /** Marks that link `aria-current=\"page\"`. {@link LegalPage}'s default footer passes\n * its own page. */\n currentHref?: string;\n /**\n * Default true: the footer is a `<footer>`. `false` draws a `<div>` — for a host that is\n * a footer already: `AuthLayout`'s `footer` slot is one, and HTML forbids a footer inside\n * a footer (0.28.1, kastlan). On an `AuthLayout` page the usual choice is simpler still:\n * `footer={<LegalLinks nav={false} />}` with `footerLabel` set to the kit's `navLabel`\n * ({@link useLegalLabels}).\n */\n landmark?: boolean;\n className?: string;\n labels?: LabelOverride<LegalLabels>;\n}\n\n/**\n * The public footer (§3.3): the three links, centred, with their separators, in a\n * `<nav aria-label=\"Legal\">` — on the landing or home page, every signed-out page the app\n * has, the legal pages and the 404. The rule behind it: from every page a signed-out\n * visitor can reach, the three links are one click away.\n *\n * keksdose's `SiteFooter` (features/landing/site-footer.tsx), which carried them on its\n * landing, auth, legal and 404 pages; kastlan and Kurvenschmiede had them on some pages\n * only. Its palette classes (`border-slate-200 bg-white dark:…`) became the surface and\n * border tokens, so it follows the theme like the rest of the kit.\n *\n * 0.51.4: an app with a security page or an accessibility statement passes their routes\n * (`securityHref`, `accessibilityHref`) and the row goes on with \"Security · Accessibility\"\n * in the kit's words, so the footer reads the same in every app that has them.\n */\nexport function LegalFooter({\n children,\n links,\n securityHref,\n accessibilityHref,\n currentHref,\n landmark = true,\n className,\n labels,\n}: LegalFooterProps) {\n const Root = landmark ? \"footer\" : \"div\";\n return (\n <Root className={cn(\"border-t border-subtle bg-surface\", className)}>\n <div className=\"mx-auto max-w-5xl px-4 py-8 text-sm text-muted\">\n <LegalLinks\n links={links}\n securityHref={securityHref}\n accessibilityHref={accessibilityHref}\n currentHref={currentHref}\n labels={labels}\n className=\"justify-center gap-y-2 text-sm\"\n />\n {children !== undefined && children !== null && <p className=\"mt-4 text-center\">{children}</p>}\n </div>\n </Root>\n );\n}\n\n// ── Section ───────────────────────────────────────────────────────────────────\n\nexport interface LegalSectionProps {\n heading: ReactNode;\n /** Running text. Line breaks in it are kept (`white-space: pre-line`), so a\n * translation can hold an address or a list as plain lines. Inside a\n * {@link LegalPage}, `{ref:key}` becomes the number of section `key`, linked. */\n body?: string;\n /** Anything richer than plain text — links, a list — after `body`. A plain string\n * here has its `{ref:key}` tokens resolved too. */\n children?: ReactNode;\n /**\n * The section's `id`, for a link to it from elsewhere. Inside a {@link LegalPage} it\n * defaults to the element's React `key` — keksdose's\n * `SECTIONS.map((s) => <LegalSection key={s} … />)` gets `id=\"retention\"` with\n * nothing added — and it is the key a `{ref:…}` names.\n */\n id?: string;\n /** The heading's element. Default `h2` under the layout's `h1` (inside a\n * `LegalPage`, one level below its title). */\n headingAs?: \"h2\" | \"h3\";\n}\n\n/**\n * One section: heading and running text.\n *\n * 0.28, inside a {@link LegalPage}: its `id` (the `key` unless given), its number on the\n * privacy policy and the terms (\"3. Legal basis\" — titles carry no number, §4.1), and\n * `{ref:key}` resolution in `body`. Outside one it is exactly the 0.19 section.\n */\nexport function LegalSection({ heading, body, children, id: idProp, headingAs }: LegalSectionProps) {\n const page = useContext(LegalPageContext);\n const slot = useContext(LegalSlotContext);\n const id = idProp ?? slot?.id;\n const number = slot?.number;\n const Heading = headingAs ?? page?.sectionHeading ?? \"h2\";\n return (\n <section id={id} className=\"scroll-mt-20\">\n <Heading className=\"text-lg font-semibold break-words text-primary\">\n {number !== undefined && `${number}. `}\n {heading}\n </Heading>\n <LegalSlotContext.Provider value={null}>\n {body !== undefined && <LegalText text={body} className=\"mt-2 text-sm leading-relaxed text-secondary\" />}\n {children !== undefined && (\n <div className=\"mt-2 text-sm leading-relaxed break-words text-secondary\">\n {typeof children === \"string\" ? resolveLegalRefs(children, page) : children}\n </div>\n )}\n </LegalSlotContext.Provider>\n </section>\n );\n}\n\n// ── Layout ────────────────────────────────────────────────────────────────────\n\nexport interface LegalLayoutProps {\n /** \"Imprint\", \"Privacy Policy\", \"Terms\". */\n title: ReactNode;\n /** Above the title — the app's \"← Back\" link (`<TextLink icon={ArrowLeft}>`). Inside\n * a {@link LegalPage}, \"← Back to home\". */\n back?: ReactNode;\n /**\n * A notice under the title, as a warning banner with `role=\"note\"` — page furniture,\n * not an alert. Per page, not per layout: the privacy page says something more precise\n * than the others (its technical sections describe running code).\n */\n notice?: ReactNode;\n /** 0.51.3: right under the title — {@link LegalPage}'s \"Last updated: …\" line. */\n updated?: ReactNode;\n /** 0.28.1: under the title, before the notice — {@link LegalPage}'s note that this\n * page is a translation and which language is binding. */\n translationNote?: ReactNode;\n /** 0.51.4: before the sections — {@link LegalPage}'s plain-language summary. */\n summary?: ReactNode;\n /** The sections — {@link LegalSection}s. */\n children: ReactNode;\n /** The three pages, linked at the end of the column with the current one marked.\n * Leave out when the page's chrome already shows them (a {@link LegalFooter}). */\n links?: readonly LegalLink[];\n currentHref?: string;\n /** Default `h1`: the page's heading. */\n headingAs?: \"h1\" | \"h2\";\n /** Extra classes on the column — `px-0 py-0` inside a chrome that pads already. */\n className?: string;\n labels?: LabelOverride<LegalLabels>;\n}\n\nexport function LegalLayout({\n title,\n back,\n notice,\n updated,\n translationNote,\n summary,\n children,\n links,\n currentHref,\n headingAs: Heading = \"h1\",\n className,\n labels,\n}: LegalLayoutProps) {\n return (\n <article className={cn(\"mx-auto w-full max-w-3xl px-4 py-12\", className)}>\n {back !== undefined && <div className=\"mb-4 text-sm\">{back}</div>}\n <Heading className=\"text-3xl font-bold tracking-tight break-words text-primary\">{title}</Heading>\n {updated !== undefined && updated !== null && <p className=\"mt-2 text-sm text-muted\">{updated}</p>}\n {translationNote !== undefined && translationNote !== null && <div className=\"mt-3\">{translationNote}</div>}\n {notice !== undefined && notice !== null && (\n <AlertBanner tone=\"warning\" role=\"note\" className=\"mt-4\">\n {notice}\n </AlertBanner>\n )}\n <div className=\"mt-8 space-y-8\">\n {summary}\n {children}\n </div>\n {links !== undefined && links.length > 0 && (\n <LegalLinks\n links={links}\n currentHref={currentHref}\n labels={labels}\n className=\"mt-12 border-t border-subtle pt-4\"\n />\n )}\n </article>\n );\n}\n"],"mappings":";AA6VQ,cAgLF,YAhLE;AA7VR,SAAS,eAAe,kBAAkB;AAG1C,SAAS,oBAAoB;AAE7B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AA+B9B,MAAM,cAAsD,OAAO,OAAO;AAAA,EAC/E,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AACT,CAAC;AAmDM,SAAS,aAAa,MAAsB;AACjD,SAAO,KAAK,MAAM,MAAM,EAAE,CAAC,EAAG,YAAY;AAC5C;AAEA,MAAM,iBAAiB,oBAAI,IAAsC;AAKjE,SAAS,aAAa,MAAc,QAAwB;AAC1D,MAAI,QAAQ,eAAe,IAAI,MAAM;AACrC,MAAI,UAAU,QAAW;AACvB,QAAI;AACF,cAAQ,IAAI,KAAK,aAAa,CAAC,MAAM,GAAG,EAAE,MAAM,WAAW,CAAC;AAAA,IAC9D,QAAQ;AACN,cAAQ;AAAA,IACV;AACA,mBAAe,IAAI,QAAQ,KAAK;AAAA,EAClC;AACA,QAAM,OAAO,aAAa,IAAI;AAC9B,MAAI;AACF,WAAO,OAAO,GAAG,IAAI,KAAK;AAAA,EAC5B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMO,SAAS,kBAAkB,UAAyB,SAAiB,MAAyB;AACnG,SAAO;AAAA,IACL,GAAG;AAAA,IACH,SAAS,YA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;AAAA,KACF;AAEJ;AAoCO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW,UAAU;AAAA,EACrB;AAAA,EACA;AACF,GAAqB;AACnB,SACE,qBAAC,aAAQ,WAAW,GAAG,uCAAuC,SAAS,GACpE;AAAA,aAAS,UAAa,oBAAC,SAAI,WAAU,gBAAgB,gBAAK;AAAA,IAC3D,oBAAC,WAAQ,WAAU,8DAA8D,iBAAM;AAAA,IACtF,YAAY,UAAa,YAAY,QAAQ,oBAAC,OAAE,WAAU,2BAA2B,mBAAQ;AAAA,IAC7F,oBAAoB,UAAa,oBAAoB,QAAQ,oBAAC,SAAI,WAAU,QAAQ,2BAAgB;AAAA,IACpG,WAAW,UAAa,WAAW,QAClC,oBAAC,eAAY,MAAK,WAAU,MAAK,QAAO,WAAU,QAC/C,kBACH;AAAA,IAEF,qBAAC,SAAI,WAAU,kBACZ;AAAA;AAAA,MACA;AAAA,OACH;AAAA,IACC,UAAU,UAAa,MAAM,SAAS,KACrC;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAU;AAAA;AAAA,IACZ;AAAA,KAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/legal.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { MouseEvent, ReactNode } from \"react\";\n\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport type { LabelOverride } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { countryName } from \"../lib/countries\";\nimport { AlertBanner } from \"./alert-banner\";\nimport { TextLink } from \"./text-link\";\nimport { DEFAULT_LEGAL_LABELS } from \"./legal-labels\";\nimport { DEFAULT_LANDING_LABELS, useLandingLabels } from \"../landing/landing-labels\";\n\n/**\n * The legal pages — Imprint, Privacy Policy, Terms — for every app.\n *\n * 0.19 (docs/i18n-harmonization.md H10): keksdose and kastlan each carried the same\n * shell, written twice: a back link, the title, a \"closed beta, not yet reviewed by a\n * lawyer\" notice, sections of heading + running text, and kastlan's row of links to the\n * three pages with the current one marked. That shape moved here; the words stayed in\n * each app.\n *\n * 0.28 (docs/legal-harmonization.md) reverses the second half: the wording that is the\n * same in all three apps is the kit's too, in all seven languages, so there is ONE text\n * to change after the lawyer's review instead of three apps drifting apart sentence by\n * sentence. This module holds the labels (every kit-owned legal word, §4.3/§4.4), the\n * column (`LegalLayout`), the section (`LegalSection`, now numbered and cross-referenced\n * inside a `LegalPage`), the links row and the public footer. The page frame, the\n * kit-owned sections and the terms checkbox are in `./legal-page`.\n *\n * `LegalLayout` stays a CONTENT COLUMN, not a page: before 0.28 keksdose showed it inside\n * its public landing header and footer and kastlan inside `AuthLayout`. `LegalPage` is\n * the frame around it that the contract (§3.2) settled on — keksdose's.\n */\n\n// ── The operator ──────────────────────────────────────────────────────────────\n\n/** The three pages, by the key every app uses for them (§4.1). Kurvenschmiede's\n * `imprint` became `impressum`. */\nexport type LegalPageKey = \"impressum\" | \"privacy\" | \"terms\";\n\n/** The three routes (§3.1): one per page, the language from i18n, no per-language URLs. */\nexport const LEGAL_HREFS: Readonly<Record<LegalPageKey, string>> = Object.freeze({\n impressum: \"/impressum\",\n privacy: \"/privacy\",\n terms: \"/terms\",\n});\n\n/** 0.51.4: the two public pages an app MAY have beside the legal ones, linked after\n * them in the footer (§3.3) — keksdose's /security and /accessibility. Not legal pages:\n * an app draws them with `PublicPage`, in its own words, at routes of its choosing. */\nexport type LegalInfoPageKey = \"security\" | \"accessibility\";\n\n/**\n * Who runs the app — the values the kit's legal sections are filled in with (§5).\n *\n * The kit holds NO personal data: every app passes the same values once, to\n * {@link LegalPage}'s `operator`. Plain strings, so the app's config or env can hold them.\n */\nexport interface LegalOperator {\n /** The operator's name, as the imprint prints it. */\n name: string;\n /** \"9470\"-shaped; printed before the city. */\n postalCode: string;\n /** The place — the imprint's address line and the terms' place of jurisdiction. */\n city: string;\n /** The canton or state, abbreviated as the place of jurisdiction writes it: \"SG\". */\n region: string;\n /**\n * ISO 3166-1 alpha-2: \"CH\". A CODE, not a name — the kit names it in the page's\n * language (`Intl.DisplayNames`, see `countryName`), so \"Switzerland\", \"Schweiz\",\n * \"Suisse\" and \"瑞士\" all come from one value.\n */\n country: string;\n /** The contact address the imprint and the privacy policy print. */\n email: string;\n /**\n * The language whose version of the legal texts is BINDING (\"de-CH\"), a BCP 47 code\n * (0.28.1, Marcel 2026-10-05). The lawyer reviews that one; the others are translations\n * for convenience. With it, {@link LegalPage} shows a note on every page read in\n * another language, and the terms' `language` section says which version prevails.\n * Only the language subtag counts: \"de-CH\" and \"de\" are the same language here.\n */\n bindingLanguage?: string;\n}\n\n/**\n * The operator as the kit's texts read it: {@link LegalOperator} with `country` already\n * NAMED in the page's language (\"Schweiz\", not \"CH\").\n *\n * The label functions take this rather than the code so they stay pure string functions\n * of plain values, like every other function label in the kit: a catalogue never calls\n * `Intl`, and a review row can be rendered from placeholders (`{{country}}`).\n */\nexport type LegalOperatorText = Readonly<Record<keyof LegalOperator, string>>;\n\n/** The language subtag of a BCP 47 code, lower-cased: \"de-CH\" → \"de\". */\nexport function baseLanguage(code: string): string {\n return code.split(/[-_]/)[0]!.toLowerCase();\n}\n\nconst languageNamers = new Map<string, Intl.DisplayNames | null>();\n\n/** The name of a language in `locale` — \"Deutsch\", \"German\", \"allemand\", \"德语\" — from its\n * language subtag, so \"de-CH\" is plain \"German\", not \"Swiss High German\". The code itself\n * when the runtime cannot name it. */\nfunction languageName(code: string, locale: string): string {\n let namer = languageNamers.get(locale);\n if (namer === undefined) {\n try {\n namer = new Intl.DisplayNames([locale], { type: \"language\" });\n } catch {\n namer = null;\n }\n languageNamers.set(locale, namer);\n }\n const base = baseLanguage(code);\n try {\n return namer?.of(base) ?? base;\n } catch {\n return base;\n }\n}\n\n/** The operator as the texts read it: its country named in `locale` (English without one —\n * `countryName`'s rule, so an app that set no locale reads English). Public since 0.28.1,\n * for an app's own footer label in the kit's words; it carried an `@internal` tag the\n * barrel contradicted until 0.52 (API-8, refactor audit 2026-10-30). */\nexport function legalOperatorText(operator: LegalOperator, locale: string = \"en\"): LegalOperatorText {\n return {\n ...operator,\n country: countryName(operator.country, locale),\n bindingLanguage: operator.bindingLanguage ? languageName(operator.bindingLanguage, locale) : \"\",\n };\n}\n\n// ── Labels ────────────────────────────────────────────────────────────────────\n\n/** A kit section whose text is fixed: a heading and one body. */\nexport interface LegalTextSectionLabels {\n title: string;\n body: string;\n}\n\n/**\n * 0.32.0: the imprint's disclaimer, with the body of its COMMERCIAL variant\n * (docs/billing-harmonization.md §8; legal decision 7). The title is the same in both:\n * liability for content and links is the subject either way.\n */\nexport interface LegalDisclaimerSectionLabels extends LegalTextSectionLabels {\n /**\n * The body for `<LegalKitSection section=\"disclaimer\" variant=\"commercial\">`: a paid\n * service sold through a Merchant of Record, which sells in its own name (§2.2), so the\n * \"private, non-commercial … closed beta\" of `body` would be untrue. OPTIONAL, as every\n * key added to a namespace an app may annotate: left out, the provider's, then English.\n */\n commercial?: string;\n}\n\n/** A kit section whose text names the operator (§4.3 `{name}`, `{email}`, …). */\nexport interface LegalOperatorSectionLabels {\n title: string;\n /** Called with the operator, its country already named in the page's language. Line\n * breaks are kept (`white-space: pre-line`): an address is plain lines. */\n body: (operator: LegalOperatorText) => string;\n}\n\n/** A kit section with an app slot (or a list) between its two parts. */\nexport interface LegalFramedSectionLabels {\n title: string;\n /** Before the app's part. */\n lead: string;\n /** After it. */\n tail: string;\n}\n\n/**\n * Every word of the legal pages that is the kit's — docs/legal-harmonization.md §4.3 and\n * §4.4, verbatim. English, British spelling; the other six languages are in the\n * catalogues (`@eifi1/ui-kit/i18n/<code>`).\n *\n * Keys follow the contract: `sections.<page>.<section key>`, the section keys being\n * keksdose's (`legal_basis`, not `legalBasis`), because the same key is the section's\n * `id` (`/privacy#legal_basis`) and the app's own sections sit beside these under the\n * same names in its catalogue. Titles carry NO number: {@link LegalPage} numbers the\n * privacy and terms sections in render order (§4.1).\n */\nexport interface LegalLabels {\n /** The accessible name of {@link LegalLinks}' and {@link LegalFooter}'s `<nav>`. */\n navLabel: string;\n /** The short labels of the three links, everywhere the links appear (§3.3), and since\n * 0.51.4 of the two optional public pages after them (`securityHref`,\n * `accessibilityHref` on {@link LegalLinks}) — optional keys, as every key added to a\n * namespace an app may annotate: left out, the provider's, then English. */\n links: Record<LegalPageKey, string> & Partial<Record<LegalInfoPageKey, string>>;\n /** The pages' titles — the `<h1>`, and the links of the terms checkbox. */\n titles: Record<LegalPageKey, string>;\n /** The back link above the title: \"← Back to home\". */\n backHome: string;\n /**\n * The terms checkbox (§3.4) — ONE template with `{terms}` and `{privacy}`, which\n * become the links (named with `titles`). Not a prefix plus a joiner: a language puts\n * the links where its grammar wants them, articles included, and nothing is added\n * around a placeholder — Italian elides, \"e l’{privacy}\", with no space.\n */\n accept: string;\n /** The notice under the title (§3.2): `beta` on the imprint and the terms, `privacy`\n * on the privacy policy. */\n notice: {\n beta: string;\n privacy: string;\n };\n /**\n * 0.28.1: on a page read in another language than the operator's `bindingLanguage` —\n * `note` under the title, `show` on the button that switches to the binding version\n * (when the app passes `onShowBindingLanguage`). `o.bindingLanguage` is the binding\n * language's NAME in the reader's language (\"German\", \"allemand\").\n */\n translation: {\n note: (o: LegalOperatorText) => string;\n show: (o: LegalOperatorText) => string;\n };\n /**\n * 0.51.3: the as-of line under the title (§3.2), \"Last updated: 29 October 2026\" —\n * {@link LegalPage}'s `updated`, called with the date already written out in the page's\n * locale. OPTIONAL, as every key added to a namespace an app may annotate: left out,\n * the provider's, then English.\n */\n updated?: (date: string) => string;\n /**\n * 0.51.4: the plain-language summary at the top of a page ({@link LegalPage}'s\n * `summary`, §3.2) — its heading, and the line under the points saying that only the\n * full text binds. Optional, as `updated`.\n */\n summary?: {\n title: string;\n note: string;\n };\n /** The kit's sections (§4.3), by page and section key. */\n sections: {\n impressum: {\n operator: LegalOperatorSectionLabels;\n contact: LegalOperatorSectionLabels;\n /** `body` is the default, non-commercial text; `commercial` the 0.32 variant. */\n disclaimer: LegalDisclaimerSectionLabels;\n };\n privacy: {\n controller: LegalOperatorSectionLabels;\n /** The app's paragraph follows the body (§4.2): consent, where an app relies on it. */\n legal_basis: LegalTextSectionLabels;\n /** `lead`, then the app's entries as a list, then `tail`, then the app's paragraph. */\n browser: LegalFramedSectionLabels;\n /** `lead` (the rights), then the app's paragraph (export, deletion), then `tail`\n * (the supervisory authorities). */\n rights: LegalFramedSectionLabels;\n contact: LegalOperatorSectionLabels;\n };\n terms: {\n warranty: LegalTextSectionLabels;\n liability: LegalTextSectionLabels;\n changes: LegalTextSectionLabels;\n /** 0.28.1: which language's version prevails — `o.bindingLanguage`, named. */\n language: LegalOperatorSectionLabels;\n /** The place of jurisdiction is the operator's `{city} ({region}), {country}`. */\n law: LegalOperatorSectionLabels;\n };\n };\n}\n\n// Defined in ./legal-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_LEGAL_LABELS };\n\n/** The `legal` namespace, resolved: defaults < provider < `labels` prop. The prop may be\n * partial at every depth (`{ titles: { terms: \"…\" } }`), as the provider's is. */\nexport function useLegalLabels(labels?: LabelOverride<LegalLabels>): LegalLabels {\n return useKitLabels(\"legal\", DEFAULT_LEGAL_LABELS, labels);\n}\n\n// ── What a LegalPage tells the sections inside it ─────────────────────────────\n\n/** Where a `{ref:key}` points: the section's number on a numbered page, else its heading. */\nexport interface LegalRefTarget {\n number?: number;\n heading: ReactNode;\n}\n\n/** @internal Set by `LegalPage` around its column; `null` outside one. */\nexport interface LegalPageContextValue {\n page: LegalPageKey;\n /** The operator with its country named — what the kit sections are filled in with. */\n operator: LegalOperatorText;\n /** The heading level of a section that does not choose one: one below the title. */\n sectionHeading: \"h2\" | \"h3\";\n /** Every section's key, in render order — known BEFORE any section renders, so a\n * reference can point forward (keksdose's section 2 refers to section 10). */\n targets: ReadonlyMap<string, LegalRefTarget>;\n}\n\n/** @internal */\nexport const LegalPageContext = createContext<LegalPageContextValue | null>(null);\n\n/** @internal The place `LegalPage` gave one section: its key and its number. Reset to\n * `null` inside a section, so a section nested in another's children takes neither. */\nexport interface LegalSectionSlot {\n id?: string;\n number?: number;\n}\n\n/** @internal */\nexport const LegalSlotContext = createContext<LegalSectionSlot | null>(null);\n\n/** @internal `{ref:retention}`. A key is a section key: letters, digits, `_` and `-`. */\nconst REF_TOKEN = /\\{ref:([A-Za-z0-9_-]+)\\}/g;\n\n/**\n * A development build's console note — never in production (the consumer's bundler\n * makes `import.meta.env.DEV` false) and never under vitest. Optional-chained:\n * `import.meta.env` is a Vite injection, absent under plain Node.\n */\nfunction devWarnings(): boolean {\n return Boolean(import.meta.env?.DEV) && !import.meta.env?.VITEST;\n}\nconst warned = new Set<string>();\n/** @internal Once per message. */\nexport function warnLegalOnce(message: string): void {\n if (!devWarnings() || warned.has(message)) return;\n warned.add(message);\n console.warn(`[ui-kit] ${message}`);\n}\n\n/**\n * `text` with every `{ref:key}` replaced by a link to `#key` that reads the section's\n * number — the words around it stay the app's (\"see section {ref:retention}\", \"siehe\n * Abschnitt {ref:retention}\"), so each language keeps its grammar (§4.1). On the imprint,\n * which is not numbered, the link reads the section's heading instead.\n *\n * Outside a {@link LegalPage} the text is returned as it is: there is no order to count.\n * A key the page has no section for stays visible as the raw token — a broken reference\n * an app test can find (`not.toHaveTextContent(\"{ref:\")`), not a silently wrong number.\n */\nexport function resolveLegalRefs(text: string, page: LegalPageContextValue | null): ReactNode {\n if (!page || !text.includes(\"{ref:\")) return text;\n const out: ReactNode[] = [];\n let last = 0;\n for (const match of text.matchAll(REF_TOKEN)) {\n const at = match.index ?? 0;\n if (at > last) out.push(text.slice(last, at));\n const key = match[1];\n const target = page.targets.get(key);\n if (target) {\n out.push(\n <TextLink key={`${key}@${at}`} href={`#${key}`}>\n {target.number ?? target.heading}\n </TextLink>,\n );\n } else {\n warnLegalOnce(`{ref:${key}} on the ${page.page} page points at no section of it.`);\n out.push(match[0]);\n }\n last = at + match[0].length;\n }\n if (last < text.length) out.push(text.slice(last));\n return out;\n}\n\n/** @internal Running text — one translation string — with its line breaks kept and its\n * `{ref:key}` tokens resolved. */\nexport function LegalText({ text, className }: { text: string; className?: string }) {\n const page = useContext(LegalPageContext);\n // `break-words`: an address, an email or a URL in a translation is one long word, and\n // on a 390px phone it would push the column wider than the screen.\n return <p className={cn(\"whitespace-pre-line break-words\", className)}>{resolveLegalRefs(text, page)}</p>;\n}\n\n// ── Links ─────────────────────────────────────────────────────────────────────\n\nexport interface LegalLink {\n href: string;\n /** \"Imprint\", \"Privacy Policy\", \"Terms\". */\n label: ReactNode;\n}\n\nexport interface LegalLinksProps {\n /** Default (0.28): the three routes, `/impressum`, `/privacy` and `/terms`, with the\n * kit's short link labels (`legal.links`), in the contract's order. */\n links?: readonly LegalLink[];\n /**\n * 0.51.4: the app's security page — a \"Security\" link after the others, with the kit's\n * label (`legal.links.security`). Left out, no link: only an app that has the page\n * names its route.\n */\n securityHref?: string;\n /** 0.51.4: the app's accessibility statement — \"Accessibility\", last. As\n * `securityHref`. */\n accessibilityHref?: string;\n /** The page being shown; its link is marked `aria-current=\"page\"`. Usually the\n * router's pathname. */\n currentHref?: string;\n /** `false` renders the links without the `<nav>` landmark — inside `AuthLayout`'s\n * `footer` or `TopBarActionMenu`'s `footer`, which are named `<nav>`s already. The row\n * keeps its spacing and `className` either way (0.27.1: it used to return the bare\n * links, so in a plain container — Kurvenschmiede's account-menu `<li>` — they ran\n * together as \"ImpressumDatenschutzerklärungNutz…\" and overflowed). Default true. */\n nav?: boolean;\n /** Called on a click on any of the links, before it navigates — an account menu closes\n * itself here (0.28.1, keksdose: it had to catch the click on a wrapping `<div>`). */\n onLinkClick?: (event: MouseEvent<HTMLAnchorElement>) => void;\n labels?: LabelOverride<LegalLabels>;\n className?: string;\n}\n\n/** The default links: the three routes under the kit's short labels. */\nfunction defaultLinks(labels: LegalLabels): LegalLink[] {\n return ([\"impressum\", \"privacy\", \"terms\"] as const).map((page) => ({\n href: LEGAL_HREFS[page],\n label: labels.links[page],\n }));\n}\n\n/** The optional pages after them, each only where the app named its route. */\nfunction infoLinks(labels: LegalLabels, hrefs: Partial<Record<LegalInfoPageKey, string>>): LegalLink[] {\n return ([\"security\", \"accessibility\"] as const).flatMap((page) => {\n const href = hrefs[page];\n return href ? [{ href, label: labels.links[page] ?? DEFAULT_LEGAL_LABELS.links[page] }] : [];\n });\n}\n\n/**\n * The legal pages as a row of quiet links, the one you are on marked (kastlan's\n * `LegalLinks`). Wraps on a phone.\n *\n * 0.28: `·` separators between the links, keksdose's footer style, wherever the links\n * appear — the account menu included (§3.3). The dots are `aria-hidden`: a screen reader\n * already hears three links, and \"middle dot\" between them is noise. They are flex items\n * of the row like the links, so the row's gap spaces them evenly.\n */\nexport function LegalLinks({\n links,\n securityHref,\n accessibilityHref,\n currentHref,\n nav = true,\n onLinkClick,\n labels: labelsProp,\n className,\n}: LegalLinksProps) {\n const labels = useLegalLabels(labelsProp);\n const shown = [\n ...(links ?? defaultLinks(labels)),\n ...infoLinks(labels, { security: securityHref, accessibility: accessibilityHref }),\n ];\n const items = shown.flatMap((link, i) => [\n ...(i > 0\n ? [\n <span key={`sep-${link.href}`} aria-hidden=\"true\">\n ·\n </span>,\n ]\n : []),\n <TextLink key={link.href} href={link.href} tone=\"muted\" current={link.href === currentHref} onClick={onLinkClick}>\n {link.label}\n </TextLink>,\n ]);\n const rowClass = cn(\"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs\", className);\n if (!nav) return <div className={rowClass}>{items}</div>;\n return (\n <nav aria-label={labels.navLabel} className={rowClass}>\n {items}\n </nav>\n );\n}\n\n// ── Footer ────────────────────────────────────────────────────────────────────\n\nexport interface LegalFooterProps {\n /** Under the links, centred — the app's tagline (keksdose: \"Self-hosted household\n * budgeting & bookkeeping.\"). */\n children?: ReactNode;\n /** Default: the three routes with the kit's link labels — see {@link LegalLinks}. */\n links?: readonly LegalLink[];\n /** 0.51.4: \"Security\" after the others — see {@link LegalLinksProps.securityHref}. */\n securityHref?: string;\n /** 0.51.4: \"Accessibility\", last — see {@link LegalLinksProps.accessibilityHref}. */\n accessibilityHref?: string;\n /** Marks that link `aria-current=\"page\"`. {@link LegalPage}'s default footer passes\n * its own page. */\n currentHref?: string;\n /**\n * 0.55: the app's other public pages — the changelog, a status page, the docs — as a row\n * of their own above the legal links. The legal row's look (quiet links, `·` between\n * them, the current one marked), in a `<nav>` of its own named `landing.siteNavLabel`\n * (\"More pages\"): a screen reader hears the footer's links announced as the legal ones,\n * so a link that is not one goes in a row that says so (docs/landing-demo-harmonization.md\n * §4.4). The name is a `landing` word, not a `legal` one — it is no legal wording — so\n * the provider sets it, not {@link labels}. Left out or empty, no row.\n */\n siteLinks?: readonly LegalLink[];\n /**\n * Default true: the footer is a `<footer>`. `false` draws a `<div>` — for a host that is\n * a footer already: `AuthLayout`'s `footer` slot is one, and HTML forbids a footer inside\n * a footer (0.28.1, kastlan). On an `AuthLayout` page the usual choice is simpler still:\n * `footer={<LegalLinks nav={false} />}` with `footerLabel` set to the kit's `navLabel`\n * ({@link useLegalLabels}).\n */\n landmark?: boolean;\n className?: string;\n labels?: LabelOverride<LegalLabels>;\n}\n\n/**\n * The public footer (§3.3): the three links, centred, with their separators, in a\n * `<nav aria-label=\"Legal\">` — on the landing or home page, every signed-out page the app\n * has, the legal pages and the 404. The rule behind it: from every page a signed-out\n * visitor can reach, the three links are one click away.\n *\n * keksdose's `SiteFooter` (features/landing/site-footer.tsx), which carried them on its\n * landing, auth, legal and 404 pages; kastlan and Kurvenschmiede had them on some pages\n * only. Its palette classes (`border-slate-200 bg-white dark:…`) became the surface and\n * border tokens, so it follows the theme like the rest of the kit.\n *\n * 0.51.4: an app with a security page or an accessibility statement passes their routes\n * (`securityHref`, `accessibilityHref`) and the row goes on with \"Security · Accessibility\"\n * in the kit's words, so the footer reads the same in every app that has them.\n *\n * 0.55: `siteLinks`, the app's other public pages, in a row above them that is named apart.\n */\nexport function LegalFooter({\n children,\n links,\n securityHref,\n accessibilityHref,\n currentHref,\n siteLinks,\n landmark = true,\n className,\n labels,\n}: LegalFooterProps) {\n const Root = landmark ? \"footer\" : \"div\";\n const siteNavLabel = useLandingLabels().siteNavLabel ?? DEFAULT_LANDING_LABELS.siteNavLabel ?? \"\";\n return (\n <Root className={cn(\"border-t border-subtle bg-surface\", className)}>\n <div className=\"mx-auto max-w-5xl px-4 py-8 text-sm text-muted\">\n {/* The legal row's own component, renamed: the same look, a `<nav>` of its own. */}\n {!!siteLinks?.length && (\n <LegalLinks\n links={siteLinks}\n currentHref={currentHref}\n labels={{ navLabel: siteNavLabel }}\n className=\"mb-3 justify-center gap-y-2 text-sm\"\n />\n )}\n <LegalLinks\n links={links}\n securityHref={securityHref}\n accessibilityHref={accessibilityHref}\n currentHref={currentHref}\n labels={labels}\n className=\"justify-center gap-y-2 text-sm\"\n />\n {children !== undefined && children !== null && <p className=\"mt-4 text-center\">{children}</p>}\n </div>\n </Root>\n );\n}\n\n// ── Section ───────────────────────────────────────────────────────────────────\n\nexport interface LegalSectionProps {\n heading: ReactNode;\n /** Running text. Line breaks in it are kept (`white-space: pre-line`), so a\n * translation can hold an address or a list as plain lines. Inside a\n * {@link LegalPage}, `{ref:key}` becomes the number of section `key`, linked. */\n body?: string;\n /** Anything richer than plain text — links, a list — after `body`. A plain string\n * here has its `{ref:key}` tokens resolved too. */\n children?: ReactNode;\n /**\n * The section's `id`, for a link to it from elsewhere. Inside a {@link LegalPage} it\n * defaults to the element's React `key` — keksdose's\n * `SECTIONS.map((s) => <LegalSection key={s} … />)` gets `id=\"retention\"` with\n * nothing added — and it is the key a `{ref:…}` names.\n */\n id?: string;\n /** The heading's element. Default `h2` under the layout's `h1` (inside a\n * `LegalPage`, one level below its title). */\n headingAs?: \"h2\" | \"h3\";\n}\n\n/**\n * One section: heading and running text.\n *\n * 0.28, inside a {@link LegalPage}: its `id` (the `key` unless given), its number on the\n * privacy policy and the terms (\"3. Legal basis\" — titles carry no number, §4.1), and\n * `{ref:key}` resolution in `body`. Outside one it is exactly the 0.19 section.\n */\nexport function LegalSection({ heading, body, children, id: idProp, headingAs }: LegalSectionProps) {\n const page = useContext(LegalPageContext);\n const slot = useContext(LegalSlotContext);\n const id = idProp ?? slot?.id;\n const number = slot?.number;\n const Heading = headingAs ?? page?.sectionHeading ?? \"h2\";\n return (\n <section id={id} className=\"scroll-mt-20\">\n <Heading className=\"text-lg font-semibold break-words text-primary\">\n {number !== undefined && `${number}. `}\n {heading}\n </Heading>\n <LegalSlotContext.Provider value={null}>\n {body !== undefined && <LegalText text={body} className=\"mt-2 text-sm leading-relaxed text-secondary\" />}\n {children !== undefined && (\n <div className=\"mt-2 text-sm leading-relaxed break-words text-secondary\">\n {typeof children === \"string\" ? resolveLegalRefs(children, page) : children}\n </div>\n )}\n </LegalSlotContext.Provider>\n </section>\n );\n}\n\n// ── Layout ────────────────────────────────────────────────────────────────────\n\nexport interface LegalLayoutProps {\n /** \"Imprint\", \"Privacy Policy\", \"Terms\". */\n title: ReactNode;\n /** Above the title — the app's \"← Back\" link (`<TextLink icon={ArrowLeft}>`). Inside\n * a {@link LegalPage}, \"← Back to home\". */\n back?: ReactNode;\n /**\n * A notice under the title, as a warning banner with `role=\"note\"` — page furniture,\n * not an alert. Per page, not per layout: the privacy page says something more precise\n * than the others (its technical sections describe running code).\n */\n notice?: ReactNode;\n /** 0.51.3: right under the title — {@link LegalPage}'s \"Last updated: …\" line. */\n updated?: ReactNode;\n /** 0.28.1: under the title, before the notice — {@link LegalPage}'s note that this\n * page is a translation and which language is binding. */\n translationNote?: ReactNode;\n /** 0.51.4: before the sections — {@link LegalPage}'s plain-language summary. */\n summary?: ReactNode;\n /** The sections — {@link LegalSection}s. */\n children: ReactNode;\n /** The three pages, linked at the end of the column with the current one marked.\n * Leave out when the page's chrome already shows them (a {@link LegalFooter}). */\n links?: readonly LegalLink[];\n currentHref?: string;\n /** Default `h1`: the page's heading. */\n headingAs?: \"h1\" | \"h2\";\n /** Extra classes on the column — `px-0 py-0` inside a chrome that pads already. */\n className?: string;\n labels?: LabelOverride<LegalLabels>;\n}\n\nexport function LegalLayout({\n title,\n back,\n notice,\n updated,\n translationNote,\n summary,\n children,\n links,\n currentHref,\n headingAs: Heading = \"h1\",\n className,\n labels,\n}: LegalLayoutProps) {\n return (\n <article className={cn(\"mx-auto w-full max-w-3xl px-4 py-12\", className)}>\n {back !== undefined && <div className=\"mb-4 text-sm\">{back}</div>}\n <Heading className=\"text-3xl font-bold tracking-tight break-words text-primary\">{title}</Heading>\n {updated !== undefined && updated !== null && <p className=\"mt-2 text-sm text-muted\">{updated}</p>}\n {translationNote !== undefined && translationNote !== null && <div className=\"mt-3\">{translationNote}</div>}\n {notice !== undefined && notice !== null && (\n <AlertBanner tone=\"warning\" role=\"note\" className=\"mt-4\">\n {notice}\n </AlertBanner>\n )}\n <div className=\"mt-8 space-y-8\">\n {summary}\n {children}\n </div>\n {links !== undefined && links.length > 0 && (\n <LegalLinks\n links={links}\n currentHref={currentHref}\n labels={labels}\n className=\"mt-12 border-t border-subtle pt-4\"\n />\n )}\n </article>\n );\n}\n"],"mappings":";AA8VQ,cA8LF,YA9LE;AA9VR,SAAS,eAAe,kBAAkB;AAG1C,SAAS,oBAAoB;AAE7B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;AACrC,SAAS,wBAAwB,wBAAwB;AA+BlD,MAAM,cAAsD,OAAO,OAAO;AAAA,EAC/E,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AACT,CAAC;AAmDM,SAAS,aAAa,MAAsB;AACjD,SAAO,KAAK,MAAM,MAAM,EAAE,CAAC,EAAG,YAAY;AAC5C;AAEA,MAAM,iBAAiB,oBAAI,IAAsC;AAKjE,SAAS,aAAa,MAAc,QAAwB;AAC1D,MAAI,QAAQ,eAAe,IAAI,MAAM;AACrC,MAAI,UAAU,QA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C,SAAI,WAAU,kBACZ;AAAA;AAAA,MACA;AAAA,OACH;AAAA,IACC,UAAU,UAAa,MAAM,SAAS,KACrC;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,WAAU;AAAA;AAAA,IACZ;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type SeriesChartAxis, type SeriesChartProps, type SeriesChartSeries } from "./series-chart.js";
|
|
3
|
+
import { type LegendEntry } from "./toggle-legend.js";
|
|
4
|
+
/**
|
|
5
|
+
* What the legend is, and who keeps the series it has switched off.
|
|
6
|
+
*
|
|
7
|
+
* - `legend: "toggle"` (the default): every entry a switch that takes its series off the
|
|
8
|
+
* chart and brings it back (`ToggleLegend`). The chart keeps what is off — or the caller
|
|
9
|
+
* does, with `hidden` and `onToggle` together: for a choice that has to outlive the chart
|
|
10
|
+
* (a tab that shows its skeleton while the next month loads), or one kept by something
|
|
11
|
+
* steadier than the series key (keksdose's shop names, whose keys re-slot when the markets
|
|
12
|
+
* narrow).
|
|
13
|
+
* - `legend: "key"`: a key, not a control (`StaticLegend`) — a list to a screen reader, no
|
|
14
|
+
* tab stops, every series drawn. For a legend that says what a mark means without
|
|
15
|
+
* letting it be switched: keksdose's cash buffer, whose dashed projection and amber
|
|
16
|
+
* marker are named, not toggled.
|
|
17
|
+
*/
|
|
18
|
+
export type LegendedSeriesChartLegend = {
|
|
19
|
+
legend?: "toggle";
|
|
20
|
+
hidden?: undefined;
|
|
21
|
+
onToggle?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
legend?: "toggle";
|
|
24
|
+
/** The keys switched off, kept by the caller. */
|
|
25
|
+
hidden: ReadonlySet<string>;
|
|
26
|
+
/** An entry was switched: its series' key. */
|
|
27
|
+
onToggle: (key: string) => void;
|
|
28
|
+
} | {
|
|
29
|
+
legend: "key";
|
|
30
|
+
hidden?: undefined;
|
|
31
|
+
onToggle?: undefined;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The props of {@link LegendedSeriesChart}: a {@link SeriesChartProps} for rows of type
|
|
35
|
+
* `TRow`, whose `series` is the FULL list and whose `axes` may follow what is switched off.
|
|
36
|
+
*/
|
|
37
|
+
export type LegendedSeriesChartProps<TRow extends object = object> = Omit<SeriesChartProps<TRow>, "series" | "axes"> & LegendedSeriesChartLegend & {
|
|
38
|
+
/** EVERY series, the switched-off ones included: the legend lists them all, and the
|
|
39
|
+
* chart draws the rest through `visibleSeries`, which settles each colour on this full
|
|
40
|
+
* list first, so a switch never repaints a neighbour. */
|
|
41
|
+
series: readonly SeriesChartSeries<TRow>[];
|
|
42
|
+
/** The axes, or a function of the switched-off keys, for an axis drawn only while its
|
|
43
|
+
* series is: keksdose's running sum, whose axis hands the bars its room back when the
|
|
44
|
+
* line is switched off. */
|
|
45
|
+
axes?: readonly SeriesChartAxis[] | ((hidden: ReadonlySet<string>) => readonly SeriesChartAxis[]);
|
|
46
|
+
/**
|
|
47
|
+
* The legend's entries, when not the kit's own for `series` (`seriesLegendEntries`,
|
|
48
|
+
* handed the axes drawn and those the axis budget hid, so a series on an undrawn axis
|
|
49
|
+
* says its unit): a stroke for every line, or a key's marks that are not series (a
|
|
50
|
+
* marker, a reference line). A switch reports its entry's `key`.
|
|
51
|
+
*/
|
|
52
|
+
legendEntries?: readonly LegendEntry[];
|
|
53
|
+
/** Onto the legend: its row is centred under the chart, wrapping. */
|
|
54
|
+
legendClassName?: string;
|
|
55
|
+
/** Wraps the chart and the chart alone — a horizontal scroller the legend has to stay
|
|
56
|
+
* out of, so it is in view however far the chart is scrolled (keksdose's budget
|
|
57
|
+
* performance, with `tooltip.boundary` on the scroller). */
|
|
58
|
+
frame?: (chart: ReactNode) => ReactNode;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* A {@link SeriesChart} and its legend, the legend centred under it: the kit's layout of the
|
|
62
|
+
* two, which keksdose, kastlan and the kit's own showcase each assembled from the parts.
|
|
63
|
+
*
|
|
64
|
+
* With the default `legend: "toggle"` each entry is a switch: the chart is drawn with
|
|
65
|
+
* `visibleSeries(series, hidden)`, the legend lists every series (`seriesLegendEntries`),
|
|
66
|
+
* and a series that is off keeps its place and its colour in the legend. A legend of one
|
|
67
|
+
* series is drawn only while that series is off — the one way to bring it back. With
|
|
68
|
+
* `legend: "key"` it is a {@link StaticLegend} of the same entries, and every series is
|
|
69
|
+
* drawn.
|
|
70
|
+
*
|
|
71
|
+
* Everything else is the chart's: rows, axes, zoom, tooltip, `onPointClick`, `aria-label`,
|
|
72
|
+
* all as {@link SeriesChartProps} take them. Generic in its rows as SeriesChart is (0.53):
|
|
73
|
+
* `hit.row` and a `dot`'s `point.row` are typed as `rows` is. A plain function, so the
|
|
74
|
+
* generic survives.
|
|
75
|
+
*
|
|
76
|
+
* The chart is handed the same `series` and `axes` objects while neither the caller's nor
|
|
77
|
+
* the hidden set changes, so a render of the page costs it nothing (see SeriesChart's
|
|
78
|
+
* memoised plot) — as long as the caller keeps its own the same.
|
|
79
|
+
*/
|
|
80
|
+
export declare function LegendedSeriesChart<TRow extends object = object>({ series, axes, legend, legendEntries, legendClassName, frame, hidden: hiddenProp, onToggle, onAxisBudget, ...chartProps }: LegendedSeriesChartProps<TRow>): import("react").JSX.Element;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useMemo, useState } from "react";
|
|
4
|
+
import {
|
|
5
|
+
SeriesChart,
|
|
6
|
+
seriesLegendEntries,
|
|
7
|
+
visibleSeries
|
|
8
|
+
} from "./series-chart.js";
|
|
9
|
+
import { StaticLegend, ToggleLegend, toggleHidden } from "./toggle-legend.js";
|
|
10
|
+
import { cn } from "../lib/cn.js";
|
|
11
|
+
const NONE = /* @__PURE__ */ new Set();
|
|
12
|
+
function LegendedSeriesChart({
|
|
13
|
+
series,
|
|
14
|
+
axes,
|
|
15
|
+
legend = "toggle",
|
|
16
|
+
legendEntries,
|
|
17
|
+
legendClassName,
|
|
18
|
+
frame,
|
|
19
|
+
hidden: hiddenProp,
|
|
20
|
+
onToggle,
|
|
21
|
+
onAxisBudget,
|
|
22
|
+
...chartProps
|
|
23
|
+
}) {
|
|
24
|
+
const [ownHidden, setOwnHidden] = useState(NONE);
|
|
25
|
+
const hidden = legend === "key" ? NONE : hiddenProp ?? ownHidden;
|
|
26
|
+
const toggle = useCallback(
|
|
27
|
+
(key) => onToggle ? onToggle(key) : setOwnHidden((was) => toggleHidden(was, key)),
|
|
28
|
+
[onToggle]
|
|
29
|
+
);
|
|
30
|
+
const [budgeted, setBudgeted] = useState([]);
|
|
31
|
+
const reportBudget = useCallback(
|
|
32
|
+
(ids) => {
|
|
33
|
+
setBudgeted(ids);
|
|
34
|
+
onAxisBudget?.(ids);
|
|
35
|
+
},
|
|
36
|
+
[onAxisBudget]
|
|
37
|
+
);
|
|
38
|
+
const drawn = useMemo(() => visibleSeries(series, hidden), [series, hidden]);
|
|
39
|
+
const drawnAxes = useMemo(() => typeof axes === "function" ? axes(hidden) : axes, [axes, hidden]);
|
|
40
|
+
const entries = useMemo(
|
|
41
|
+
() => legendEntries ?? seriesLegendEntries(series, { axes: drawnAxes, budgeted }),
|
|
42
|
+
[legendEntries, series, drawnAxes, budgeted]
|
|
43
|
+
);
|
|
44
|
+
const chart = /* @__PURE__ */ jsx(
|
|
45
|
+
SeriesChart,
|
|
46
|
+
{
|
|
47
|
+
...chartProps,
|
|
48
|
+
series: drawn,
|
|
49
|
+
axes: drawnAxes,
|
|
50
|
+
onAxisBudget: reportBudget
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
54
|
+
frame ? frame(chart) : chart,
|
|
55
|
+
legend === "key" ? /* @__PURE__ */ jsx(StaticLegend, { entries, className: cn("justify-center", legendClassName) }) : /* @__PURE__ */ jsx(
|
|
56
|
+
ToggleLegend,
|
|
57
|
+
{
|
|
58
|
+
entries,
|
|
59
|
+
hidden,
|
|
60
|
+
onToggle: toggle,
|
|
61
|
+
showSingle: entries.some((entry) => hidden.has(entry.key)),
|
|
62
|
+
className: cn("justify-center", legendClassName)
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
LegendedSeriesChart
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=legended-series-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/legended-series-chart.tsx"],"sourcesContent":["// A series chart with its legend under it, as one part (0.55). Lifted out of keksdose's\n// reports, where `LegendedSeriesChart` (features/reports/charts/legended-series-chart.tsx)\n// wired six report charts — net worth, investments, income and expense, the grouped and\n// stacked payees, budget performance, the price history — and out of kastlan's reporting\n// and dashboard charts and keksdose's metrics panel, which wrote the same pairing by hand:\n// a hidden set, `visibleSeries` for the chart, the FULL list for the legend through\n// `seriesLegendEntries`, and a `ToggleLegend` centred under the plot. The kit exported the\n// parts and left the pairing to every app; this is the pairing.\nimport { useCallback, useMemo, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport {\n SeriesChart,\n seriesLegendEntries,\n visibleSeries,\n type SeriesChartAxis,\n type SeriesChartProps,\n type SeriesChartSeries,\n} from \"./series-chart\";\nimport { StaticLegend, ToggleLegend, toggleHidden, type LegendEntry } from \"./toggle-legend\";\nimport { cn } from \"../lib/cn\";\n\n/**\n * What the legend is, and who keeps the series it has switched off.\n *\n * - `legend: \"toggle\"` (the default): every entry a switch that takes its series off the\n * chart and brings it back (`ToggleLegend`). The chart keeps what is off — or the caller\n * does, with `hidden` and `onToggle` together: for a choice that has to outlive the chart\n * (a tab that shows its skeleton while the next month loads), or one kept by something\n * steadier than the series key (keksdose's shop names, whose keys re-slot when the markets\n * narrow).\n * - `legend: \"key\"`: a key, not a control (`StaticLegend`) — a list to a screen reader, no\n * tab stops, every series drawn. For a legend that says what a mark means without\n * letting it be switched: keksdose's cash buffer, whose dashed projection and amber\n * marker are named, not toggled.\n */\nexport type LegendedSeriesChartLegend =\n | {\n legend?: \"toggle\";\n hidden?: undefined;\n onToggle?: undefined;\n }\n | {\n legend?: \"toggle\";\n /** The keys switched off, kept by the caller. */\n hidden: ReadonlySet<string>;\n /** An entry was switched: its series' key. */\n onToggle: (key: string) => void;\n }\n | { legend: \"key\"; hidden?: undefined; onToggle?: undefined };\n\n/**\n * The props of {@link LegendedSeriesChart}: a {@link SeriesChartProps} for rows of type\n * `TRow`, whose `series` is the FULL list and whose `axes` may follow what is switched off.\n */\nexport type LegendedSeriesChartProps<TRow extends object = object> = Omit<SeriesChartProps<TRow>, \"series\" | \"axes\"> &\n LegendedSeriesChartLegend & {\n /** EVERY series, the switched-off ones included: the legend lists them all, and the\n * chart draws the rest through `visibleSeries`, which settles each colour on this full\n * list first, so a switch never repaints a neighbour. */\n series: readonly SeriesChartSeries<TRow>[];\n /** The axes, or a function of the switched-off keys, for an axis drawn only while its\n * series is: keksdose's running sum, whose axis hands the bars its room back when the\n * line is switched off. */\n axes?: readonly SeriesChartAxis[] | ((hidden: ReadonlySet<string>) => readonly SeriesChartAxis[]);\n /**\n * The legend's entries, when not the kit's own for `series` (`seriesLegendEntries`,\n * handed the axes drawn and those the axis budget hid, so a series on an undrawn axis\n * says its unit): a stroke for every line, or a key's marks that are not series (a\n * marker, a reference line). A switch reports its entry's `key`.\n */\n legendEntries?: readonly LegendEntry[];\n /** Onto the legend: its row is centred under the chart, wrapping. */\n legendClassName?: string;\n /** Wraps the chart and the chart alone — a horizontal scroller the legend has to stay\n * out of, so it is in view however far the chart is scrolled (keksdose's budget\n * performance, with `tooltip.boundary` on the scroller). */\n frame?: (chart: ReactNode) => ReactNode;\n };\n\n/** Nothing switched off, one set for every chart that keeps its own. */\nconst NONE: ReadonlySet<string> = new Set();\n\n/**\n * A {@link SeriesChart} and its legend, the legend centred under it: the kit's layout of the\n * two, which keksdose, kastlan and the kit's own showcase each assembled from the parts.\n *\n * With the default `legend: \"toggle\"` each entry is a switch: the chart is drawn with\n * `visibleSeries(series, hidden)`, the legend lists every series (`seriesLegendEntries`),\n * and a series that is off keeps its place and its colour in the legend. A legend of one\n * series is drawn only while that series is off — the one way to bring it back. With\n * `legend: \"key\"` it is a {@link StaticLegend} of the same entries, and every series is\n * drawn.\n *\n * Everything else is the chart's: rows, axes, zoom, tooltip, `onPointClick`, `aria-label`,\n * all as {@link SeriesChartProps} take them. Generic in its rows as SeriesChart is (0.53):\n * `hit.row` and a `dot`'s `point.row` are typed as `rows` is. A plain function, so the\n * generic survives.\n *\n * The chart is handed the same `series` and `axes` objects while neither the caller's nor\n * the hidden set changes, so a render of the page costs it nothing (see SeriesChart's\n * memoised plot) — as long as the caller keeps its own the same.\n */\nexport function LegendedSeriesChart<TRow extends object = object>({\n series,\n axes,\n legend = \"toggle\",\n legendEntries,\n legendClassName,\n frame,\n hidden: hiddenProp,\n onToggle,\n onAxisBudget,\n ...chartProps\n}: LegendedSeriesChartProps<TRow>) {\n const [ownHidden, setOwnHidden] = useState<ReadonlySet<string>>(NONE);\n // A key switches nothing: every series is drawn.\n const hidden = legend === \"key\" ? NONE : (hiddenProp ?? ownHidden);\n const toggle = useCallback(\n (key: string) => (onToggle ? onToggle(key) : setOwnHidden((was) => toggleHidden(was, key))),\n [onToggle],\n );\n // What the axis budget hid, for the legend to say those axes' units (SeriesChart's\n // `onAxisBudget`); the caller's own callback is still told.\n const [budgeted, setBudgeted] = useState<readonly string[]>([]);\n const reportBudget = useCallback(\n (ids: readonly string[]) => {\n setBudgeted(ids);\n onAxisBudget?.(ids);\n },\n [onAxisBudget],\n );\n const drawn = useMemo(() => visibleSeries(series, hidden), [series, hidden]);\n const drawnAxes = useMemo(() => (typeof axes === \"function\" ? axes(hidden) : axes), [axes, hidden]);\n const entries = useMemo(\n () => legendEntries ?? seriesLegendEntries(series, { axes: drawnAxes, budgeted }),\n [legendEntries, series, drawnAxes, budgeted],\n );\n // SeriesChart's own props, with `TRow` as the caller's: the rest is passed through as is.\n const chart = (\n <SeriesChart<TRow>\n {...(chartProps as Omit<SeriesChartProps<TRow>, \"series\" | \"axes\" | \"onAxisBudget\">)}\n series={drawn}\n axes={drawnAxes}\n onAxisBudget={reportBudget}\n />\n );\n return (\n <div>\n {frame ? frame(chart) : chart}\n {legend === \"key\" ? (\n <StaticLegend entries={entries} className={cn(\"justify-center\", legendClassName)} />\n ) : (\n <ToggleLegend\n entries={entries}\n hidden={hidden}\n onToggle={toggle}\n // One series' legend is noise — until that series is off, and its entry is the\n // only way back.\n showSingle={entries.some((entry) => hidden.has(entry.key))}\n className={cn(\"justify-center\", legendClassName)}\n />\n )}\n </div>\n );\n}\n"],"mappings":";AA2II,cAQA,YARA;AAnIJ,SAAS,aAAa,SAAS,gBAAgB;AAE/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,cAAc,cAAc,oBAAsC;AAC3E,SAAS,UAAU;AA6DnB,MAAM,OAA4B,oBAAI,IAAI;AAsBnC,SAAS,oBAAkD;AAAA,EAChE;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAmC;AACjC,QAAM,CAAC,WAAW,YAAY,IAAI,SAA8B,IAAI;AAEpE,QAAM,SAAS,WAAW,QAAQ,OAAQ,cAAc;AACxD,QAAM,SAAS;AAAA,IACb,CAAC,QAAiB,WAAW,SAAS,GAAG,IAAI,aAAa,CAAC,QAAQ,aAAa,KAAK,GAAG,CAAC;AAAA,IACzF,CAAC,QAAQ;AAAA,EACX;AAGA,QAAM,CAAC,UAAU,WAAW,IAAI,SAA4B,CAAC,CAAC;AAC9D,QAAM,eAAe;AAAA,IACnB,CAAC,QAA2B;AAC1B,kBAAY,GAAG;AACf,qBAAe,GAAG;AAAA,IACpB;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AACA,QAAM,QAAQ,QAAQ,MAAM,cAAc,QAAQ,MAAM,GAAG,CAAC,QAAQ,MAAM,CAAC;AAC3E,QAAM,YAAY,QAAQ,MAAO,OAAO,SAAS,aAAa,KAAK,MAAM,IAAI,MAAO,CAAC,MAAM,MAAM,CAAC;AAClG,QAAM,UAAU;AAAA,IACd,MAAM,iBAAiB,oBAAoB,QAAQ,EAAE,MAAM,WAAW,SAAS,CAAC;AAAA,IAChF,CAAC,eAAe,QAAQ,WAAW,QAAQ;AAAA,EAC7C;AAEA,QAAM,QACJ;AAAA,IAAC;AAAA;AAAA,MACE,GAAI;AAAA,MACL,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,cAAc;AAAA;AAAA,EAChB;AAEF,SACE,qBAAC,SACE;AAAA,YAAQ,MAAM,KAAK,IAAI;AAAA,IACvB,WAAW,QACV,oBAAC,gBAAa,SAAkB,WAAW,GAAG,kBAAkB,eAAe,GAAG,IAElF;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,UAAU;AAAA,QAGV,YAAY,QAAQ,KAAK,CAAC,UAAU,OAAO,IAAI,MAAM,GAAG,CAAC;AAAA,QACzD,WAAW,GAAG,kBAAkB,eAAe;AAAA;AAAA,IACjD;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -4,6 +4,7 @@ import { useEffect, useRef, useState } from "react";
|
|
|
4
4
|
import { ChevronLeft, ChevronRight, Download, ExternalLink, FileText, ZoomIn } from "lucide-react";
|
|
5
5
|
import { cn } from "../lib/cn.js";
|
|
6
6
|
import { horizontalStep } from "../lib/direction.js";
|
|
7
|
+
import { isEditableContent } from "../lib/editable-content.js";
|
|
7
8
|
import { hasContent } from "../lib/presence.js";
|
|
8
9
|
import { useKitLabels } from "../i18n/kit-labels.js";
|
|
9
10
|
import { useAuthedSrc } from "../hooks/use-authed-src.js";
|
|
@@ -64,7 +65,7 @@ function Lightbox({
|
|
|
64
65
|
};
|
|
65
66
|
const onKeyDown = (e) => {
|
|
66
67
|
const target = e.target;
|
|
67
|
-
if (target.closest("input, textarea, select
|
|
68
|
+
if (target.closest("input, textarea, select") || isEditableContent(target)) return;
|
|
68
69
|
const step = horizontalStep(e.key, e.currentTarget);
|
|
69
70
|
if (step !== 0) {
|
|
70
71
|
e.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/lightbox.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { KeyboardEvent, ReactNode, TouchEvent } from \"react\";\nimport { ChevronLeft, ChevronRight, Download, ExternalLink, FileText, ZoomIn } from \"lucide-react\";\n\nimport { cn } from \"../lib/cn\";\nimport { horizontalStep } from \"../lib/direction\";\nimport { hasContent } from \"../lib/presence\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { useAuthedSrc } from \"../hooks/use-authed-src\";\nimport { useBreakpoint } from \"../hooks/use-breakpoint\";\nimport type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { FullBleedDialog } from \"./full-bleed-dialog\";\nimport { IconButton } from \"./icon-button\";\nimport { buttonClasses } from \"./button-look\";\nimport { ImageStates, DEFAULT_AUTHED_IMAGE_LABELS } from \"./authed-image\";\nimport { useAnchorDir } from \"./use-anchor-dir\";\nimport { DEFAULT_LIGHTBOX_LABELS } from \"./lightbox-labels\";\n\n/* ── The item both the grid and the lightbox show ────────────────────────── */\n\n/** `image`: shown as a picture. `file`: anything a browser cannot put in an `<img>` —\n * a floor plan uploaded as a PDF — shown as a file card with open and download. */\nexport type ImageItemKind = \"image\" | \"file\";\n\nexport interface ImageItem {\n /** React key. Defaults to `src`. */\n key?: string | number;\n /** The full-size file — what the lightbox shows and downloads. An API path when the\n * component is given a `fetcher`. */\n src: string;\n /** A smaller rendition for the grid, when the server has one. Default: `src`. */\n thumbnailSrc?: string;\n /** Required: the picture's text alternative, and the open button's name. */\n alt: string;\n /** Shown under the thumbnail and at the foot of the lightbox. */\n caption?: ReactNode;\n /** The file's MIME type, when known (`\"application/pdf\"`). Decides {@link kind}. */\n mimeType?: string;\n /** Say it outright. Default: from {@link mimeType}, else from the file extension in\n * `src`, else — for a fetched file — from the type the server sent back. */\n kind?: ImageItemKind;\n /** The name a download is saved under, and a file card's heading. */\n fileName?: string;\n}\n\nconst FILE_EXTENSION = /\\.(pdf|docx?|xlsx?|pptx?|odt|ods|zip|txt|csv|rtf)(?:[?#]|$)/i;\n\n/** What an item is, from what is known about it WITHOUT fetching it — see\n * {@link ImageItem.kind}. `fetchedType` is the blob's type once it is in. */\nexport function imageItemKind(item: ImageItem, fetchedType?: string): ImageItemKind {\n if (item.kind) return item.kind;\n if (item.mimeType) return item.mimeType.startsWith(\"image/\") ? \"image\" : \"file\";\n if (FILE_EXTENSION.test(item.src)) return \"file\";\n if (fetchedType && !fetchedType.startsWith(\"image/\")) return \"file\";\n return \"image\";\n}\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\nexport interface LightboxLabels {\n /** The dialog's accessible name. */\n dialog: string;\n close: string;\n previous: string;\n next: string;\n /** The visible counter: \"3 / 7\". */\n counter: (index: number, count: number) => string;\n /** What a screen reader hears on each page turn: \"Image 3 of 7\". The alt follows. */\n position: (index: number, count: number) => string;\n download: string;\n /** The zoom toggle (a pressed/not-pressed button — its name does not change). */\n zoom: string;\n /** A file card's note: the file has no picture to show. */\n noPreview: string;\n /** A file card's link to the browser's own viewer (a PDF opens in its viewer). */\n openInNewTab: string;\n}\n\n// Defined in ./lightbox-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_LIGHTBOX_LABELS };\n\n/* ── The component ───────────────────────────────────────────────────────── */\n\nexport interface LightboxProps {\n open: boolean;\n /** The X, Escape and the Back gesture all call this. */\n onClose: () => void;\n items: readonly ImageItem[];\n /** The item on screen (0-based). Controlled, so the grid — or a URL — can own it. */\n index: number;\n onIndexChange: (index: number) => void;\n /** The app's authenticated GET (see {@link useAuthedSrc}); left out, `src` is\n * loaded by the browser as usual. */\n fetcher?: AuthedFetcher | null;\n /** Previous from the first goes to the last, and next from the last to the first.\n * Default `false`: the buttons at the ends refuse (`aria-disabled`, focus kept — 0.52),\n * which says where the set ends. */\n loop?: boolean;\n /** Double-click (or double-tap) the picture, or the zoom button, to see it at full\n * size and pan by scrolling. Default `true`. Pinch zoom is the browser's own. */\n zoom?: boolean;\n /** A download link in the header. Default `true`. */\n download?: boolean;\n /**\n * Download through the app instead — kastlan's floor plans have `openDocument(id)`,\n * which knows the stored file name. Replaces the link with a button that calls this.\n */\n onDownload?: (item: ImageItem, index: number) => void;\n /** Push a history entry so Back closes the viewer. Default `true`; see\n * `FullBleedDialog`'s `backCloses` for when to turn it off. */\n backCloses?: boolean;\n labels?: LabelOverride<LightboxLabels>;\n}\n\n/** Swipes shorter than this are taps, and a drag that is mostly vertical is a scroll. */\nconst SWIPE_MIN_PX = 50;\n\n/** An end arrow's look: a disabled `overlay` IconButton's (its 50% and its resting disc\n * under hover), for the focusable kind — `disabled:` cannot match `aria-disabled`. */\nconst ARROW_AT_END =\n \"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:hover:bg-[color-mix(in_srgb,var(--bg-inverse)_60%,transparent)]\";\n\n/**\n * A full-screen viewer for a set of images (and files that are not images).\n *\n * Built on {@link FullBleedDialog} rather than beside it, so the viewer has the kit's\n * one implementation of everything an overlay owes the page: the focus trap, Escape,\n * the Back gesture closing it instead of leaving the page (`useOverlayHistory`), the\n * body-scroll lock and the enter/exit motion.\n *\n * Paging: the previous/next buttons, ←/→ (which swap in a right-to-left page — the\n * direction is read at the point the viewer is rendered, since the dialog itself is\n * portalled out of it), Home/End, and a horizontal swipe on a touch screen.\n *\n * Zoom is a TOGGLE, not a gesture: double-click (or the zoom button) shows the picture\n * at its natural size and the body scrolls to pan. Pinch-to-zoom is not implemented —\n * the browser's own page pinch still works — because a pinch handler would have to own\n * every touch on the picture, and with it the swipe.\n *\n * A non-image (a PDF floor plan) is shown as a file card: its name, \"no preview\", a\n * link that opens it in the browser's own viewer, and the download. An `<iframe>`\n * preview was the alternative; phone browsers render a PDF in one inconsistently or\n * not at all, and a card works everywhere.\n */\nexport function Lightbox({\n open,\n onClose,\n items,\n index: indexProp,\n onIndexChange,\n fetcher,\n loop = false,\n zoom: zoomEnabled = true,\n download = true,\n onDownload,\n backCloses,\n labels: labelsProp,\n}: LightboxProps) {\n const labels = useKitLabels(\"lightbox\", DEFAULT_LIGHTBOX_LABELS, labelsProp);\n const imageLabels = useKitLabels(\"authedImage\", DEFAULT_AUTHED_IMAGE_LABELS);\n const count = items.length;\n // Clamped: the set can shrink under an open viewer (the photo on screen was deleted).\n const index = count === 0 ? 0 : Math.min(Math.max(indexProp, 0), count - 1);\n const item = items[index] as ImageItem | undefined;\n\n // The dialog is portalled to <body>, out of the subtree whose `dir` it would have\n // inherited; this marker stays where the viewer was rendered and reads it there.\n const anchorRef = useRef<HTMLSpanElement>(null);\n const dir = useAnchorDir(anchorRef, open);\n\n // The toolbar's words (docs/text-size-harmonization.md §4, §10.8). At Large an\n // IconButton shows its label beside the glyph; on a narrow screen the viewer's header —\n // the counter, Zoom, Download and the dialog's close — has no room for two words at\n // 150 % (a 390 px phone is 260 px of Normal type), so below `sm` the toolbar keeps its\n // icons, as the plain download link hides its word there (`max-sm:sr-only`). From `sm`\n // up, at the same breakpoint the CSS uses, the words show. Each name stays the\n // accessible name and the tooltip either way.\n const narrow = useBreakpoint(\"max-sm\");\n const toolbarLabelVisible = narrow ? false : undefined;\n\n const fetched = useAuthedSrc(item?.src, { fetcher, enabled: open });\n const kind = item ? imageItemKind(item, fetched.type) : \"image\";\n\n const [zoomedKey, setZoomedKey] = useState<string | null>(null);\n const itemKey = item ? String(item.key ?? item.src) : null;\n // Zoom belongs to the picture it was turned on for: paging on resets it.\n const zoomed = zoomEnabled && kind === \"image\" && zoomedKey !== null && zoomedKey === itemKey;\n const toggleZoom = () => setZoomedKey(zoomed ? null : itemKey);\n\n const canPrev = loop ? count > 1 : index > 0;\n const canNext = loop ? count > 1 : index < count - 1;\n const go = (step: number) => {\n if (count === 0) return;\n let next = index + step;\n if (loop) next = (next + count) % count;\n if (next < 0 || next >= count || next === index) return;\n onIndexChange(next);\n };\n\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n // A key meant for a control stays with it: Space/Enter on a button, typing in any\n // field a caller's caption might hold.\n const target = e.target as HTMLElement;\n if (target.closest(\"input, textarea, select, [contenteditable='true']\")) return;\n const step = horizontalStep(e.key, e.currentTarget);\n if (step !== 0) {\n e.preventDefault();\n go(step);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n if (index !== 0) onIndexChange(0);\n } else if (e.key === \"End\") {\n e.preventDefault();\n if (index !== count - 1) onIndexChange(count - 1);\n }\n };\n\n const touchStart = useRef<{ x: number; y: number } | null>(null);\n const onTouchStart = (e: TouchEvent) => {\n const t = e.touches[0];\n touchStart.current = e.touches.length === 1 && t ? { x: t.clientX, y: t.clientY } : null;\n };\n const onTouchEnd = (e: TouchEvent) => {\n const start = touchStart.current;\n touchStart.current = null;\n const t = e.changedTouches[0];\n // Zoomed, a drag is a PAN of the picture, not a page turn.\n if (!start || !t || zoomed) return;\n const dx = t.clientX - start.x;\n const dy = t.clientY - start.y;\n if (Math.abs(dx) < SWIPE_MIN_PX || Math.abs(dx) < Math.abs(dy)) return;\n // Swiping toward the START edge brings in the next picture from the end edge.\n const towardStart = dir === \"rtl\" ? dx > 0 : dx < 0;\n go(towardStart ? 1 : -1);\n };\n\n // Paging the viewer while zoomed would leave the new picture scrolled to where the\n // last one was panned; start each at its top-left.\n const bodyRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n bodyRef.current?.scrollTo?.({ top: 0, left: 0 });\n }, [index]);\n\n const downloadHref = fetched.src;\n const downloadControl =\n download && item ? (\n onDownload ? (\n <IconButton\n size=\"sm\"\n label={labels.download}\n labelVisible={toolbarLabelVisible}\n onClick={() => onDownload(item, index)}\n >\n <Download />\n </IconButton>\n ) : downloadHref ? (\n <a\n href={downloadHref}\n // `download` names the saved file; a blob: URL has no name of its own.\n download={item.fileName ?? \"\"}\n className={buttonClasses(\"ghost\", { size: \"sm\" })}\n >\n <Download aria-hidden className=\"size-4\" />\n <span className=\"max-sm:sr-only\">{labels.download}</span>\n </a>\n ) : null\n ) : null;\n\n const header = item ? (\n <div className=\"flex min-w-0 items-center gap-2\">\n <span aria-hidden className=\"shrink-0 text-sm tabular-nums text-secondary\">\n {labels.counter(index + 1, count)}\n </span>\n {/* The page turn, said — focus does not move when the picture changes, so\n without this a reader pressing → hears nothing at all. */}\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {`${labels.position(index + 1, count)}${item.alt ? `: ${item.alt}` : \"\"}`}\n </span>\n <span className=\"min-w-0 flex-1\" />\n {zoomEnabled && kind === \"image\" && (\n <IconButton\n size=\"sm\"\n label={labels.zoom}\n labelVisible={toolbarLabelVisible}\n pressed={zoomed}\n onClick={toggleZoom}\n >\n <ZoomIn />\n </IconButton>\n )}\n {downloadControl}\n </div>\n ) : null;\n\n const slide = !item ? null : kind === \"file\" ? (\n <div className=\"flex max-w-sm flex-col items-center gap-3 rounded-lg border border-subtle p-6 text-center\">\n <FileText aria-hidden className=\"size-10 text-muted\" />\n <p className=\"break-all font-medium text-primary\">{item.fileName ?? item.alt}</p>\n <p className=\"text-sm text-muted\">{labels.noPreview}</p>\n {fetched.src && (\n <a\n href={fetched.src}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n className={buttonClasses(\"secondary\", { size: \"sm\" })}\n >\n <ExternalLink aria-hidden className=\"size-4\" />\n {labels.openInNewTab}\n </a>\n )}\n </div>\n ) : (\n <ImageStates\n // Keyed by item: a new picture is a new decode, never the old one's \"loaded\".\n key={itemKey ?? undefined}\n fetched={fetched}\n alt={item.alt}\n labels={imageLabels}\n wrapperClassName={zoomed ? \"max-w-none shrink-0\" : \"flex h-full w-full items-center justify-center\"}\n className={cn(\n zoomed ? \"max-w-none cursor-zoom-out\" : \"max-h-full max-w-full object-contain\",\n !zoomed && zoomEnabled && \"cursor-zoom-in\",\n )}\n imgProps={{\n draggable: false,\n onDoubleClick: zoomEnabled ? toggleZoom : undefined,\n }}\n />\n );\n\n return (\n <>\n <span ref={anchorRef} hidden />\n <FullBleedDialog\n open={open && !!item}\n onClose={onClose}\n closeLabel={labels.close}\n aria-label={labels.dialog}\n dir={dir}\n header={header}\n backCloses={backCloses}\n onKeyDown={onKeyDown}\n data-lightbox=\"\"\n footer={\n // `hasContent` (refactor audit 2026-10-30, DUP-14): a `\"\"` caption drew an empty\n // footer bar.\n hasContent(item?.caption) ? (\n <p className=\"me-auto min-w-0 text-sm text-secondary\">{item?.caption}</p>\n ) : undefined\n }\n >\n <div\n ref={bodyRef}\n data-lightbox-stage=\"\"\n data-zoomed={zoomed ? \"\" : undefined}\n onTouchStart={onTouchStart}\n onTouchEnd={onTouchEnd}\n className={cn(\n \"relative h-full min-h-48 w-full\",\n zoomed ? \"overflow-auto\" : \"flex items-center justify-center overflow-hidden\",\n )}\n >\n {slide}\n </div>\n {count > 1 && (\n // At an end the arrow refuses rather than turns `disabled` (refactor audit\n // 2026-10-30, INP-4, JumpCalendar's rule): the press that reaches the last\n // picture is made with the focus on ›, and a focused button that turns\n // `disabled` drops the focus out of the viewer's trap to <body>. kastlan's\n // ImageGrid and keksdose's invoice review open it without `loop`.\n <>\n <IconButton\n variant=\"overlay\"\n size=\"lg\"\n label={labels.previous}\n aria-disabled={!canPrev || undefined}\n onClick={() => go(-1)}\n className={cn(\"absolute start-3 top-1/2 -translate-y-1/2\", ARROW_AT_END)}\n tooltip={false}\n >\n <ChevronLeft className=\"rtl:-scale-x-100\" />\n </IconButton>\n <IconButton\n variant=\"overlay\"\n size=\"lg\"\n label={labels.next}\n aria-disabled={!canNext || undefined}\n onClick={() => go(1)}\n className={cn(\"absolute end-3 top-1/2 -translate-y-1/2\", ARROW_AT_END)}\n tooltip={false}\n >\n <ChevronRight className=\"rtl:-scale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A,gBAET,8BAAC,gBAAa,WAAU,oBAAmB;AAAA;AAAA,YAC7C;AAAA,aACF;AAAA;AAAA;AAAA,IAEJ;AAAA,KACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/lightbox.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { KeyboardEvent, ReactNode, TouchEvent } from \"react\";\nimport { ChevronLeft, ChevronRight, Download, ExternalLink, FileText, ZoomIn } from \"lucide-react\";\n\nimport { cn } from \"../lib/cn\";\nimport { horizontalStep } from \"../lib/direction\";\nimport { isEditableContent } from \"../lib/editable-content\";\nimport { hasContent } from \"../lib/presence\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { useAuthedSrc } from \"../hooks/use-authed-src\";\nimport { useBreakpoint } from \"../hooks/use-breakpoint\";\nimport type { AuthedFetcher } from \"../hooks/use-authed-src\";\nimport { FullBleedDialog } from \"./full-bleed-dialog\";\nimport { IconButton } from \"./icon-button\";\nimport { buttonClasses } from \"./button-look\";\nimport { ImageStates, DEFAULT_AUTHED_IMAGE_LABELS } from \"./authed-image\";\nimport { useAnchorDir } from \"./use-anchor-dir\";\nimport { DEFAULT_LIGHTBOX_LABELS } from \"./lightbox-labels\";\n\n/* ── The item both the grid and the lightbox show ────────────────────────── */\n\n/** `image`: shown as a picture. `file`: anything a browser cannot put in an `<img>` —\n * a floor plan uploaded as a PDF — shown as a file card with open and download. */\nexport type ImageItemKind = \"image\" | \"file\";\n\nexport interface ImageItem {\n /** React key. Defaults to `src`. */\n key?: string | number;\n /** The full-size file — what the lightbox shows and downloads. An API path when the\n * component is given a `fetcher`. */\n src: string;\n /** A smaller rendition for the grid, when the server has one. Default: `src`. */\n thumbnailSrc?: string;\n /** Required: the picture's text alternative, and the open button's name. */\n alt: string;\n /** Shown under the thumbnail and at the foot of the lightbox. */\n caption?: ReactNode;\n /** The file's MIME type, when known (`\"application/pdf\"`). Decides {@link kind}. */\n mimeType?: string;\n /** Say it outright. Default: from {@link mimeType}, else from the file extension in\n * `src`, else — for a fetched file — from the type the server sent back. */\n kind?: ImageItemKind;\n /** The name a download is saved under, and a file card's heading. */\n fileName?: string;\n}\n\nconst FILE_EXTENSION = /\\.(pdf|docx?|xlsx?|pptx?|odt|ods|zip|txt|csv|rtf)(?:[?#]|$)/i;\n\n/** What an item is, from what is known about it WITHOUT fetching it — see\n * {@link ImageItem.kind}. `fetchedType` is the blob's type once it is in. */\nexport function imageItemKind(item: ImageItem, fetchedType?: string): ImageItemKind {\n if (item.kind) return item.kind;\n if (item.mimeType) return item.mimeType.startsWith(\"image/\") ? \"image\" : \"file\";\n if (FILE_EXTENSION.test(item.src)) return \"file\";\n if (fetchedType && !fetchedType.startsWith(\"image/\")) return \"file\";\n return \"image\";\n}\n\n/* ── Labels ──────────────────────────────────────────────────────────────── */\n\nexport interface LightboxLabels {\n /** The dialog's accessible name. */\n dialog: string;\n close: string;\n previous: string;\n next: string;\n /** The visible counter: \"3 / 7\". */\n counter: (index: number, count: number) => string;\n /** What a screen reader hears on each page turn: \"Image 3 of 7\". The alt follows. */\n position: (index: number, count: number) => string;\n download: string;\n /** The zoom toggle (a pressed/not-pressed button — its name does not change). */\n zoom: string;\n /** A file card's note: the file has no picture to show. */\n noPreview: string;\n /** A file card's link to the browser's own viewer (a PDF opens in its viewer). */\n openInNewTab: string;\n}\n\n// Defined in ./lightbox-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_LIGHTBOX_LABELS };\n\n/* ── The component ───────────────────────────────────────────────────────── */\n\nexport interface LightboxProps {\n open: boolean;\n /** The X, Escape and the Back gesture all call this. */\n onClose: () => void;\n items: readonly ImageItem[];\n /** The item on screen (0-based). Controlled, so the grid — or a URL — can own it. */\n index: number;\n onIndexChange: (index: number) => void;\n /** The app's authenticated GET (see {@link useAuthedSrc}); left out, `src` is\n * loaded by the browser as usual. */\n fetcher?: AuthedFetcher | null;\n /** Previous from the first goes to the last, and next from the last to the first.\n * Default `false`: the buttons at the ends refuse (`aria-disabled`, focus kept — 0.52),\n * which says where the set ends. */\n loop?: boolean;\n /** Double-click (or double-tap) the picture, or the zoom button, to see it at full\n * size and pan by scrolling. Default `true`. Pinch zoom is the browser's own. */\n zoom?: boolean;\n /** A download link in the header. Default `true`. */\n download?: boolean;\n /**\n * Download through the app instead — kastlan's floor plans have `openDocument(id)`,\n * which knows the stored file name. Replaces the link with a button that calls this.\n */\n onDownload?: (item: ImageItem, index: number) => void;\n /** Push a history entry so Back closes the viewer. Default `true`; see\n * `FullBleedDialog`'s `backCloses` for when to turn it off. */\n backCloses?: boolean;\n labels?: LabelOverride<LightboxLabels>;\n}\n\n/** Swipes shorter than this are taps, and a drag that is mostly vertical is a scroll. */\nconst SWIPE_MIN_PX = 50;\n\n/** An end arrow's look: a disabled `overlay` IconButton's (its 50% and its resting disc\n * under hover), for the focusable kind — `disabled:` cannot match `aria-disabled`. */\nconst ARROW_AT_END =\n \"aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:hover:bg-[color-mix(in_srgb,var(--bg-inverse)_60%,transparent)]\";\n\n/**\n * A full-screen viewer for a set of images (and files that are not images).\n *\n * Built on {@link FullBleedDialog} rather than beside it, so the viewer has the kit's\n * one implementation of everything an overlay owes the page: the focus trap, Escape,\n * the Back gesture closing it instead of leaving the page (`useOverlayHistory`), the\n * body-scroll lock and the enter/exit motion.\n *\n * Paging: the previous/next buttons, ←/→ (which swap in a right-to-left page — the\n * direction is read at the point the viewer is rendered, since the dialog itself is\n * portalled out of it), Home/End, and a horizontal swipe on a touch screen.\n *\n * Zoom is a TOGGLE, not a gesture: double-click (or the zoom button) shows the picture\n * at its natural size and the body scrolls to pan. Pinch-to-zoom is not implemented —\n * the browser's own page pinch still works — because a pinch handler would have to own\n * every touch on the picture, and with it the swipe.\n *\n * A non-image (a PDF floor plan) is shown as a file card: its name, \"no preview\", a\n * link that opens it in the browser's own viewer, and the download. An `<iframe>`\n * preview was the alternative; phone browsers render a PDF in one inconsistently or\n * not at all, and a card works everywhere.\n */\nexport function Lightbox({\n open,\n onClose,\n items,\n index: indexProp,\n onIndexChange,\n fetcher,\n loop = false,\n zoom: zoomEnabled = true,\n download = true,\n onDownload,\n backCloses,\n labels: labelsProp,\n}: LightboxProps) {\n const labels = useKitLabels(\"lightbox\", DEFAULT_LIGHTBOX_LABELS, labelsProp);\n const imageLabels = useKitLabels(\"authedImage\", DEFAULT_AUTHED_IMAGE_LABELS);\n const count = items.length;\n // Clamped: the set can shrink under an open viewer (the photo on screen was deleted).\n const index = count === 0 ? 0 : Math.min(Math.max(indexProp, 0), count - 1);\n const item = items[index] as ImageItem | undefined;\n\n // The dialog is portalled to <body>, out of the subtree whose `dir` it would have\n // inherited; this marker stays where the viewer was rendered and reads it there.\n const anchorRef = useRef<HTMLSpanElement>(null);\n const dir = useAnchorDir(anchorRef, open);\n\n // The toolbar's words (docs/text-size-harmonization.md §4, §10.8). At Large an\n // IconButton shows its label beside the glyph; on a narrow screen the viewer's header —\n // the counter, Zoom, Download and the dialog's close — has no room for two words at\n // 150 % (a 390 px phone is 260 px of Normal type), so below `sm` the toolbar keeps its\n // icons, as the plain download link hides its word there (`max-sm:sr-only`). From `sm`\n // up, at the same breakpoint the CSS uses, the words show. Each name stays the\n // accessible name and the tooltip either way.\n const narrow = useBreakpoint(\"max-sm\");\n const toolbarLabelVisible = narrow ? false : undefined;\n\n const fetched = useAuthedSrc(item?.src, { fetcher, enabled: open });\n const kind = item ? imageItemKind(item, fetched.type) : \"image\";\n\n const [zoomedKey, setZoomedKey] = useState<string | null>(null);\n const itemKey = item ? String(item.key ?? item.src) : null;\n // Zoom belongs to the picture it was turned on for: paging on resets it.\n const zoomed = zoomEnabled && kind === \"image\" && zoomedKey !== null && zoomedKey === itemKey;\n const toggleZoom = () => setZoomedKey(zoomed ? null : itemKey);\n\n const canPrev = loop ? count > 1 : index > 0;\n const canNext = loop ? count > 1 : index < count - 1;\n const go = (step: number) => {\n if (count === 0) return;\n let next = index + step;\n if (loop) next = (next + count) % count;\n if (next < 0 || next >= count || next === index) return;\n onIndexChange(next);\n };\n\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n // A key meant for a control stays with it: Space/Enter on a button, typing in any\n // field a caller's caption might hold. Editable content by the kit's one rule\n // (lib/editable-content; 0.52 code review 2026-10-31, held to 0.55): the selector it\n // replaced matched `[contenteditable='true']` alone, so in an editor written\n // `contenteditable=\"\"` or `\"plaintext-only\"` the arrows, Home and End paged the viewer\n // instead of moving the caret.\n const target = e.target as Element;\n if (target.closest(\"input, textarea, select\") || isEditableContent(target)) return;\n const step = horizontalStep(e.key, e.currentTarget);\n if (step !== 0) {\n e.preventDefault();\n go(step);\n } else if (e.key === \"Home\") {\n e.preventDefault();\n if (index !== 0) onIndexChange(0);\n } else if (e.key === \"End\") {\n e.preventDefault();\n if (index !== count - 1) onIndexChange(count - 1);\n }\n };\n\n const touchStart = useRef<{ x: number; y: number } | null>(null);\n const onTouchStart = (e: TouchEvent) => {\n const t = e.touches[0];\n touchStart.current = e.touches.length === 1 && t ? { x: t.clientX, y: t.clientY } : null;\n };\n const onTouchEnd = (e: TouchEvent) => {\n const start = touchStart.current;\n touchStart.current = null;\n const t = e.changedTouches[0];\n // Zoomed, a drag is a PAN of the picture, not a page turn.\n if (!start || !t || zoomed) return;\n const dx = t.clientX - start.x;\n const dy = t.clientY - start.y;\n if (Math.abs(dx) < SWIPE_MIN_PX || Math.abs(dx) < Math.abs(dy)) return;\n // Swiping toward the START edge brings in the next picture from the end edge.\n const towardStart = dir === \"rtl\" ? dx > 0 : dx < 0;\n go(towardStart ? 1 : -1);\n };\n\n // Paging the viewer while zoomed would leave the new picture scrolled to where the\n // last one was panned; start each at its top-left.\n const bodyRef = useRef<HTMLDivElement>(null);\n useEffect(() => {\n bodyRef.current?.scrollTo?.({ top: 0, left: 0 });\n }, [index]);\n\n const downloadHref = fetched.src;\n const downloadControl =\n download && item ? (\n onDownload ? (\n <IconButton\n size=\"sm\"\n label={labels.download}\n labelVisible={toolbarLabelVisible}\n onClick={() => onDownload(item, index)}\n >\n <Download />\n </IconButton>\n ) : downloadHref ? (\n <a\n href={downloadHref}\n // `download` names the saved file; a blob: URL has no name of its own.\n download={item.fileName ?? \"\"}\n className={buttonClasses(\"ghost\", { size: \"sm\" })}\n >\n <Download aria-hidden className=\"size-4\" />\n <span className=\"max-sm:sr-only\">{labels.download}</span>\n </a>\n ) : null\n ) : null;\n\n const header = item ? (\n <div className=\"flex min-w-0 items-center gap-2\">\n <span aria-hidden className=\"shrink-0 text-sm tabular-nums text-secondary\">\n {labels.counter(index + 1, count)}\n </span>\n {/* The page turn, said — focus does not move when the picture changes, so\n without this a reader pressing → hears nothing at all. */}\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {`${labels.position(index + 1, count)}${item.alt ? `: ${item.alt}` : \"\"}`}\n </span>\n <span className=\"min-w-0 flex-1\" />\n {zoomEnabled && kind === \"image\" && (\n <IconButton\n size=\"sm\"\n label={labels.zoom}\n labelVisible={toolbarLabelVisible}\n pressed={zoomed}\n onClick={toggleZoom}\n >\n <ZoomIn />\n </IconButton>\n )}\n {downloadControl}\n </div>\n ) : null;\n\n const slide = !item ? null : kind === \"file\" ? (\n <div className=\"flex max-w-sm flex-col items-center gap-3 rounded-lg border border-subtle p-6 text-center\">\n <FileText aria-hidden className=\"size-10 text-muted\" />\n <p className=\"break-all font-medium text-primary\">{item.fileName ?? item.alt}</p>\n <p className=\"text-sm text-muted\">{labels.noPreview}</p>\n {fetched.src && (\n <a\n href={fetched.src}\n target=\"_blank\"\n rel=\"noreferrer noopener\"\n className={buttonClasses(\"secondary\", { size: \"sm\" })}\n >\n <ExternalLink aria-hidden className=\"size-4\" />\n {labels.openInNewTab}\n </a>\n )}\n </div>\n ) : (\n <ImageStates\n // Keyed by item: a new picture is a new decode, never the old one's \"loaded\".\n key={itemKey ?? undefined}\n fetched={fetched}\n alt={item.alt}\n labels={imageLabels}\n wrapperClassName={zoomed ? \"max-w-none shrink-0\" : \"flex h-full w-full items-center justify-center\"}\n className={cn(\n zoomed ? \"max-w-none cursor-zoom-out\" : \"max-h-full max-w-full object-contain\",\n !zoomed && zoomEnabled && \"cursor-zoom-in\",\n )}\n imgProps={{\n draggable: false,\n onDoubleClick: zoomEnabled ? toggleZoom : undefined,\n }}\n />\n );\n\n return (\n <>\n <span ref={anchorRef} hidden />\n <FullBleedDialog\n open={open && !!item}\n onClose={onClose}\n closeLabel={labels.close}\n aria-label={labels.dialog}\n dir={dir}\n header={header}\n backCloses={backCloses}\n onKeyDown={onKeyDown}\n data-lightbox=\"\"\n footer={\n // `hasContent` (refactor audit 2026-10-30, DUP-14): a `\"\"` caption drew an empty\n // footer bar.\n hasContent(item?.caption) ? (\n <p className=\"me-auto min-w-0 text-sm text-secondary\">{item?.caption}</p>\n ) : undefined\n }\n >\n <div\n ref={bodyRef}\n data-lightbox-stage=\"\"\n data-zoomed={zoomed ? \"\" : undefined}\n onTouchStart={onTouchStart}\n onTouchEnd={onTouchEnd}\n className={cn(\n \"relative h-full min-h-48 w-full\",\n zoomed ? \"overflow-auto\" : \"flex items-center justify-center overflow-hidden\",\n )}\n >\n {slide}\n </div>\n {count > 1 && (\n // At an end the arrow refuses rather than turns `disabled` (refactor audit\n // 2026-10-30, INP-4, JumpCalendar's rule): the press that reaches the last\n // picture is made with the focus on ›, and a focused button that turns\n // `disabled` drops the focus out of the viewer's trap to <body>. kastlan's\n // ImageGrid and keksdose's invoice review open it without `loop`.\n <>\n <IconButton\n variant=\"overlay\"\n size=\"lg\"\n label={labels.previous}\n aria-disabled={!canPrev || undefined}\n onClick={() => go(-1)}\n className={cn(\"absolute start-3 top-1/2 -translate-y-1/2\", ARROW_AT_END)}\n tooltip={false}\n >\n <ChevronLeft className=\"rtl:-scale-x-100\" />\n </IconButton>\n <IconButton\n variant=\"overlay\"\n size=\"lg\"\n label={labels.next}\n aria-disabled={!canNext || undefined}\n onClick={() => go(1)}\n className={cn(\"absolute end-3 top-1/2 -transl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AW;AAAA,gBAC3B,SAAS,MAAM,GAAG,CAAC;AAAA,gBACnB,WAAW,GAAG,2CAA2C,YAAY;AAAA,gBACrE,SAAS;AAAA,gBAET,8BAAC,gBAAa,WAAU,oBAAmB;AAAA;AAAA,YAC7C;AAAA,aACF;AAAA;AAAA;AAAA,IAEJ;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -8,7 +8,15 @@ import { upperFirst } from "../lib/text-case.js";
|
|
|
8
8
|
import { FOCUS_RING, FOCUS_RING_WIDTH } from "./focus-ring.js";
|
|
9
9
|
import { horizontalStep } from "../lib/direction.js";
|
|
10
10
|
import { useAnnounce } from "../hooks/use-announce.js";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
addMonthsClamped,
|
|
13
|
+
currentDate,
|
|
14
|
+
localeWeekStart,
|
|
15
|
+
monthKey,
|
|
16
|
+
parseIsoDate,
|
|
17
|
+
sameYmd,
|
|
18
|
+
toLocalIso
|
|
19
|
+
} from "../lib/dates.js";
|
|
12
20
|
import { dateFormatter } from "../lib/intl-cache.js";
|
|
13
21
|
import { useKitLabels, useKitLocale, useKitWeekStart } from "../i18n/kit-labels.js";
|
|
14
22
|
import { DEFAULT_MINI_CALENDAR_LABELS } from "./mini-calendar-labels.js";
|
|
@@ -66,7 +74,7 @@ function MiniCalendar({
|
|
|
66
74
|
const hintId = `${id}-hint`;
|
|
67
75
|
const { announce, regionProps } = useAnnounce();
|
|
68
76
|
const [activeIso, setActiveIso] = useState(() => {
|
|
69
|
-
let start = fromDate ?? toDate ??
|
|
77
|
+
let start = fromDate ?? toDate ?? currentDate();
|
|
70
78
|
const first = monthStart(month);
|
|
71
79
|
if (first && monthKey(start) !== month) start = first;
|
|
72
80
|
if (minDate && start < minDate) return toLocalIso(minDate);
|
|
@@ -84,12 +92,12 @@ function MiniCalendar({
|
|
|
84
92
|
if (lastMonth !== month) {
|
|
85
93
|
setLastMonth(month);
|
|
86
94
|
const first = monthStart(month);
|
|
87
|
-
const current = parseIsoDate(activeIso) ??
|
|
95
|
+
const current = parseIsoDate(activeIso) ?? currentDate();
|
|
88
96
|
if (first && monthKey(current) !== month) {
|
|
89
97
|
setActiveIso(toLocalIso(sameDayIn(first, current)));
|
|
90
98
|
}
|
|
91
99
|
}
|
|
92
|
-
const activeDate = parseIsoDate(activeIso) ??
|
|
100
|
+
const activeDate = parseIsoDate(activeIso) ?? currentDate();
|
|
93
101
|
const view = { year: activeDate.getFullYear(), month: activeDate.getMonth() };
|
|
94
102
|
const firstOfMonth = new Date(view.year, view.month, 1);
|
|
95
103
|
const lastOfMonth = new Date(view.year, view.month + 1, 0);
|
|
@@ -196,7 +204,7 @@ function MiniCalendar({
|
|
|
196
204
|
announce(labels.rangeSelected(formatDay(f), formatDay(d)));
|
|
197
205
|
}
|
|
198
206
|
};
|
|
199
|
-
const today =
|
|
207
|
+
const today = currentDate();
|
|
200
208
|
const hasBand = Boolean(fromDate && toDate && !sameYmd(fromDate, toDate));
|
|
201
209
|
const daysInMonth = (d) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();
|
|
202
210
|
const inRange = (d) => {
|