@eifi1/ui-kit 0.31.1 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -28
- package/dist/account/delete-account-setting.d.ts +8 -3
- package/dist/admin/admin-action-confirm.d.ts +8 -3
- package/dist/admin/admin-action-log.d.ts +1 -1
- package/dist/admin/admin-action-log.js +4 -2
- package/dist/admin/admin-action-log.js.map +1 -1
- package/dist/admin/invitations-panel.d.ts +8 -3
- package/dist/admin/invitations-panel.js +29 -26
- package/dist/admin/invitations-panel.js.map +1 -1
- package/dist/admin/reviewer-scope-editor.d.ts +8 -3
- package/dist/admin/role-select.d.ts +10 -5
- package/dist/admin/transfer-ownership-dialog.d.ts +8 -3
- package/dist/admin/user-roster.d.ts +10 -5
- package/dist/admin/user-roster.js +8 -47
- package/dist/admin/user-roster.js.map +1 -1
- package/dist/auth/auth-errors.d.ts +43 -8
- package/dist/auth/auth-errors.js +24 -1
- package/dist/auth/auth-errors.js.map +1 -1
- package/dist/auth/register-form.d.ts +8 -3
- package/dist/billing/billing-banner.d.ts +184 -0
- package/dist/billing/billing-banner.js +98 -0
- package/dist/billing/billing-banner.js.map +1 -0
- package/dist/billing/billing-labels.d.ts +100 -0
- package/dist/billing/billing-labels.js +76 -0
- package/dist/billing/billing-labels.js.map +1 -0
- package/dist/billing/billing-lock.d.ts +158 -0
- package/dist/billing/billing-lock.js +17 -0
- package/dist/billing/billing-lock.js.map +1 -0
- package/dist/billing/billing-standing.d.ts +149 -0
- package/dist/billing/billing-standing.js +28 -0
- package/dist/billing/billing-standing.js.map +1 -0
- package/dist/billing/plan-card.d.ts +248 -0
- package/dist/billing/plan-card.js +248 -0
- package/dist/billing/plan-card.js.map +1 -0
- package/dist/billing/plan-limit-notice.d.ts +156 -0
- package/dist/billing/plan-limit-notice.js +76 -0
- package/dist/billing/plan-limit-notice.js.map +1 -0
- package/dist/billing/plan-limit.d.ts +34 -0
- package/dist/billing/plan-limit.js +20 -0
- package/dist/billing/plan-limit.js.map +1 -0
- package/dist/billing/plan-price.d.ts +61 -0
- package/dist/billing/plan-price.js +45 -0
- package/dist/billing/plan-price.js.map +1 -0
- package/dist/billing/subscription-actions.d.ts +133 -0
- package/dist/billing/subscription-actions.js +28 -0
- package/dist/billing/subscription-actions.js.map +1 -0
- package/dist/billing/subscription-status-chip.d.ts +149 -0
- package/dist/billing/subscription-status-chip.js +48 -0
- package/dist/billing/subscription-status-chip.js.map +1 -0
- package/dist/chart.d.ts +9 -3
- package/dist/chart.js.map +1 -1
- package/dist/components/account-chips.d.ts +16 -4
- package/dist/components/account-chips.js +21 -3
- package/dist/components/account-chips.js.map +1 -1
- package/dist/components/alert-banner.d.ts +6 -1
- package/dist/components/alert-banner.js +5 -4
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.d.ts +8 -3
- package/dist/components/amount-input.js +5 -5
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/appearance-labels.d.ts +38 -0
- package/dist/components/appearance-labels.js +19 -0
- package/dist/components/appearance-labels.js.map +1 -0
- package/dist/components/autocomplete.js +2 -2
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/breadcrumbs.js +3 -2
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/bulk-action-bar.d.ts +2 -2
- package/dist/components/bulk-action-bar.js +7 -12
- package/dist/components/bulk-action-bar.js.map +1 -1
- package/dist/components/button-group.d.ts +8 -3
- package/dist/components/button-group.js +7 -1
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/calculator.d.ts +8 -3
- package/dist/components/calculator.js +4 -3
- package/dist/components/calculator.js.map +1 -1
- package/dist/components/calendar-heatmap.js +5 -5
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/chart-height.d.ts +23 -0
- package/dist/components/chart-height.js +15 -0
- package/dist/components/chart-height.js.map +1 -0
- package/dist/components/chart-zoom.js +6 -1
- package/dist/components/chart-zoom.js.map +1 -1
- package/dist/components/checkbox-group.js +2 -2
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/checkbox.d.ts +10 -0
- package/dist/components/checkbox.js +25 -10
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/chip.d.ts +19 -3
- package/dist/components/chip.js +54 -23
- package/dist/components/chip.js.map +1 -1
- package/dist/components/choice-card.d.ts +1 -1
- package/dist/components/choice-card.js +9 -8
- package/dist/components/choice-card.js.map +1 -1
- package/dist/components/column-mapper.js +1 -1
- package/dist/components/column-mapper.js.map +1 -1
- package/dist/components/combobox-core.js +8 -7
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.js +8 -8
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +8 -3
- package/dist/components/copy-button.d.ts +10 -5
- package/dist/components/country-select.js +1 -1
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/currency-select.js +3 -3
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm.d.ts +8 -3
- package/dist/components/data-table-cells.d.ts +1 -1
- package/dist/components/data-table-filter-popover.d.ts +1 -1
- package/dist/components/data-table-filter-popover.js +4 -1
- package/dist/components/data-table-filter-popover.js.map +1 -1
- package/dist/components/data-table-filters.d.ts +1 -1
- package/dist/components/data-table-labels.d.ts +1 -1
- package/dist/components/data-table-pagination.d.ts +3 -2
- package/dist/components/data-table-pagination.js +15 -6
- package/dist/components/data-table-pagination.js.map +1 -1
- package/dist/components/data-table.d.ts +1 -1
- package/dist/components/data-table.js +123 -52
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +1 -1
- package/dist/components/date-picker.js +18 -6
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/description-list.js +2 -2
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog-frame.js +2 -1
- package/dist/components/dialog-frame.js.map +1 -1
- package/dist/components/disclosure.js +3 -2
- package/dist/components/disclosure.js.map +1 -1
- package/dist/components/dropdown.d.ts +1 -1
- package/dist/components/dropdown.js +7 -1
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/facing-pair.d.ts +19 -6
- package/dist/components/facing-pair.js +3 -2
- package/dist/components/facing-pair.js.map +1 -1
- package/dist/components/field-parts.d.ts +102 -6
- package/dist/components/field-parts.js +81 -6
- package/dist/components/field-parts.js.map +1 -1
- package/dist/components/field-sync.d.ts +4 -1
- package/dist/components/field-sync.js +12 -2
- package/dist/components/field-sync.js.map +1 -1
- package/dist/components/field.js +2 -2
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-button.d.ts +8 -3
- package/dist/components/file-dropzone.d.ts +8 -3
- package/dist/components/floating-panel.js +7 -4
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/focus-ring.d.ts +12 -0
- package/dist/components/focus-ring.js +8 -0
- package/dist/components/focus-ring.js.map +1 -0
- package/dist/components/form-actions.d.ts +8 -3
- package/dist/components/form-actions.js +33 -19
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/full-bleed-dialog.d.ts +11 -1
- package/dist/components/full-bleed-dialog.js +3 -1
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/iban-input.d.ts +8 -3
- package/dist/components/image-grid.js +1 -1
- package/dist/components/image-grid.js.map +1 -1
- package/dist/components/inline-edit-field.js +10 -4
- package/dist/components/inline-edit-field.js.map +1 -1
- package/dist/components/language-select.d.ts +8 -3
- package/dist/components/legal-page.d.ts +26 -5
- package/dist/components/legal-page.js +3 -1
- package/dist/components/legal-page.js.map +1 -1
- package/dist/components/legal.d.ts +8 -3
- package/dist/components/legal.js +2 -1
- package/dist/components/legal.js.map +1 -1
- package/dist/components/lightbox.js +24 -2
- package/dist/components/lightbox.js.map +1 -1
- package/dist/components/line-items.js +2 -1
- package/dist/components/line-items.js.map +1 -1
- package/dist/components/list.d.ts +5 -0
- package/dist/components/list.js +13 -9
- package/dist/components/list.js.map +1 -1
- package/dist/components/measured-grid.d.ts +3 -1
- package/dist/components/measured-grid.js +38 -20
- package/dist/components/measured-grid.js.map +1 -1
- package/dist/components/menu-item.js +2 -1
- package/dist/components/menu-item.js.map +1 -1
- package/dist/components/mini-calendar.js +8 -4
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/money-field.d.ts +8 -3
- package/dist/components/month-picker.js +50 -39
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/nav-pills.js +1 -1
- package/dist/components/nav-pills.js.map +1 -1
- package/dist/components/number-field.d.ts +8 -3
- package/dist/components/number-input.d.ts +11 -4
- package/dist/components/number-input.js +8 -6
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.d.ts +8 -3
- package/dist/components/numpad-sheet.js +2 -1
- package/dist/components/numpad-sheet.js.map +1 -1
- package/dist/components/one-time-code-input.js +2 -2
- package/dist/components/one-time-code-input.js.map +1 -1
- package/dist/components/page-contents.js +2 -2
- package/dist/components/page-contents.js.map +1 -1
- package/dist/components/phone-input.d.ts +8 -3
- package/dist/components/phone-input.js +4 -4
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/pie-chart.d.ts +8 -2
- package/dist/components/pie-chart.js +11 -7
- package/dist/components/pie-chart.js.map +1 -1
- package/dist/components/popover.d.ts +9 -1
- package/dist/components/popover.js +8 -4
- package/dist/components/popover.js.map +1 -1
- package/dist/components/row-actions.d.ts +100 -0
- package/dist/components/row-actions.js +231 -0
- package/dist/components/row-actions.js.map +1 -0
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/search-field.js +3 -2
- package/dist/components/search-field.js.map +1 -1
- package/dist/components/series-chart-budget.d.ts +30 -7
- package/dist/components/series-chart-budget.js +12 -4
- package/dist/components/series-chart-budget.js.map +1 -1
- package/dist/components/series-chart-ticks.d.ts +7 -1
- package/dist/components/series-chart-ticks.js +6 -0
- package/dist/components/series-chart-ticks.js.map +1 -1
- package/dist/components/series-chart.d.ts +58 -28
- package/dist/components/series-chart.js +42 -32
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/settings-fields.d.ts +57 -8
- package/dist/components/settings-fields.js +39 -1
- package/dist/components/settings-fields.js.map +1 -1
- package/dist/components/share-card.d.ts +11 -6
- package/dist/components/share-card.js +8 -2
- package/dist/components/share-card.js.map +1 -1
- package/dist/components/sign-chip.d.ts +4 -0
- package/dist/components/sign-chip.js +17 -4
- package/dist/components/sign-chip.js.map +1 -1
- package/dist/components/signature-pad.d.ts +3 -1
- package/dist/components/signature-pad.js +8 -5
- package/dist/components/signature-pad.js.map +1 -1
- package/dist/components/slider.js +7 -6
- package/dist/components/slider.js.map +1 -1
- package/dist/components/sparkline.d.ts +5 -1
- package/dist/components/sparkline.js +4 -2
- package/dist/components/sparkline.js.map +1 -1
- package/dist/components/stat-tile.d.ts +17 -1
- package/dist/components/stat-tile.js +48 -20
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/status-dot.d.ts +4 -0
- package/dist/components/status-dot.js +9 -2
- package/dist/components/status-dot.js.map +1 -1
- package/dist/components/swipeable-row.js +10 -2
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/switch.d.ts +21 -7
- package/dist/components/switch.js +24 -11
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.js +2 -2
- package/dist/components/table.js.map +1 -1
- package/dist/components/text-link.d.ts +8 -3
- package/dist/components/text-link.js +1 -1
- package/dist/components/text-link.js.map +1 -1
- package/dist/components/text.d.ts +7 -2
- package/dist/components/text.js +5 -5
- package/dist/components/text.js.map +1 -1
- package/dist/components/tile-radio.js +2 -1
- package/dist/components/tile-radio.js.map +1 -1
- package/dist/components/time-input.d.ts +8 -3
- package/dist/components/toast.d.ts +18 -2
- package/dist/components/toast.js +8 -5
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.d.ts +25 -3
- package/dist/components/toggle-group.js +40 -11
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle-legend.d.ts +10 -1
- package/dist/components/toggle-legend.js +21 -7
- package/dist/components/toggle-legend.js.map +1 -1
- package/dist/components/translation-review-editor.js +1 -1
- package/dist/components/translation-review-editor.js.map +1 -1
- package/dist/components/translation-review-parts.d.ts +4 -0
- package/dist/components/translation-review.d.ts +4 -0
- package/dist/components/translation-review.js +3 -3
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/tree-view.js +3 -2
- package/dist/components/tree-view.js.map +1 -1
- package/dist/components/treemap.d.ts +5 -2
- package/dist/components/treemap.js +33 -16
- package/dist/components/treemap.js.map +1 -1
- package/dist/components/ui.d.ts +8 -3
- package/dist/components/ui.js +207 -119
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +1 -1
- package/dist/components/user-avatar.d.ts +5 -1
- package/dist/components/user-avatar.js +1 -1
- package/dist/components/user-avatar.js.map +1 -1
- package/dist/components/wizard-stepper.js +20 -14
- package/dist/components/wizard-stepper.js.map +1 -1
- package/dist/{data-table-labels-DUELeXpa.d.ts → data-table-labels-kpAAVi6g.d.ts} +26 -2
- package/dist/data-table.d.ts +1 -1
- package/dist/{delete-account-setting-CpIhzxxZ.d.ts → delete-account-setting-FLyJf-kZ.d.ts} +642 -60
- package/dist/demo/demo-banner.js +1 -0
- package/dist/demo/demo-banner.js.map +1 -1
- package/dist/feedback/feedback-attachment.d.ts +8 -3
- package/dist/feedback/feedback-context.d.ts +8 -3
- package/dist/feedback/feedback-crash.d.ts +8 -3
- package/dist/feedback/feedback-dialog.d.ts +8 -3
- package/dist/feedback/feedback-dialog.js +3 -3
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.d.ts +8 -3
- package/dist/feedback/feedback-inbox.js +2 -2
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback/feedback-labels.d.ts +8 -3
- package/dist/feedback/feedback-menu.d.ts +9 -4
- package/dist/feedback/feedback-record.d.ts +8 -3
- package/dist/feedback/feedback-row-detail.d.ts +8 -3
- package/dist/feedback/feedback-status-undo.d.ts +8 -3
- package/dist/feedback/feedback-submit.d.ts +8 -3
- package/dist/feedback/feedback-swipe.d.ts +8 -3
- package/dist/feedback/feedback-table.d.ts +8 -3
- package/dist/feedback/feedback-thread.d.ts +8 -3
- package/dist/feedback/feedback-thread.js +3 -3
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/feedback.d.ts +8 -3
- package/dist/hooks/use-anchored-panel.d.ts +32 -3
- package/dist/hooks/use-anchored-panel.js +21 -3
- package/dist/hooks/use-anchored-panel.js.map +1 -1
- package/dist/hooks/use-breakpoint.d.ts +88 -0
- package/dist/hooks/use-breakpoint.js +50 -0
- package/dist/hooks/use-breakpoint.js.map +1 -0
- package/dist/hooks/use-file-drop.d.ts +8 -3
- package/dist/hooks/use-large-text.d.ts +29 -0
- package/dist/hooks/use-large-text.js +20 -0
- package/dist/hooks/use-large-text.js.map +1 -0
- package/dist/hooks/use-windowed-rows.d.ts +52 -8
- package/dist/hooks/use-windowed-rows.js +94 -5
- package/dist/hooks/use-windowed-rows.js.map +1 -1
- package/dist/i18n/defaults.d.ts +8 -3
- package/dist/i18n/defaults.js +8 -0
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.d.ts +8 -3
- package/dist/i18n/german.js +94 -3
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +8 -3
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/languages.d.ts +10 -5
- package/dist/i18n/locales/de-CH.d.ts +8 -3
- package/dist/i18n/locales/en.d.ts +8 -3
- package/dist/i18n/locales/es.d.ts +8 -3
- package/dist/i18n/locales/es.js +89 -3
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +8 -3
- package/dist/i18n/locales/fr.js +91 -3
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +8 -3
- package/dist/i18n/locales/hu.js +91 -3
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +8 -3
- package/dist/i18n/locales/it.js +92 -3
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +8 -3
- package/dist/i18n/locales/zh.js +89 -3
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.d.ts +8 -3
- package/dist/i18n/review.js +15 -1
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +27 -11
- package/dist/index.js +77 -4
- package/dist/index.js.map +1 -1
- package/dist/landing/landing-actions.d.ts +8 -3
- package/dist/landing/landing-sections.d.ts +8 -3
- package/dist/landing/landing-sections.js +7 -3
- package/dist/landing/landing-sections.js.map +1 -1
- package/dist/landing/public-header.d.ts +9 -4
- package/dist/landing/public-header.js +3 -3
- package/dist/landing/public-header.js.map +1 -1
- package/dist/landing/routing.d.ts +8 -3
- package/dist/lib/cn.js +3 -2
- package/dist/lib/cn.js.map +1 -1
- package/dist/rhf/fields.d.ts +8 -3
- package/dist/rhf/fields.js +1 -1
- package/dist/rhf/fields.js.map +1 -1
- package/dist/rhf/form.d.ts +8 -3
- package/dist/rhf/form.js +2 -2
- package/dist/rhf/form.js.map +1 -1
- package/dist/rhf.d.ts +8 -3
- package/dist/search/command-palette.d.ts +1 -1
- package/dist/search/command-palette.js +9 -8
- package/dist/search/command-palette.js.map +1 -1
- package/dist/settings/settings-layout.js +2 -1
- package/dist/settings/settings-layout.js.map +1 -1
- package/dist/settings/settings-section.d.ts +8 -3
- package/dist/settings/use-account-appearance.d.ts +92 -0
- package/dist/settings/use-account-appearance.js +63 -0
- package/dist/settings/use-account-appearance.js.map +1 -0
- package/dist/settings/use-settings-route.d.ts +1 -1
- package/dist/settings/use-settings-route.js +2 -3
- package/dist/settings/use-settings-route.js.map +1 -1
- package/dist/shell/app-shell.d.ts +12 -171
- package/dist/shell/app-shell.js +144 -28
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/auth-layout.js +1 -1
- package/dist/shell/auth-layout.js.map +1 -1
- package/dist/shell/option-switcher-menu.js +1 -1
- package/dist/shell/option-switcher-menu.js.map +1 -1
- package/dist/shell/top-bar-brand.d.ts +8 -3
- package/dist/shell/top-bar-brand.js +3 -1
- package/dist/shell/top-bar-brand.js.map +1 -1
- package/dist/shell/topbar-action-menu.d.ts +4 -0
- package/dist/shell/topbar-action-menu.js +3 -3
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell/topbar-controls.js +4 -4
- package/dist/shell/topbar-controls.js.map +1 -1
- package/dist/shell.d.ts +9 -5
- package/dist/theme/contrast-tokens.d.ts +41 -0
- package/dist/theme/contrast-tokens.js +59 -0
- package/dist/theme/contrast-tokens.js.map +1 -0
- package/dist/theme/contrast.d.ts +110 -0
- package/dist/theme/contrast.js +128 -0
- package/dist/theme/contrast.js.map +1 -0
- package/dist/theme/palette-presets.d.ts +12 -1
- package/dist/theme/palette-presets.js +9 -4
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/theme/palette-store.js.map +1 -1
- package/dist/theme/text-size.d.ts +173 -0
- package/dist/theme/text-size.js +121 -0
- package/dist/theme/text-size.js.map +1 -0
- package/dist/wizard/stepper-nav.d.ts +8 -3
- package/dist/wizard/wizard-summary.js +1 -1
- package/dist/wizard/wizard-summary.js.map +1 -1
- package/dist/wizard.d.ts +8 -3
- package/package.json +1 -1
- package/src/admin/admin-action-log.tsx +6 -1
- package/src/admin/invitations-panel.tsx +36 -29
- package/src/admin/user-roster.tsx +17 -72
- package/src/auth/auth-errors.ts +68 -7
- package/src/billing/billing-banner.tsx +205 -0
- package/src/billing/billing-labels.ts +240 -0
- package/src/billing/billing-lock.ts +75 -0
- package/src/billing/billing-standing.ts +72 -0
- package/src/billing/plan-card.tsx +458 -0
- package/src/billing/plan-limit-notice.tsx +145 -0
- package/src/billing/plan-limit.ts +53 -0
- package/src/billing/plan-price.ts +101 -0
- package/src/billing/subscription-actions.tsx +76 -0
- package/src/billing/subscription-status-chip.tsx +95 -0
- package/src/chart.ts +2 -0
- package/src/components/account-chips.tsx +36 -10
- package/src/components/alert-banner.tsx +16 -7
- package/src/components/amount-input.tsx +5 -5
- package/src/components/appearance-labels.ts +47 -0
- package/src/components/autocomplete.tsx +2 -2
- package/src/components/breadcrumbs.tsx +3 -3
- package/src/components/bulk-action-bar.tsx +11 -14
- package/src/components/button-group.tsx +21 -0
- package/src/components/calculator.tsx +4 -3
- package/src/components/calendar-heatmap.tsx +5 -5
- package/src/components/chart-height.ts +30 -0
- package/src/components/chart-zoom.tsx +6 -1
- package/src/components/checkbox-group.tsx +2 -2
- package/src/components/checkbox.tsx +62 -20
- package/src/components/chip.tsx +139 -30
- package/src/components/choice-card.tsx +16 -11
- package/src/components/column-mapper.tsx +1 -1
- package/src/components/combobox-core.tsx +8 -7
- package/src/components/combobox.tsx +8 -8
- package/src/components/country-select.tsx +1 -1
- package/src/components/currency-select.tsx +3 -3
- package/src/components/data-table-filter-popover.tsx +7 -1
- package/src/components/data-table-pagination.tsx +60 -31
- package/src/components/data-table.tsx +164 -43
- package/src/components/date-picker.tsx +44 -10
- package/src/components/description-list.tsx +2 -2
- package/src/components/dialog-frame.tsx +2 -1
- package/src/components/disclosure.tsx +3 -2
- package/src/components/dropdown.tsx +10 -2
- package/src/components/facing-pair.ts +12 -5
- package/src/components/field-parts.tsx +190 -7
- package/src/components/field-sync.tsx +17 -3
- package/src/components/field.tsx +2 -2
- package/src/components/floating-panel.tsx +7 -4
- package/src/components/focus-ring.ts +12 -0
- package/src/components/form-actions.tsx +55 -18
- package/src/components/full-bleed-dialog.tsx +18 -4
- package/src/components/image-grid.tsx +1 -1
- package/src/components/inline-edit-field.tsx +26 -4
- package/src/components/legal-page.tsx +28 -2
- package/src/components/legal.tsx +19 -1
- package/src/components/lightbox.tsx +24 -2
- package/src/components/line-items.tsx +7 -1
- package/src/components/list.tsx +36 -10
- package/src/components/measured-grid.tsx +49 -24
- package/src/components/menu-item.tsx +2 -2
- package/src/components/mini-calendar.tsx +8 -4
- package/src/components/month-picker.tsx +15 -6
- package/src/components/nav-pills.tsx +1 -1
- package/src/components/number-input.tsx +14 -7
- package/src/components/numpad-sheet.tsx +2 -2
- package/src/components/one-time-code-input.tsx +2 -2
- package/src/components/page-contents.tsx +2 -2
- package/src/components/phone-input.tsx +9 -4
- package/src/components/pie-chart.tsx +19 -9
- package/src/components/popover.tsx +22 -5
- package/src/components/row-actions.tsx +450 -0
- package/src/components/scroll-area.tsx +1 -1
- package/src/components/search-field.tsx +4 -2
- package/src/components/series-chart-budget.ts +40 -8
- package/src/components/series-chart-ticks.ts +10 -0
- package/src/components/series-chart.tsx +123 -72
- package/src/components/settings-fields.tsx +89 -5
- package/src/components/share-card.tsx +31 -2
- package/src/components/sign-chip.tsx +28 -4
- package/src/components/signature-pad.tsx +13 -7
- package/src/components/slider.tsx +22 -9
- package/src/components/sparkline.tsx +11 -3
- package/src/components/stat-tile.tsx +70 -14
- package/src/components/status-dot.tsx +25 -2
- package/src/components/swipeable-row.tsx +10 -2
- package/src/components/switch.tsx +57 -23
- package/src/components/table.tsx +2 -2
- package/src/components/text-link.tsx +1 -1
- package/src/components/text.tsx +11 -6
- package/src/components/tile-radio.tsx +4 -1
- package/src/components/toast.tsx +27 -7
- package/src/components/toggle-group.tsx +115 -14
- package/src/components/toggle-legend.tsx +53 -8
- package/src/components/translation-review-editor.tsx +1 -1
- package/src/components/translation-review.tsx +11 -5
- package/src/components/tree-view.tsx +3 -2
- package/src/components/treemap.tsx +27 -10
- package/src/components/ui.tsx +353 -153
- package/src/components/user-avatar.tsx +1 -1
- package/src/components/wizard-stepper.tsx +5 -1
- package/src/demo/demo-banner.tsx +5 -0
- package/src/feedback/feedback-dialog.tsx +3 -3
- package/src/feedback/feedback-inbox.tsx +2 -2
- package/src/feedback/feedback-thread.tsx +3 -3
- package/src/hooks/use-anchored-panel.ts +67 -5
- package/src/hooks/use-breakpoint.ts +132 -0
- package/src/hooks/use-large-text.ts +41 -0
- package/src/hooks/use-windowed-rows.ts +168 -12
- package/src/i18n/defaults.ts +8 -0
- package/src/i18n/german.ts +107 -0
- package/src/i18n/kit-labels.tsx +12 -0
- package/src/i18n/locales/es.ts +98 -0
- package/src/i18n/locales/fr.ts +102 -0
- package/src/i18n/locales/hu.ts +100 -0
- package/src/i18n/locales/it.ts +103 -0
- package/src/i18n/locales/zh.ts +94 -0
- package/src/i18n/review.ts +14 -0
- package/src/index.ts +76 -6
- package/src/landing/landing-sections.tsx +7 -3
- package/src/landing/public-header.tsx +4 -4
- package/src/lib/cn.ts +13 -2
- package/src/rhf/fields.tsx +1 -1
- package/src/rhf/form.tsx +2 -2
- package/src/search/command-palette.tsx +10 -9
- package/src/settings/settings-layout.tsx +2 -1
- package/src/settings/use-account-appearance.ts +148 -0
- package/src/settings/use-settings-route.ts +3 -4
- package/src/shell/app-shell.tsx +278 -54
- package/src/shell/auth-layout.tsx +1 -1
- package/src/shell/option-switcher-menu.tsx +1 -1
- package/src/shell/top-bar-brand.tsx +3 -1
- package/src/shell/topbar-action-menu.tsx +3 -3
- package/src/shell/topbar-controls.tsx +4 -4
- package/src/theme/contrast-tokens.ts +112 -0
- package/src/theme/contrast.ts +225 -0
- package/src/theme/palette-presets.ts +24 -4
- package/src/theme/palette-store.ts +6 -1
- package/src/theme/text-size.ts +283 -0
- package/src/wizard/wizard-summary.tsx +4 -2
- package/tokens.css +158 -8
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
import { forwardRef, useId, useState } from "react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { Check, Gauge } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
import { DEFAULT_COMMON_LABELS, useKitLabels, useKitLocale } from "../i18n/kit-labels";
|
|
6
|
+
import type { LabelOverride } from "../i18n/kit-labels";
|
|
7
|
+
import { formatNumber } from "../lib/format";
|
|
8
|
+
import { cn } from "../lib/cn";
|
|
9
|
+
import { ChoiceCard } from "../components/choice-card";
|
|
10
|
+
import type { ChoiceCardProps } from "../components/choice-card";
|
|
11
|
+
import { Chip } from "../components/chip";
|
|
12
|
+
import { ToggleGroup } from "../components/toggle-group";
|
|
13
|
+
import { Button } from "../components/ui";
|
|
14
|
+
import { useBillingLabels } from "./billing-labels";
|
|
15
|
+
import type { BillingLabels } from "./billing-labels";
|
|
16
|
+
import { BILLING_INTERVALS, billingCurrencyFor, formatPlanPrice, planPrice } from "./plan-price";
|
|
17
|
+
import type { BillingCurrency, BillingInterval, PlanPrices } from "./plan-price";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* One plan of the app's catalogue (docs/billing-harmonization.md §3.1) as a page shows it:
|
|
21
|
+
* server-kit's `PlanSpec` from `GET /billing/plans`, plus the words, which are the app's
|
|
22
|
+
* (display names and feature lines come from its i18n, never from the provider).
|
|
23
|
+
*/
|
|
24
|
+
export interface BillingPlan {
|
|
25
|
+
/** The plan code, lowercase on the wire (§12.16); compared without case here. */
|
|
26
|
+
code: string;
|
|
27
|
+
/** The app's display name, in the reader's language: "Pro". */
|
|
28
|
+
name: string;
|
|
29
|
+
/** A line under the price. */
|
|
30
|
+
description?: ReactNode;
|
|
31
|
+
/** Gross prices in minor units, per currency and period (§3.1, §12.17). None at all —
|
|
32
|
+
* or 0 — is a free plan. */
|
|
33
|
+
prices?: PlanPrices | null;
|
|
34
|
+
/** Dimension → limit; `null` is unlimited (§3.1). Shown in the object's order. */
|
|
35
|
+
limits?: Readonly<Record<string, number | null>>;
|
|
36
|
+
/** The app's feature lines. */
|
|
37
|
+
features?: readonly ReactNode[];
|
|
38
|
+
/** Not choosable — a plan being retired, say. */
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* How a plan stands to the one the payer pays for now: `current` is it, `upgrade` comes
|
|
44
|
+
* after it in the catalogue's order (`PlanSpec.sort`), `downgrade` before it.
|
|
45
|
+
*/
|
|
46
|
+
export type PlanRelation = "current" | "upgrade" | "downgrade";
|
|
47
|
+
|
|
48
|
+
/** The plan's place against `current`, by the order of `plans`; `undefined` without a
|
|
49
|
+
* current plan (a trial, an ended plan) or for a code that is not in the list. */
|
|
50
|
+
export function planRelation(
|
|
51
|
+
plans: readonly Pick<BillingPlan, "code">[],
|
|
52
|
+
code: string,
|
|
53
|
+
current: string | null | undefined,
|
|
54
|
+
): PlanRelation | undefined {
|
|
55
|
+
if (!current) return undefined;
|
|
56
|
+
const index = (c: string) => plans.findIndex((p) => p.code.toLowerCase() === c.toLowerCase());
|
|
57
|
+
const at = index(code);
|
|
58
|
+
const now = index(current);
|
|
59
|
+
if (at < 0 || now < 0) return undefined;
|
|
60
|
+
return at === now ? "current" : at > now ? "upgrade" : "downgrade";
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** What both parts need to draw a plan. */
|
|
64
|
+
interface PlanDisplayProps {
|
|
65
|
+
/** The currency the prices are shown in (§2.6). */
|
|
66
|
+
currency: BillingCurrency;
|
|
67
|
+
/** The period the prices are shown for. */
|
|
68
|
+
interval: BillingInterval;
|
|
69
|
+
/** The app's name of each limit's dimension ("Budgets"). A dimension without one is
|
|
70
|
+
* shown by its key. */
|
|
71
|
+
dimensionLabels?: Readonly<Record<string, string>>;
|
|
72
|
+
/** How a limit's figure is written — kastlan's storage is bytes (`formatFileSize`).
|
|
73
|
+
* Default: a number in the kit's locale. */
|
|
74
|
+
formatLimit?: (dimension: string, value: number) => string;
|
|
75
|
+
/** Over the provider's locale. */
|
|
76
|
+
locale?: string;
|
|
77
|
+
/** Prop > `<UiKitProvider labels={{ billing }}>` > English. */
|
|
78
|
+
labels?: LabelOverride<BillingLabels>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface PlanCardProps
|
|
82
|
+
extends Omit<ChoiceCardProps, "type" | "title" | "description" | "icon" | "indeterminate" | "value" | "labels">,
|
|
83
|
+
PlanDisplayProps {
|
|
84
|
+
plan: BillingPlan;
|
|
85
|
+
/** See {@link PlanRelation}. `current` draws the "Current plan" chip — a word in the
|
|
86
|
+
* card's name, never a colour alone. */
|
|
87
|
+
relation?: PlanRelation;
|
|
88
|
+
/**
|
|
89
|
+
* The provider's own localised price in place of the catalogue's figure (§12.17) — a
|
|
90
|
+
* Merchant of Record's price preview for the buyer's country, tax included. The period
|
|
91
|
+
* and "VAT included" stay: the law asks for a gross price, and the card says so.
|
|
92
|
+
*/
|
|
93
|
+
pricePreview?: ReactNode;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** A list from spans (`role="list"`): the card is a `<label>`, which may hold phrasing
|
|
97
|
+
* content only, so a `<ul>` there would be invalid HTML. */
|
|
98
|
+
function SpanList({ name, items, icon }: { name: string; items: ReactNode[]; icon: ReactNode }) {
|
|
99
|
+
if (items.length === 0) return null;
|
|
100
|
+
return (
|
|
101
|
+
<span role="list" aria-label={name} className="block space-y-1">
|
|
102
|
+
{items.map((item, i) => (
|
|
103
|
+
<span role="listitem" key={i} className="flex items-start gap-1.5 text-[var(--text-secondary)]">
|
|
104
|
+
<span aria-hidden className="mt-[0.0625rem] flex shrink-0 text-[var(--text-muted)] [&_svg]:size-3.5">
|
|
105
|
+
{icon}
|
|
106
|
+
</span>
|
|
107
|
+
<span className="min-w-0">
|
|
108
|
+
{item}
|
|
109
|
+
{/* A space between the items' texts in the flattened description. */}{" "}
|
|
110
|
+
</span>
|
|
111
|
+
</span>
|
|
112
|
+
))}
|
|
113
|
+
</span>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* One plan as a {@link ChoiceCard} radio (§7): the name (and "Current plan"), the GROSS
|
|
119
|
+
* price in the chosen currency and period through `formatMoney` ("CHF 49 per year, VAT
|
|
120
|
+
* included", §12.17), the limits ("Budgets: 3", "Seats: Unlimited") and the app's feature
|
|
121
|
+
* lines. A plan with prices but none for this currency and period is shown, "Not offered
|
|
122
|
+
* for this billing period", and cannot be picked.
|
|
123
|
+
*
|
|
124
|
+
* A radio of a set: give the cards one `name`, or use {@link PlanPicker}, which does that
|
|
125
|
+
* and owns the choice. Everything else a `ChoiceCard` takes goes to it — `checked`,
|
|
126
|
+
* `onCheckedChange`, `name`, `className`. Carries `data-plan` and `data-relation`.
|
|
127
|
+
*/
|
|
128
|
+
export const PlanCard = forwardRef<HTMLInputElement, PlanCardProps>(function PlanCard(
|
|
129
|
+
{
|
|
130
|
+
plan,
|
|
131
|
+
relation,
|
|
132
|
+
pricePreview,
|
|
133
|
+
currency,
|
|
134
|
+
interval,
|
|
135
|
+
dimensionLabels,
|
|
136
|
+
formatLimit,
|
|
137
|
+
locale: localeProp,
|
|
138
|
+
labels: labelsProp,
|
|
139
|
+
disabled,
|
|
140
|
+
...rest
|
|
141
|
+
},
|
|
142
|
+
ref,
|
|
143
|
+
) {
|
|
144
|
+
const labels = useBillingLabels(labelsProp);
|
|
145
|
+
const common = useKitLabels("common", DEFAULT_COMMON_LABELS);
|
|
146
|
+
const locale = useKitLocale(localeProp);
|
|
147
|
+
const price = planPrice(plan.prices, currency, interval);
|
|
148
|
+
|
|
149
|
+
const priced = price.kind === "price";
|
|
150
|
+
const figure = priced
|
|
151
|
+
? pricePreview !== undefined && pricePreview !== null
|
|
152
|
+
? pricePreview
|
|
153
|
+
: formatPlanPrice(price.minor, currency, { locale })
|
|
154
|
+
: price.kind === "free"
|
|
155
|
+
? labels.free
|
|
156
|
+
: labels.notOffered;
|
|
157
|
+
|
|
158
|
+
const limitLines = Object.entries(plan.limits ?? {}).map(([dimension, value]) => {
|
|
159
|
+
const name = dimensionLabels?.[dimension] ?? dimension;
|
|
160
|
+
const shown =
|
|
161
|
+
value === null ? labels.unlimited : formatLimit ? formatLimit(dimension, value) : formatNumber(value, { locale });
|
|
162
|
+
return common.fieldValue(name, shown);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const body = (
|
|
166
|
+
<span className="mt-1 block space-y-2">
|
|
167
|
+
<span className="block">
|
|
168
|
+
<span
|
|
169
|
+
data-part="price"
|
|
170
|
+
className={cn(
|
|
171
|
+
"tabular-nums",
|
|
172
|
+
price.kind === "not-offered"
|
|
173
|
+
? "text-xs text-[var(--text-muted)]"
|
|
174
|
+
: "text-lg font-semibold leading-tight text-[var(--text-primary)]",
|
|
175
|
+
)}
|
|
176
|
+
>
|
|
177
|
+
{figure}
|
|
178
|
+
</span>
|
|
179
|
+
{priced && (
|
|
180
|
+
<>
|
|
181
|
+
{" "}
|
|
182
|
+
<span className="text-xs text-[var(--text-secondary)]">
|
|
183
|
+
{interval === "year" ? labels.perYear : labels.perMonth}
|
|
184
|
+
</span>{" "}
|
|
185
|
+
<span className="block text-xs text-[var(--text-muted)]">{labels.vatIncluded}</span>
|
|
186
|
+
</>
|
|
187
|
+
)}{" "}
|
|
188
|
+
</span>
|
|
189
|
+
{plan.description !== undefined && plan.description !== null && (
|
|
190
|
+
<span className="block text-[var(--text-secondary)]">{plan.description} </span>
|
|
191
|
+
)}
|
|
192
|
+
<SpanList name={labels.limits} items={limitLines} icon={<Gauge />} />
|
|
193
|
+
<SpanList name={labels.features} items={[...(plan.features ?? [])]} icon={<Check />} />
|
|
194
|
+
</span>
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
return (
|
|
198
|
+
<ChoiceCard
|
|
199
|
+
ref={ref}
|
|
200
|
+
{...rest}
|
|
201
|
+
type="radio"
|
|
202
|
+
value={plan.code}
|
|
203
|
+
disabled={disabled || plan.disabled || price.kind === "not-offered"}
|
|
204
|
+
data-plan={plan.code}
|
|
205
|
+
data-relation={relation}
|
|
206
|
+
title={
|
|
207
|
+
<>
|
|
208
|
+
{plan.name}
|
|
209
|
+
{relation === "current" && (
|
|
210
|
+
<>
|
|
211
|
+
{" "}
|
|
212
|
+
<Chip size="xs" tone="brand" shape="square" caps className="ms-1 align-[0.0625rem]">
|
|
213
|
+
{labels.current}
|
|
214
|
+
</Chip>
|
|
215
|
+
</>
|
|
216
|
+
)}
|
|
217
|
+
</>
|
|
218
|
+
}
|
|
219
|
+
description={body}
|
|
220
|
+
/>
|
|
221
|
+
);
|
|
222
|
+
});
|
|
223
|
+
PlanCard.displayName = "PlanCard";
|
|
224
|
+
|
|
225
|
+
/** What {@link PlanPickerProps.onChoose} is handed: everything `POST /billing/checkout`
|
|
226
|
+
* takes (§4). */
|
|
227
|
+
export interface PlanChoice {
|
|
228
|
+
plan: string;
|
|
229
|
+
interval: BillingInterval;
|
|
230
|
+
currency: BillingCurrency;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface PlanPickerProps extends Omit<PlanDisplayProps, "currency" | "interval"> {
|
|
234
|
+
/** The catalogue, in its order (`PlanSpec.sort`): cheapest first. The order decides
|
|
235
|
+
* upgrade and downgrade. */
|
|
236
|
+
plans: readonly BillingPlan[];
|
|
237
|
+
/**
|
|
238
|
+
* The plan the payer pays for now (`plan` of the overview while `active` or
|
|
239
|
+
* `past_due`). Leave it out during a trial and after a plan ended: then every plan is
|
|
240
|
+
* "Choose …", the trial's plan included, since none is paid for yet.
|
|
241
|
+
*/
|
|
242
|
+
current?: string | null;
|
|
243
|
+
/** The picked plan, controlled. `null` while none is. */
|
|
244
|
+
value?: string | null;
|
|
245
|
+
/** The picked plan, uncontrolled. Default: `current`, else nothing. */
|
|
246
|
+
defaultValue?: string | null;
|
|
247
|
+
onValueChange?: (plan: string) => void;
|
|
248
|
+
/** The period, controlled. */
|
|
249
|
+
interval?: BillingInterval;
|
|
250
|
+
/** The period, uncontrolled. Default `year` — lead with yearly (§12.17). */
|
|
251
|
+
defaultInterval?: BillingInterval;
|
|
252
|
+
onIntervalChange?: (interval: BillingInterval) => void;
|
|
253
|
+
/** The currency, controlled. */
|
|
254
|
+
currency?: BillingCurrency;
|
|
255
|
+
/** The currency, uncontrolled. Default: the account's stored currency is the app's to
|
|
256
|
+
* pass here (§12.18); without it, {@link billingCurrencyFor} the kit's locale. */
|
|
257
|
+
defaultCurrency?: BillingCurrency;
|
|
258
|
+
onCurrencyChange?: (currency: BillingCurrency) => void;
|
|
259
|
+
/** The currencies the payer may switch between. Default: every currency a plan has a
|
|
260
|
+
* price in. The switch shows only for more than one. */
|
|
261
|
+
currencies?: readonly BillingCurrency[];
|
|
262
|
+
/** The button: the app starts its checkout (`POST /billing/checkout`, then off to the
|
|
263
|
+
* provider's page). The kit sends no request. */
|
|
264
|
+
onChoose: (choice: PlanChoice) => void;
|
|
265
|
+
/** The checkout is being opened: the button's spinner, no second press. */
|
|
266
|
+
pending?: boolean;
|
|
267
|
+
/** The provider's localised price for a plan, or `undefined` for the catalogue's —
|
|
268
|
+
* see {@link PlanCardProps.pricePreview}. */
|
|
269
|
+
pricePreview?: (plan: BillingPlan, choice: Omit<PlanChoice, "plan">) => ReactNode | undefined;
|
|
270
|
+
/** A visible question over the cards. Without one the set is named "Plans". */
|
|
271
|
+
legend?: ReactNode;
|
|
272
|
+
/** Shared by the radios. Generated if omitted. */
|
|
273
|
+
name?: string;
|
|
274
|
+
/** Classes for the whole picker. */
|
|
275
|
+
className?: string;
|
|
276
|
+
/** Classes for the card grid. Default: one column, two from `sm`, three from `lg`. */
|
|
277
|
+
gridClassName?: string;
|
|
278
|
+
/** Classes for every card. */
|
|
279
|
+
cardClassName?: string;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** Every currency some plan has a price in, CHF first. */
|
|
283
|
+
function pricedCurrencies(plans: readonly BillingPlan[]): BillingCurrency[] {
|
|
284
|
+
const found = new Set<BillingCurrency>();
|
|
285
|
+
for (const p of plans) for (const c of Object.keys(p.prices ?? {})) found.add(c as BillingCurrency);
|
|
286
|
+
return (["CHF", "EUR"] as const).filter((c) => found.has(c));
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/** Every period some plan has a price for, yearly first. */
|
|
290
|
+
function pricedIntervals(plans: readonly BillingPlan[]): BillingInterval[] {
|
|
291
|
+
const found = new Set<BillingInterval>();
|
|
292
|
+
for (const p of plans)
|
|
293
|
+
for (const byInterval of Object.values(p.prices ?? {}))
|
|
294
|
+
for (const [k, v] of Object.entries(byInterval ?? {})) if (typeof v === "number") found.add(k as BillingInterval);
|
|
295
|
+
return BILLING_INTERVALS.filter((i) => found.has(i));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* The plans to choose from (§7): the period switch — yearly first (§12.17) — and, where
|
|
300
|
+
* the payer may pay in either, the currency switch (§2.6); a {@link PlanCard} per plan in
|
|
301
|
+
* a radio set; and one button that says what pressing it does: "Upgrade to Pro", "Switch
|
|
302
|
+
* to Free", or "Choose Pro" with no plan paid for yet.
|
|
303
|
+
*
|
|
304
|
+
* One button under the set rather than one per card: each card IS a radio — a `<label>`
|
|
305
|
+
* round an `<input>` — and a button inside a label is interactive content inside
|
|
306
|
+
* interactive content. Picking and committing are two steps anyway: the price under the
|
|
307
|
+
* picked card is what checkout will charge.
|
|
308
|
+
*
|
|
309
|
+
* The button never takes the write lock: billing itself always works, a read-only payer
|
|
310
|
+
* must be able to pay (§3.3). It is off, with the reason on hover and focus, while
|
|
311
|
+
* nothing is picked or the current plan is.
|
|
312
|
+
*/
|
|
313
|
+
export function PlanPicker({
|
|
314
|
+
plans,
|
|
315
|
+
current,
|
|
316
|
+
value: valueProp,
|
|
317
|
+
defaultValue,
|
|
318
|
+
onValueChange,
|
|
319
|
+
interval: intervalProp,
|
|
320
|
+
defaultInterval = "year",
|
|
321
|
+
onIntervalChange,
|
|
322
|
+
currency: currencyProp,
|
|
323
|
+
defaultCurrency,
|
|
324
|
+
onCurrencyChange,
|
|
325
|
+
currencies: currenciesProp,
|
|
326
|
+
onChoose,
|
|
327
|
+
pending,
|
|
328
|
+
pricePreview,
|
|
329
|
+
legend,
|
|
330
|
+
name,
|
|
331
|
+
className,
|
|
332
|
+
gridClassName,
|
|
333
|
+
cardClassName,
|
|
334
|
+
dimensionLabels,
|
|
335
|
+
formatLimit,
|
|
336
|
+
locale: localeProp,
|
|
337
|
+
labels: labelsProp,
|
|
338
|
+
}: PlanPickerProps) {
|
|
339
|
+
const labels = useBillingLabels(labelsProp);
|
|
340
|
+
const locale = useKitLocale(localeProp);
|
|
341
|
+
const generated = useId();
|
|
342
|
+
const groupName = name ?? generated;
|
|
343
|
+
const legendId = `${generated}-legend`;
|
|
344
|
+
|
|
345
|
+
const [ownValue, setOwnValue] = useState<string | null>(() => defaultValue ?? current ?? null);
|
|
346
|
+
const [ownInterval, setOwnInterval] = useState<BillingInterval>(defaultInterval);
|
|
347
|
+
const [ownCurrency, setOwnCurrency] = useState<BillingCurrency>(
|
|
348
|
+
() => defaultCurrency ?? billingCurrencyFor(locale),
|
|
349
|
+
);
|
|
350
|
+
const value = valueProp !== undefined ? valueProp : ownValue;
|
|
351
|
+
const interval = intervalProp ?? ownInterval;
|
|
352
|
+
const currency = currencyProp ?? ownCurrency;
|
|
353
|
+
|
|
354
|
+
const pick = (code: string) => {
|
|
355
|
+
if (valueProp === undefined) setOwnValue(code);
|
|
356
|
+
onValueChange?.(code);
|
|
357
|
+
};
|
|
358
|
+
const setInterval = (next: BillingInterval) => {
|
|
359
|
+
if (intervalProp === undefined) setOwnInterval(next);
|
|
360
|
+
onIntervalChange?.(next);
|
|
361
|
+
};
|
|
362
|
+
const setCurrency = (next: BillingCurrency) => {
|
|
363
|
+
if (currencyProp === undefined) setOwnCurrency(next);
|
|
364
|
+
onCurrencyChange?.(next);
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
const currencies = currenciesProp ?? pricedCurrencies(plans);
|
|
368
|
+
const intervals = pricedIntervals(plans);
|
|
369
|
+
const picked = value ? plans.find((p) => p.code.toLowerCase() === value.toLowerCase()) : undefined;
|
|
370
|
+
const relation = picked ? planRelation(plans, picked.code, current) : undefined;
|
|
371
|
+
const pickedPrice = picked ? planPrice(picked.prices, currency, interval) : undefined;
|
|
372
|
+
|
|
373
|
+
const buttonText = !picked
|
|
374
|
+
? labels.choosePlan
|
|
375
|
+
: relation === "upgrade"
|
|
376
|
+
? labels.upgrade(picked.name)
|
|
377
|
+
: relation === "downgrade"
|
|
378
|
+
? labels.downgrade(picked.name)
|
|
379
|
+
: labels.choose(picked.name);
|
|
380
|
+
const blocked = !picked
|
|
381
|
+
? labels.pickFirst
|
|
382
|
+
: relation === "current"
|
|
383
|
+
? labels.isCurrent
|
|
384
|
+
: pickedPrice?.kind === "not-offered"
|
|
385
|
+
? labels.notOffered
|
|
386
|
+
: undefined;
|
|
387
|
+
|
|
388
|
+
return (
|
|
389
|
+
<div className={cn("min-w-0 space-y-3", className)} data-billing-interval={interval} data-billing-currency={currency}>
|
|
390
|
+
{(intervals.length > 1 || currencies.length > 1) && (
|
|
391
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
392
|
+
{intervals.length > 1 && (
|
|
393
|
+
<ToggleGroup
|
|
394
|
+
aria-label={labels.interval}
|
|
395
|
+
// Content-wide, so the two switches share a row and wrap only when narrow.
|
|
396
|
+
className="w-auto"
|
|
397
|
+
options={intervals.map((i) => ({ value: i, label: i === "year" ? labels.yearly : labels.monthly }))}
|
|
398
|
+
value={interval}
|
|
399
|
+
onChange={setInterval}
|
|
400
|
+
/>
|
|
401
|
+
)}
|
|
402
|
+
{currencies.length > 1 && (
|
|
403
|
+
<ToggleGroup
|
|
404
|
+
aria-label={labels.currency}
|
|
405
|
+
className="w-auto"
|
|
406
|
+
options={currencies.map((c) => ({ value: c, label: c }))}
|
|
407
|
+
value={currency}
|
|
408
|
+
onChange={setCurrency}
|
|
409
|
+
/>
|
|
410
|
+
)}
|
|
411
|
+
</div>
|
|
412
|
+
)}
|
|
413
|
+
<fieldset
|
|
414
|
+
className="min-w-0"
|
|
415
|
+
aria-labelledby={legend !== undefined ? legendId : undefined}
|
|
416
|
+
aria-label={legend === undefined ? labels.plans : undefined}
|
|
417
|
+
>
|
|
418
|
+
{legend !== undefined && (
|
|
419
|
+
<legend id={legendId} className="mb-2 text-sm font-medium text-[var(--text-primary)]">
|
|
420
|
+
{legend}
|
|
421
|
+
</legend>
|
|
422
|
+
)}
|
|
423
|
+
<div className={cn("grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", gridClassName)}>
|
|
424
|
+
{plans.map((plan) => (
|
|
425
|
+
<PlanCard
|
|
426
|
+
key={plan.code}
|
|
427
|
+
plan={plan}
|
|
428
|
+
name={groupName}
|
|
429
|
+
currency={currency}
|
|
430
|
+
interval={interval}
|
|
431
|
+
relation={planRelation(plans, plan.code, current)}
|
|
432
|
+
pricePreview={pricePreview?.(plan, { interval, currency })}
|
|
433
|
+
checked={picked?.code === plan.code}
|
|
434
|
+
onCheckedChange={(on) => on && pick(plan.code)}
|
|
435
|
+
dimensionLabels={dimensionLabels}
|
|
436
|
+
formatLimit={formatLimit}
|
|
437
|
+
locale={locale}
|
|
438
|
+
labels={labelsProp}
|
|
439
|
+
className={cardClassName}
|
|
440
|
+
/>
|
|
441
|
+
))}
|
|
442
|
+
</div>
|
|
443
|
+
</fieldset>
|
|
444
|
+
<div className="flex justify-end">
|
|
445
|
+
<Button
|
|
446
|
+
type="button"
|
|
447
|
+
variant="primary"
|
|
448
|
+
className="max-sm:w-full"
|
|
449
|
+
disabledReason={blocked}
|
|
450
|
+
pending={pending}
|
|
451
|
+
onClick={() => picked && onChoose({ plan: picked.code, interval, currency })}
|
|
452
|
+
>
|
|
453
|
+
{buttonText}
|
|
454
|
+
</Button>
|
|
455
|
+
</div>
|
|
456
|
+
</div>
|
|
457
|
+
);
|
|
458
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
|
|
3
|
+
import { useKitLocale } from "../i18n/kit-labels";
|
|
4
|
+
import type { LabelOverride } from "../i18n/kit-labels";
|
|
5
|
+
import { formatNumber } from "../lib/format";
|
|
6
|
+
import { AlertBanner } from "../components/alert-banner";
|
|
7
|
+
import type { AlertTone } from "../components/alert-banner";
|
|
8
|
+
import { ProgressBar } from "../components/progress-bar";
|
|
9
|
+
import { Button } from "../components/ui";
|
|
10
|
+
import { useBillingLabels } from "./billing-labels";
|
|
11
|
+
import type { BillingLabels } from "./billing-labels";
|
|
12
|
+
|
|
13
|
+
/** RFC 3986 percent-encoding, `!'()*` too — a mail client that splits on `'` is the one
|
|
14
|
+
* that breaks "Plan limit: Ada's plots" (landing/access.ts keeps the same rule). */
|
|
15
|
+
function encodeStrict(value: string): string {
|
|
16
|
+
return encodeURIComponent(value).replace(/[!'()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** The `contact` mode's mail: to support, its subject naming the dimension. */
|
|
20
|
+
export function planLimitMailto(email: string, subject: string): string {
|
|
21
|
+
const to = encodeStrict(email).replace(/%40/g, "@");
|
|
22
|
+
return `mailto:${to}?subject=${encodeStrict(subject)}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface PlanLimitNoticeBaseProps extends Omit<ComponentPropsWithoutRef<"div">, "children" | "onClick"> {
|
|
26
|
+
/** The dimension as the refusal names it (`"budgets"`, `"seats"`) — `isPlanLimit(err)`'s
|
|
27
|
+
* `dimension`. Carried as `data-dimension`. */
|
|
28
|
+
dimension: string;
|
|
29
|
+
/** The app's name for it, in the reader's language: "Budgets". Default: the key. */
|
|
30
|
+
dimensionLabel?: string;
|
|
31
|
+
/** How many there are. Left out (keksdose's legacy `plan_budget_limit` body has no
|
|
32
|
+
* `used`), it is read as `limit`: the create was refused for being at it. */
|
|
33
|
+
used?: number;
|
|
34
|
+
/** The plan's limit for the dimension. Left out — a body without one — the notice says
|
|
35
|
+
* its words and draws no meter. */
|
|
36
|
+
limit?: number;
|
|
37
|
+
/** The payer's plan code, as `isPlanLimit` reads it — carried as `data-plan`, so the
|
|
38
|
+
* refusal can be spread in whole: `<PlanLimitNotice {...isPlanLimit(err)} …/>`. */
|
|
39
|
+
plan?: string;
|
|
40
|
+
/** How a figure is written — kastlan's storage limit is bytes (`formatFileSize`).
|
|
41
|
+
* Default: a number in the kit's locale. */
|
|
42
|
+
formatValue?: (value: number) => string;
|
|
43
|
+
/** Over the provider's locale, for the default figures. */
|
|
44
|
+
locale?: string;
|
|
45
|
+
/** Default `warning`. */
|
|
46
|
+
tone?: AlertTone;
|
|
47
|
+
/** Prop > `<UiKitProvider labels={{ billing }}>` > English. */
|
|
48
|
+
labels?: LabelOverride<BillingLabels>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export type PlanLimitNoticeProps = PlanLimitNoticeBaseProps &
|
|
52
|
+
(
|
|
53
|
+
| {
|
|
54
|
+
/** Plans are bought: "Choose a plan" → the app's subscription page. */
|
|
55
|
+
mode: "upgrade";
|
|
56
|
+
/** The subscription page. */
|
|
57
|
+
href: string;
|
|
58
|
+
email?: never;
|
|
59
|
+
}
|
|
60
|
+
| {
|
|
61
|
+
/** The operator grants plans by hand (keksdose's today): "Ask for more" → a mail. */
|
|
62
|
+
mode: "contact";
|
|
63
|
+
/** The support address: `support@` the app's domain. */
|
|
64
|
+
email: string;
|
|
65
|
+
href?: never;
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A create refused at the plan's limit (docs/billing-harmonization.md §3.4): "Plan limit
|
|
71
|
+
* reached", what to do, the dimension's meter ("Budgets — 3 of 3") and the app's way to
|
|
72
|
+
* more — `upgrade`, a link to the subscription page, or `contact`, a mail to support.
|
|
73
|
+
*
|
|
74
|
+
* A limit gates CREATION only: a downgrade never deletes or hides what is over the new
|
|
75
|
+
* limit (§3.4), so `used` may be past `limit`; the meter then fills and turns red. Feed it
|
|
76
|
+
* the refusal: `const hit = isPlanLimit(err); hit && <PlanLimitNotice {...hit} …/>`. The
|
|
77
|
+
* kit sends nothing — the mail opens the reader's own client.
|
|
78
|
+
*/
|
|
79
|
+
export function PlanLimitNotice(props: PlanLimitNoticeProps) {
|
|
80
|
+
const {
|
|
81
|
+
dimension,
|
|
82
|
+
dimensionLabel,
|
|
83
|
+
used: usedProp,
|
|
84
|
+
limit,
|
|
85
|
+
plan,
|
|
86
|
+
formatValue,
|
|
87
|
+
locale: localeProp,
|
|
88
|
+
tone = "warning",
|
|
89
|
+
labels: labelsProp,
|
|
90
|
+
mode,
|
|
91
|
+
href,
|
|
92
|
+
email,
|
|
93
|
+
className,
|
|
94
|
+
...rest
|
|
95
|
+
} = props;
|
|
96
|
+
const labels = useBillingLabels(labelsProp);
|
|
97
|
+
const locale = useKitLocale(localeProp);
|
|
98
|
+
const used = usedProp ?? limit ?? 0;
|
|
99
|
+
const name = dimensionLabel ?? dimension;
|
|
100
|
+
const figure = (value: number) => (formatValue ? formatValue(value) : formatNumber(value, { locale }));
|
|
101
|
+
|
|
102
|
+
const action =
|
|
103
|
+
mode === "upgrade" ? (
|
|
104
|
+
<Button href={href} variant="secondary" size="sm">
|
|
105
|
+
{labels.choosePlan}
|
|
106
|
+
</Button>
|
|
107
|
+
) : (
|
|
108
|
+
<Button href={planLimitMailto(email, labels.contactSubject(name))} variant="secondary" size="sm">
|
|
109
|
+
{labels.askForMore}
|
|
110
|
+
</Button>
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<AlertBanner
|
|
115
|
+
{...rest}
|
|
116
|
+
tone={tone}
|
|
117
|
+
action={action}
|
|
118
|
+
data-plan-limit-mode={mode}
|
|
119
|
+
data-dimension={dimension}
|
|
120
|
+
data-plan={plan}
|
|
121
|
+
className={className}
|
|
122
|
+
>
|
|
123
|
+
<span className="block font-medium">{labels.limitReached}</span>
|
|
124
|
+
<span className="block">{mode === "upgrade" ? labels.limitUpgrade : labels.limitContact}</span>
|
|
125
|
+
{limit !== undefined && (
|
|
126
|
+
<ProgressBar
|
|
127
|
+
as="span"
|
|
128
|
+
variant="meter"
|
|
129
|
+
size="slim"
|
|
130
|
+
value={used}
|
|
131
|
+
max={limit}
|
|
132
|
+
label={name}
|
|
133
|
+
showValue
|
|
134
|
+
// The bar is clamped at `max` and hands its formatter the clamped value; the
|
|
135
|
+
// figures are the real ones, so "5 of 3" after a downgrade says what the bar
|
|
136
|
+
// cannot draw.
|
|
137
|
+
formatValue={() => labels.usage(figure(used), figure(limit))}
|
|
138
|
+
tone={used > limit ? "danger" : "warning"}
|
|
139
|
+
className="mt-2"
|
|
140
|
+
locale={locale}
|
|
141
|
+
/>
|
|
142
|
+
)}
|
|
143
|
+
</AlertBanner>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { errorBodyWithCode } from "../auth/auth-errors";
|
|
2
|
+
|
|
3
|
+
/** What {@link isPlanLimit} reads off a `plan_limit` refusal (docs/billing-harmonization.md
|
|
4
|
+
* §3.4): `402 {detail, code: "plan_limit", dimension, plan, limit, used}`. */
|
|
5
|
+
export interface PlanLimitRefusal {
|
|
6
|
+
/** The limited dimension, as the app's catalogue names it: `"budgets"`, `"seats"`. */
|
|
7
|
+
dimension: string;
|
|
8
|
+
/** The payer's plan code, lowercased (§12.16: reads compare without case, and
|
|
9
|
+
* keksdose's legacy body still says `"FREE"`). `undefined` when the body has none. */
|
|
10
|
+
plan: string | undefined;
|
|
11
|
+
/** The plan's limit for the dimension. `undefined` when the body has none. */
|
|
12
|
+
limit: number | undefined;
|
|
13
|
+
/** How many there are. `undefined` when the body has none — keksdose's legacy
|
|
14
|
+
* `plan_budget_limit` body never had it. */
|
|
15
|
+
used: number | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** keksdose's code before §3.4: `402 {detail, code: "plan_budget_limit", plan, limit}`. */
|
|
19
|
+
const LEGACY_BUDGET_LIMIT = "plan_budget_limit";
|
|
20
|
+
|
|
21
|
+
const text = (value: unknown): string | undefined =>
|
|
22
|
+
typeof value === "string" && value !== "" ? value : undefined;
|
|
23
|
+
const count = (value: unknown): number | undefined =>
|
|
24
|
+
typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The plan-limit refusal `err` carries — `{dimension, plan, limit, used}` — or
|
|
28
|
+
* `undefined` when it is not one (docs/billing-harmonization.md §3.4):
|
|
29
|
+
*
|
|
30
|
+
* catch (err) {
|
|
31
|
+
* const hit = isPlanLimit(err);
|
|
32
|
+
* if (hit) return setLimit(hit); // → <PlanLimitNotice {...hit} mode="upgrade" href="/settings/subscription" />
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* The body is found where `authErrorCode` finds a code — axios' `err.response.data`,
|
|
36
|
+
* ofetch's `err.data`, a generated client's `err.body`, or `err` itself — and FastAPI's
|
|
37
|
+
* nested `{detail: {code, …}}` too; the extra fields are read beside the code.
|
|
38
|
+
*
|
|
39
|
+
* keksdose's old code, `plan_budget_limit`, is read as `dimension: "budgets"` (§12.16):
|
|
40
|
+
* its frontend accepts both codes for a release, because installed PWAs run the previous
|
|
41
|
+
* bundle while the server switches.
|
|
42
|
+
*/
|
|
43
|
+
export function isPlanLimit(err: unknown): PlanLimitRefusal | undefined {
|
|
44
|
+
const body = errorBodyWithCode(err, (code) => code === "plan_limit" || code === LEGACY_BUDGET_LIMIT);
|
|
45
|
+
if (!body) return undefined;
|
|
46
|
+
const legacy = body.code === LEGACY_BUDGET_LIMIT;
|
|
47
|
+
return {
|
|
48
|
+
dimension: text(body.dimension) ?? (legacy ? "budgets" : ""),
|
|
49
|
+
plan: text(body.plan)?.toLowerCase(),
|
|
50
|
+
limit: count(body.limit),
|
|
51
|
+
used: count(body.used),
|
|
52
|
+
};
|
|
53
|
+
}
|