@eifi1/ui-kit 0.31.1 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -28
- package/dist/account/delete-account-setting.d.ts +8 -3
- package/dist/admin/admin-action-confirm.d.ts +8 -3
- package/dist/admin/admin-action-log.d.ts +1 -1
- package/dist/admin/admin-action-log.js +4 -2
- package/dist/admin/admin-action-log.js.map +1 -1
- package/dist/admin/invitations-panel.d.ts +8 -3
- package/dist/admin/invitations-panel.js +29 -26
- package/dist/admin/invitations-panel.js.map +1 -1
- package/dist/admin/reviewer-scope-editor.d.ts +8 -3
- package/dist/admin/role-select.d.ts +10 -5
- package/dist/admin/transfer-ownership-dialog.d.ts +8 -3
- package/dist/admin/user-roster.d.ts +10 -5
- package/dist/admin/user-roster.js +8 -47
- package/dist/admin/user-roster.js.map +1 -1
- package/dist/auth/auth-errors.d.ts +43 -8
- package/dist/auth/auth-errors.js +24 -1
- package/dist/auth/auth-errors.js.map +1 -1
- package/dist/auth/register-form.d.ts +8 -3
- package/dist/billing/billing-banner.d.ts +184 -0
- package/dist/billing/billing-banner.js +98 -0
- package/dist/billing/billing-banner.js.map +1 -0
- package/dist/billing/billing-labels.d.ts +100 -0
- package/dist/billing/billing-labels.js +76 -0
- package/dist/billing/billing-labels.js.map +1 -0
- package/dist/billing/billing-lock.d.ts +158 -0
- package/dist/billing/billing-lock.js +17 -0
- package/dist/billing/billing-lock.js.map +1 -0
- package/dist/billing/billing-standing.d.ts +149 -0
- package/dist/billing/billing-standing.js +28 -0
- package/dist/billing/billing-standing.js.map +1 -0
- package/dist/billing/plan-card.d.ts +248 -0
- package/dist/billing/plan-card.js +248 -0
- package/dist/billing/plan-card.js.map +1 -0
- package/dist/billing/plan-limit-notice.d.ts +156 -0
- package/dist/billing/plan-limit-notice.js +76 -0
- package/dist/billing/plan-limit-notice.js.map +1 -0
- package/dist/billing/plan-limit.d.ts +34 -0
- package/dist/billing/plan-limit.js +20 -0
- package/dist/billing/plan-limit.js.map +1 -0
- package/dist/billing/plan-price.d.ts +61 -0
- package/dist/billing/plan-price.js +45 -0
- package/dist/billing/plan-price.js.map +1 -0
- package/dist/billing/subscription-actions.d.ts +133 -0
- package/dist/billing/subscription-actions.js +28 -0
- package/dist/billing/subscription-actions.js.map +1 -0
- package/dist/billing/subscription-status-chip.d.ts +149 -0
- package/dist/billing/subscription-status-chip.js +48 -0
- package/dist/billing/subscription-status-chip.js.map +1 -0
- package/dist/chart.d.ts +9 -3
- package/dist/chart.js.map +1 -1
- package/dist/components/account-chips.d.ts +16 -4
- package/dist/components/account-chips.js +21 -3
- package/dist/components/account-chips.js.map +1 -1
- package/dist/components/alert-banner.d.ts +6 -1
- package/dist/components/alert-banner.js +5 -4
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.d.ts +8 -3
- package/dist/components/amount-input.js +5 -5
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/appearance-labels.d.ts +38 -0
- package/dist/components/appearance-labels.js +19 -0
- package/dist/components/appearance-labels.js.map +1 -0
- package/dist/components/autocomplete.js +2 -2
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/breadcrumbs.js +3 -2
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/bulk-action-bar.d.ts +2 -2
- package/dist/components/bulk-action-bar.js +7 -12
- package/dist/components/bulk-action-bar.js.map +1 -1
- package/dist/components/button-group.d.ts +8 -3
- package/dist/components/button-group.js +7 -1
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/calculator.d.ts +8 -3
- package/dist/components/calculator.js +4 -3
- package/dist/components/calculator.js.map +1 -1
- package/dist/components/calendar-heatmap.js +5 -5
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/chart-height.d.ts +23 -0
- package/dist/components/chart-height.js +15 -0
- package/dist/components/chart-height.js.map +1 -0
- package/dist/components/chart-zoom.js +6 -1
- package/dist/components/chart-zoom.js.map +1 -1
- package/dist/components/checkbox-group.js +2 -2
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/checkbox.d.ts +10 -0
- package/dist/components/checkbox.js +25 -10
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/chip.d.ts +19 -3
- package/dist/components/chip.js +54 -23
- package/dist/components/chip.js.map +1 -1
- package/dist/components/choice-card.d.ts +1 -1
- package/dist/components/choice-card.js +9 -8
- package/dist/components/choice-card.js.map +1 -1
- package/dist/components/column-mapper.js +1 -1
- package/dist/components/column-mapper.js.map +1 -1
- package/dist/components/combobox-core.js +8 -7
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.js +8 -8
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +8 -3
- package/dist/components/copy-button.d.ts +10 -5
- package/dist/components/country-select.js +1 -1
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/currency-select.js +3 -3
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm.d.ts +8 -3
- package/dist/components/data-table-cells.d.ts +1 -1
- package/dist/components/data-table-filter-popover.d.ts +1 -1
- package/dist/components/data-table-filter-popover.js +4 -1
- package/dist/components/data-table-filter-popover.js.map +1 -1
- package/dist/components/data-table-filters.d.ts +1 -1
- package/dist/components/data-table-labels.d.ts +1 -1
- package/dist/components/data-table-pagination.d.ts +3 -2
- package/dist/components/data-table-pagination.js +15 -6
- package/dist/components/data-table-pagination.js.map +1 -1
- package/dist/components/data-table.d.ts +1 -1
- package/dist/components/data-table.js +123 -52
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +1 -1
- package/dist/components/date-picker.js +18 -6
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/description-list.js +2 -2
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog-frame.js +2 -1
- package/dist/components/dialog-frame.js.map +1 -1
- package/dist/components/disclosure.js +3 -2
- package/dist/components/disclosure.js.map +1 -1
- package/dist/components/dropdown.d.ts +1 -1
- package/dist/components/dropdown.js +7 -1
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/facing-pair.d.ts +19 -6
- package/dist/components/facing-pair.js +3 -2
- package/dist/components/facing-pair.js.map +1 -1
- package/dist/components/field-parts.d.ts +102 -6
- package/dist/components/field-parts.js +81 -6
- package/dist/components/field-parts.js.map +1 -1
- package/dist/components/field-sync.d.ts +4 -1
- package/dist/components/field-sync.js +12 -2
- package/dist/components/field-sync.js.map +1 -1
- package/dist/components/field.js +2 -2
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-button.d.ts +8 -3
- package/dist/components/file-dropzone.d.ts +8 -3
- package/dist/components/floating-panel.js +7 -4
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/focus-ring.d.ts +12 -0
- package/dist/components/focus-ring.js +8 -0
- package/dist/components/focus-ring.js.map +1 -0
- package/dist/components/form-actions.d.ts +8 -3
- package/dist/components/form-actions.js +33 -19
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/full-bleed-dialog.d.ts +11 -1
- package/dist/components/full-bleed-dialog.js +3 -1
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/iban-input.d.ts +8 -3
- package/dist/components/image-grid.js +1 -1
- package/dist/components/image-grid.js.map +1 -1
- package/dist/components/inline-edit-field.js +10 -4
- package/dist/components/inline-edit-field.js.map +1 -1
- package/dist/components/language-select.d.ts +8 -3
- package/dist/components/legal-page.d.ts +26 -5
- package/dist/components/legal-page.js +3 -1
- package/dist/components/legal-page.js.map +1 -1
- package/dist/components/legal.d.ts +8 -3
- package/dist/components/legal.js +2 -1
- package/dist/components/legal.js.map +1 -1
- package/dist/components/lightbox.js +24 -2
- package/dist/components/lightbox.js.map +1 -1
- package/dist/components/line-items.js +2 -1
- package/dist/components/line-items.js.map +1 -1
- package/dist/components/list.d.ts +5 -0
- package/dist/components/list.js +13 -9
- package/dist/components/list.js.map +1 -1
- package/dist/components/measured-grid.d.ts +3 -1
- package/dist/components/measured-grid.js +38 -20
- package/dist/components/measured-grid.js.map +1 -1
- package/dist/components/menu-item.js +2 -1
- package/dist/components/menu-item.js.map +1 -1
- package/dist/components/mini-calendar.js +8 -4
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/money-field.d.ts +8 -3
- package/dist/components/month-picker.js +50 -39
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/nav-pills.js +1 -1
- package/dist/components/nav-pills.js.map +1 -1
- package/dist/components/number-field.d.ts +8 -3
- package/dist/components/number-input.d.ts +11 -4
- package/dist/components/number-input.js +8 -6
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.d.ts +8 -3
- package/dist/components/numpad-sheet.js +2 -1
- package/dist/components/numpad-sheet.js.map +1 -1
- package/dist/components/one-time-code-input.js +2 -2
- package/dist/components/one-time-code-input.js.map +1 -1
- package/dist/components/page-contents.js +2 -2
- package/dist/components/page-contents.js.map +1 -1
- package/dist/components/phone-input.d.ts +8 -3
- package/dist/components/phone-input.js +4 -4
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/pie-chart.d.ts +8 -2
- package/dist/components/pie-chart.js +11 -7
- package/dist/components/pie-chart.js.map +1 -1
- package/dist/components/popover.d.ts +9 -1
- package/dist/components/popover.js +8 -4
- package/dist/components/popover.js.map +1 -1
- package/dist/components/row-actions.d.ts +100 -0
- package/dist/components/row-actions.js +231 -0
- package/dist/components/row-actions.js.map +1 -0
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/search-field.js +3 -2
- package/dist/components/search-field.js.map +1 -1
- package/dist/components/series-chart-budget.d.ts +30 -7
- package/dist/components/series-chart-budget.js +12 -4
- package/dist/components/series-chart-budget.js.map +1 -1
- package/dist/components/series-chart-ticks.d.ts +7 -1
- package/dist/components/series-chart-ticks.js +6 -0
- package/dist/components/series-chart-ticks.js.map +1 -1
- package/dist/components/series-chart.d.ts +58 -28
- package/dist/components/series-chart.js +42 -32
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/settings-fields.d.ts +57 -8
- package/dist/components/settings-fields.js +39 -1
- package/dist/components/settings-fields.js.map +1 -1
- package/dist/components/share-card.d.ts +11 -6
- package/dist/components/share-card.js +8 -2
- package/dist/components/share-card.js.map +1 -1
- package/dist/components/sign-chip.d.ts +4 -0
- package/dist/components/sign-chip.js +17 -4
- package/dist/components/sign-chip.js.map +1 -1
- package/dist/components/signature-pad.d.ts +3 -1
- package/dist/components/signature-pad.js +8 -5
- package/dist/components/signature-pad.js.map +1 -1
- package/dist/components/slider.js +7 -6
- package/dist/components/slider.js.map +1 -1
- package/dist/components/sparkline.d.ts +5 -1
- package/dist/components/sparkline.js +4 -2
- package/dist/components/sparkline.js.map +1 -1
- package/dist/components/stat-tile.d.ts +17 -1
- package/dist/components/stat-tile.js +48 -20
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/status-dot.d.ts +4 -0
- package/dist/components/status-dot.js +9 -2
- package/dist/components/status-dot.js.map +1 -1
- package/dist/components/swipeable-row.js +10 -2
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/switch.d.ts +21 -7
- package/dist/components/switch.js +24 -11
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.js +2 -2
- package/dist/components/table.js.map +1 -1
- package/dist/components/text-link.d.ts +8 -3
- package/dist/components/text-link.js +1 -1
- package/dist/components/text-link.js.map +1 -1
- package/dist/components/text.d.ts +7 -2
- package/dist/components/text.js +5 -5
- package/dist/components/text.js.map +1 -1
- package/dist/components/tile-radio.js +2 -1
- package/dist/components/tile-radio.js.map +1 -1
- package/dist/components/time-input.d.ts +8 -3
- package/dist/components/toast.d.ts +18 -2
- package/dist/components/toast.js +8 -5
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.d.ts +25 -3
- package/dist/components/toggle-group.js +40 -11
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle-legend.d.ts +10 -1
- package/dist/components/toggle-legend.js +21 -7
- package/dist/components/toggle-legend.js.map +1 -1
- package/dist/components/translation-review-editor.js +1 -1
- package/dist/components/translation-review-editor.js.map +1 -1
- package/dist/components/translation-review-parts.d.ts +4 -0
- package/dist/components/translation-review.d.ts +4 -0
- package/dist/components/translation-review.js +3 -3
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/tree-view.js +3 -2
- package/dist/components/tree-view.js.map +1 -1
- package/dist/components/treemap.d.ts +5 -2
- package/dist/components/treemap.js +33 -16
- package/dist/components/treemap.js.map +1 -1
- package/dist/components/ui.d.ts +8 -3
- package/dist/components/ui.js +207 -119
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +1 -1
- package/dist/components/user-avatar.d.ts +5 -1
- package/dist/components/user-avatar.js +1 -1
- package/dist/components/user-avatar.js.map +1 -1
- package/dist/components/wizard-stepper.js +20 -14
- package/dist/components/wizard-stepper.js.map +1 -1
- package/dist/{data-table-labels-DUELeXpa.d.ts → data-table-labels-kpAAVi6g.d.ts} +26 -2
- package/dist/data-table.d.ts +1 -1
- package/dist/{delete-account-setting-CpIhzxxZ.d.ts → delete-account-setting-FLyJf-kZ.d.ts} +642 -60
- package/dist/demo/demo-banner.js +1 -0
- package/dist/demo/demo-banner.js.map +1 -1
- package/dist/feedback/feedback-attachment.d.ts +8 -3
- package/dist/feedback/feedback-context.d.ts +8 -3
- package/dist/feedback/feedback-crash.d.ts +8 -3
- package/dist/feedback/feedback-dialog.d.ts +8 -3
- package/dist/feedback/feedback-dialog.js +3 -3
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.d.ts +8 -3
- package/dist/feedback/feedback-inbox.js +2 -2
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback/feedback-labels.d.ts +8 -3
- package/dist/feedback/feedback-menu.d.ts +9 -4
- package/dist/feedback/feedback-record.d.ts +8 -3
- package/dist/feedback/feedback-row-detail.d.ts +8 -3
- package/dist/feedback/feedback-status-undo.d.ts +8 -3
- package/dist/feedback/feedback-submit.d.ts +8 -3
- package/dist/feedback/feedback-swipe.d.ts +8 -3
- package/dist/feedback/feedback-table.d.ts +8 -3
- package/dist/feedback/feedback-thread.d.ts +8 -3
- package/dist/feedback/feedback-thread.js +3 -3
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/feedback.d.ts +8 -3
- package/dist/hooks/use-anchored-panel.d.ts +32 -3
- package/dist/hooks/use-anchored-panel.js +21 -3
- package/dist/hooks/use-anchored-panel.js.map +1 -1
- package/dist/hooks/use-breakpoint.d.ts +88 -0
- package/dist/hooks/use-breakpoint.js +50 -0
- package/dist/hooks/use-breakpoint.js.map +1 -0
- package/dist/hooks/use-file-drop.d.ts +8 -3
- package/dist/hooks/use-large-text.d.ts +29 -0
- package/dist/hooks/use-large-text.js +20 -0
- package/dist/hooks/use-large-text.js.map +1 -0
- package/dist/hooks/use-windowed-rows.d.ts +52 -8
- package/dist/hooks/use-windowed-rows.js +94 -5
- package/dist/hooks/use-windowed-rows.js.map +1 -1
- package/dist/i18n/defaults.d.ts +8 -3
- package/dist/i18n/defaults.js +8 -0
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.d.ts +8 -3
- package/dist/i18n/german.js +94 -3
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +8 -3
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/languages.d.ts +10 -5
- package/dist/i18n/locales/de-CH.d.ts +8 -3
- package/dist/i18n/locales/en.d.ts +8 -3
- package/dist/i18n/locales/es.d.ts +8 -3
- package/dist/i18n/locales/es.js +89 -3
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +8 -3
- package/dist/i18n/locales/fr.js +91 -3
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +8 -3
- package/dist/i18n/locales/hu.js +91 -3
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +8 -3
- package/dist/i18n/locales/it.js +92 -3
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +8 -3
- package/dist/i18n/locales/zh.js +89 -3
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.d.ts +8 -3
- package/dist/i18n/review.js +15 -1
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +27 -11
- package/dist/index.js +77 -4
- package/dist/index.js.map +1 -1
- package/dist/landing/landing-actions.d.ts +8 -3
- package/dist/landing/landing-sections.d.ts +8 -3
- package/dist/landing/landing-sections.js +7 -3
- package/dist/landing/landing-sections.js.map +1 -1
- package/dist/landing/public-header.d.ts +9 -4
- package/dist/landing/public-header.js +3 -3
- package/dist/landing/public-header.js.map +1 -1
- package/dist/landing/routing.d.ts +8 -3
- package/dist/lib/cn.js +3 -2
- package/dist/lib/cn.js.map +1 -1
- package/dist/rhf/fields.d.ts +8 -3
- package/dist/rhf/fields.js +1 -1
- package/dist/rhf/fields.js.map +1 -1
- package/dist/rhf/form.d.ts +8 -3
- package/dist/rhf/form.js +2 -2
- package/dist/rhf/form.js.map +1 -1
- package/dist/rhf.d.ts +8 -3
- package/dist/search/command-palette.d.ts +1 -1
- package/dist/search/command-palette.js +9 -8
- package/dist/search/command-palette.js.map +1 -1
- package/dist/settings/settings-layout.js +2 -1
- package/dist/settings/settings-layout.js.map +1 -1
- package/dist/settings/settings-section.d.ts +8 -3
- package/dist/settings/use-account-appearance.d.ts +92 -0
- package/dist/settings/use-account-appearance.js +63 -0
- package/dist/settings/use-account-appearance.js.map +1 -0
- package/dist/settings/use-settings-route.d.ts +1 -1
- package/dist/settings/use-settings-route.js +2 -3
- package/dist/settings/use-settings-route.js.map +1 -1
- package/dist/shell/app-shell.d.ts +12 -171
- package/dist/shell/app-shell.js +144 -28
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/auth-layout.js +1 -1
- package/dist/shell/auth-layout.js.map +1 -1
- package/dist/shell/option-switcher-menu.js +1 -1
- package/dist/shell/option-switcher-menu.js.map +1 -1
- package/dist/shell/top-bar-brand.d.ts +8 -3
- package/dist/shell/top-bar-brand.js +3 -1
- package/dist/shell/top-bar-brand.js.map +1 -1
- package/dist/shell/topbar-action-menu.d.ts +4 -0
- package/dist/shell/topbar-action-menu.js +3 -3
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell/topbar-controls.js +4 -4
- package/dist/shell/topbar-controls.js.map +1 -1
- package/dist/shell.d.ts +9 -5
- package/dist/theme/contrast-tokens.d.ts +41 -0
- package/dist/theme/contrast-tokens.js +59 -0
- package/dist/theme/contrast-tokens.js.map +1 -0
- package/dist/theme/contrast.d.ts +110 -0
- package/dist/theme/contrast.js +128 -0
- package/dist/theme/contrast.js.map +1 -0
- package/dist/theme/palette-presets.d.ts +12 -1
- package/dist/theme/palette-presets.js +9 -4
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/theme/palette-store.js.map +1 -1
- package/dist/theme/text-size.d.ts +173 -0
- package/dist/theme/text-size.js +121 -0
- package/dist/theme/text-size.js.map +1 -0
- package/dist/wizard/stepper-nav.d.ts +8 -3
- package/dist/wizard/wizard-summary.js +1 -1
- package/dist/wizard/wizard-summary.js.map +1 -1
- package/dist/wizard.d.ts +8 -3
- package/package.json +1 -1
- package/src/admin/admin-action-log.tsx +6 -1
- package/src/admin/invitations-panel.tsx +36 -29
- package/src/admin/user-roster.tsx +17 -72
- package/src/auth/auth-errors.ts +68 -7
- package/src/billing/billing-banner.tsx +205 -0
- package/src/billing/billing-labels.ts +240 -0
- package/src/billing/billing-lock.ts +75 -0
- package/src/billing/billing-standing.ts +72 -0
- package/src/billing/plan-card.tsx +458 -0
- package/src/billing/plan-limit-notice.tsx +145 -0
- package/src/billing/plan-limit.ts +53 -0
- package/src/billing/plan-price.ts +101 -0
- package/src/billing/subscription-actions.tsx +76 -0
- package/src/billing/subscription-status-chip.tsx +95 -0
- package/src/chart.ts +2 -0
- package/src/components/account-chips.tsx +36 -10
- package/src/components/alert-banner.tsx +16 -7
- package/src/components/amount-input.tsx +5 -5
- package/src/components/appearance-labels.ts +47 -0
- package/src/components/autocomplete.tsx +2 -2
- package/src/components/breadcrumbs.tsx +3 -3
- package/src/components/bulk-action-bar.tsx +11 -14
- package/src/components/button-group.tsx +21 -0
- package/src/components/calculator.tsx +4 -3
- package/src/components/calendar-heatmap.tsx +5 -5
- package/src/components/chart-height.ts +30 -0
- package/src/components/chart-zoom.tsx +6 -1
- package/src/components/checkbox-group.tsx +2 -2
- package/src/components/checkbox.tsx +62 -20
- package/src/components/chip.tsx +139 -30
- package/src/components/choice-card.tsx +16 -11
- package/src/components/column-mapper.tsx +1 -1
- package/src/components/combobox-core.tsx +8 -7
- package/src/components/combobox.tsx +8 -8
- package/src/components/country-select.tsx +1 -1
- package/src/components/currency-select.tsx +3 -3
- package/src/components/data-table-filter-popover.tsx +7 -1
- package/src/components/data-table-pagination.tsx +60 -31
- package/src/components/data-table.tsx +164 -43
- package/src/components/date-picker.tsx +44 -10
- package/src/components/description-list.tsx +2 -2
- package/src/components/dialog-frame.tsx +2 -1
- package/src/components/disclosure.tsx +3 -2
- package/src/components/dropdown.tsx +10 -2
- package/src/components/facing-pair.ts +12 -5
- package/src/components/field-parts.tsx +190 -7
- package/src/components/field-sync.tsx +17 -3
- package/src/components/field.tsx +2 -2
- package/src/components/floating-panel.tsx +7 -4
- package/src/components/focus-ring.ts +12 -0
- package/src/components/form-actions.tsx +55 -18
- package/src/components/full-bleed-dialog.tsx +18 -4
- package/src/components/image-grid.tsx +1 -1
- package/src/components/inline-edit-field.tsx +26 -4
- package/src/components/legal-page.tsx +28 -2
- package/src/components/legal.tsx +19 -1
- package/src/components/lightbox.tsx +24 -2
- package/src/components/line-items.tsx +7 -1
- package/src/components/list.tsx +36 -10
- package/src/components/measured-grid.tsx +49 -24
- package/src/components/menu-item.tsx +2 -2
- package/src/components/mini-calendar.tsx +8 -4
- package/src/components/month-picker.tsx +15 -6
- package/src/components/nav-pills.tsx +1 -1
- package/src/components/number-input.tsx +14 -7
- package/src/components/numpad-sheet.tsx +2 -2
- package/src/components/one-time-code-input.tsx +2 -2
- package/src/components/page-contents.tsx +2 -2
- package/src/components/phone-input.tsx +9 -4
- package/src/components/pie-chart.tsx +19 -9
- package/src/components/popover.tsx +22 -5
- package/src/components/row-actions.tsx +450 -0
- package/src/components/scroll-area.tsx +1 -1
- package/src/components/search-field.tsx +4 -2
- package/src/components/series-chart-budget.ts +40 -8
- package/src/components/series-chart-ticks.ts +10 -0
- package/src/components/series-chart.tsx +123 -72
- package/src/components/settings-fields.tsx +89 -5
- package/src/components/share-card.tsx +31 -2
- package/src/components/sign-chip.tsx +28 -4
- package/src/components/signature-pad.tsx +13 -7
- package/src/components/slider.tsx +22 -9
- package/src/components/sparkline.tsx +11 -3
- package/src/components/stat-tile.tsx +70 -14
- package/src/components/status-dot.tsx +25 -2
- package/src/components/swipeable-row.tsx +10 -2
- package/src/components/switch.tsx +57 -23
- package/src/components/table.tsx +2 -2
- package/src/components/text-link.tsx +1 -1
- package/src/components/text.tsx +11 -6
- package/src/components/tile-radio.tsx +4 -1
- package/src/components/toast.tsx +27 -7
- package/src/components/toggle-group.tsx +115 -14
- package/src/components/toggle-legend.tsx +53 -8
- package/src/components/translation-review-editor.tsx +1 -1
- package/src/components/translation-review.tsx +11 -5
- package/src/components/tree-view.tsx +3 -2
- package/src/components/treemap.tsx +27 -10
- package/src/components/ui.tsx +353 -153
- package/src/components/user-avatar.tsx +1 -1
- package/src/components/wizard-stepper.tsx +5 -1
- package/src/demo/demo-banner.tsx +5 -0
- package/src/feedback/feedback-dialog.tsx +3 -3
- package/src/feedback/feedback-inbox.tsx +2 -2
- package/src/feedback/feedback-thread.tsx +3 -3
- package/src/hooks/use-anchored-panel.ts +67 -5
- package/src/hooks/use-breakpoint.ts +132 -0
- package/src/hooks/use-large-text.ts +41 -0
- package/src/hooks/use-windowed-rows.ts +168 -12
- package/src/i18n/defaults.ts +8 -0
- package/src/i18n/german.ts +107 -0
- package/src/i18n/kit-labels.tsx +12 -0
- package/src/i18n/locales/es.ts +98 -0
- package/src/i18n/locales/fr.ts +102 -0
- package/src/i18n/locales/hu.ts +100 -0
- package/src/i18n/locales/it.ts +103 -0
- package/src/i18n/locales/zh.ts +94 -0
- package/src/i18n/review.ts +14 -0
- package/src/index.ts +76 -6
- package/src/landing/landing-sections.tsx +7 -3
- package/src/landing/public-header.tsx +4 -4
- package/src/lib/cn.ts +13 -2
- package/src/rhf/fields.tsx +1 -1
- package/src/rhf/form.tsx +2 -2
- package/src/search/command-palette.tsx +10 -9
- package/src/settings/settings-layout.tsx +2 -1
- package/src/settings/use-account-appearance.ts +148 -0
- package/src/settings/use-settings-route.ts +3 -4
- package/src/shell/app-shell.tsx +278 -54
- package/src/shell/auth-layout.tsx +1 -1
- package/src/shell/option-switcher-menu.tsx +1 -1
- package/src/shell/top-bar-brand.tsx +3 -1
- package/src/shell/topbar-action-menu.tsx +3 -3
- package/src/shell/topbar-controls.tsx +4 -4
- package/src/theme/contrast-tokens.ts +112 -0
- package/src/theme/contrast.ts +225 -0
- package/src/theme/palette-presets.ts +24 -4
- package/src/theme/palette-store.ts +6 -1
- package/src/theme/text-size.ts +283 -0
- package/src/wizard/wizard-summary.tsx +4 -2
- package/tokens.css +158 -8
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { eY as SelectProps } from '../delete-account-setting-FLyJf-kZ.js';
|
|
4
4
|
import { ToggleGroupBaseProps } from './toggle-group.js';
|
|
5
5
|
import { ThemePreference } from '../theme/theme-store.js';
|
|
6
|
+
import { TextSize } from '../theme/text-size.js';
|
|
7
|
+
import { ContrastMode } from '../theme/contrast.js';
|
|
8
|
+
import { AppearanceLabels } from './appearance-labels.js';
|
|
6
9
|
import './tooltip.js';
|
|
7
10
|
import '../hooks/use-anchored-rect.js';
|
|
8
11
|
import '../lib/clipping.js';
|
|
9
|
-
import '../data-table-labels-
|
|
12
|
+
import '../data-table-labels-kpAAVi6g.js';
|
|
10
13
|
import './data-table-sort.js';
|
|
11
14
|
import './swipeable-row.js';
|
|
12
15
|
import './mini-calendar.js';
|
|
13
16
|
import './calendar-heatmap.js';
|
|
14
17
|
import './popover.js';
|
|
18
|
+
import '../hooks/use-breakpoint.js';
|
|
15
19
|
import './chip.js';
|
|
16
20
|
import 'lucide-react';
|
|
21
|
+
import './field-parts.js';
|
|
17
22
|
import './field-sync.js';
|
|
18
23
|
import '../wizard/types.js';
|
|
19
24
|
import '../tour/tour.js';
|
|
@@ -94,12 +99,14 @@ import './sign-chip.js';
|
|
|
94
99
|
import './column-mapper.js';
|
|
95
100
|
import '../lib/column-mapping.js';
|
|
96
101
|
import '../lib/table-text.js';
|
|
97
|
-
import './
|
|
102
|
+
import './focus-ring.js';
|
|
98
103
|
|
|
99
104
|
/**
|
|
100
105
|
* App-agnostic settings-field components (feedback #333): the language + theme
|
|
101
|
-
* controls that every app's settings page needs,
|
|
102
|
-
*
|
|
106
|
+
* controls that every app's settings page needs — and, since 0.32, the text size and
|
|
107
|
+
* the contrast (docs/text-size-harmonization.md §6), whose words are the kit's own
|
|
108
|
+
* `appearance` namespace — so they live in @hb/ui and the app just supplies the
|
|
109
|
+
* current value, a change handler and translated labels.
|
|
103
110
|
* The app owns WHERE these render (its own settings page) and any app-specific
|
|
104
111
|
* fields around them.
|
|
105
112
|
*/
|
|
@@ -129,8 +136,12 @@ interface ThemeSettingProps extends Omit<SelectProps, "value" | "onChange" | "ch
|
|
|
129
136
|
* one segmented control instead of a select — system, light and dark side by side, the
|
|
130
137
|
* choice visible without opening anything, in every app (keksdose offered light and dark
|
|
131
138
|
* only; its store already knew "system"). A {@link ToggleGroup}'s props pass through —
|
|
132
|
-
* `labelPlacement`, `disabledReason`, `commit`, `size` — minus the options
|
|
133
|
-
* which this owns.
|
|
139
|
+
* `labelPlacement`, `disabledReason`, `commit`, `size`, `overflow` — minus the options
|
|
140
|
+
* and the value, which this owns.
|
|
141
|
+
*
|
|
142
|
+
* The options wrap rather than truncate (`overflow="wrap"`), as in its two siblings
|
|
143
|
+
* {@link TextSizeSetting} and {@link ContrastSetting} (0.32.1, Kurvenschmiede's 0.32
|
|
144
|
+
* report: "Syst… Li… D…" in a card at Extra large on a 360 px phone).
|
|
134
145
|
*
|
|
135
146
|
* Bind it to the PREFERENCE (`"system"` included), never to the resolved mode: on a
|
|
136
147
|
* system-dark device a control bound to the mode shows "dark" and cannot say "follow the
|
|
@@ -168,5 +179,43 @@ interface LanguageSettingProps extends Omit<SelectProps, "value" | "onChange" |
|
|
|
168
179
|
id?: string;
|
|
169
180
|
}
|
|
170
181
|
declare function LanguageSetting({ value, onChange, label, options, id, ...rest }: LanguageSettingProps): react.JSX.Element;
|
|
182
|
+
/**
|
|
183
|
+
* What {@link TextSizeSetting} and {@link ContrastSetting} take: a {@link ToggleGroup}'s
|
|
184
|
+
* props — `labelPlacement`, `disabledReason`, `commit`, `size`, `overflow` — minus the
|
|
185
|
+
* options and the value, which they own, as {@link ThemeSettingToggleProps} does.
|
|
186
|
+
*/
|
|
187
|
+
type AppearanceToggleProps<T extends string> = Omit<ToggleGroupBaseProps<T>, "options" | "label" | "ariaLabel"> & {
|
|
188
|
+
value: T;
|
|
189
|
+
onChange: (value: T) => void;
|
|
190
|
+
/**
|
|
191
|
+
* The field's visible label. Leave it out inside a row already titled with the
|
|
192
|
+
* setting's name: the group is then named by `aria-label` / `aria-labelledby` if
|
|
193
|
+
* given, else by the kit's own word ("Text size", "Contrast").
|
|
194
|
+
*/
|
|
195
|
+
label?: ReactNode;
|
|
196
|
+
/** The `appearance` namespace, for this instance. */
|
|
197
|
+
labels?: Partial<AppearanceLabels>;
|
|
198
|
+
};
|
|
199
|
+
type TextSizeSettingProps = AppearanceToggleProps<TextSize>;
|
|
200
|
+
/**
|
|
201
|
+
* The text size (0.32, docs/text-size-harmonization.md §6): Normal, Large, Extra large as
|
|
202
|
+
* one segmented control, in the core `appearance` group after the theme. Bind it to the
|
|
203
|
+
* size IN FORCE — `useAccountAppearance().textSize` — and hand a pick to its
|
|
204
|
+
* `pickTextSize`, which stores the device's choice and, signed in, the account's.
|
|
205
|
+
*
|
|
206
|
+
* The options wrap rather than truncate (`overflow="wrap"`): at Extra large on a 360 px
|
|
207
|
+
* phone the group has 240 px, and "Extra large" cut to "Extra l…" would be the one
|
|
208
|
+
* setting that cannot read its own value.
|
|
209
|
+
*/
|
|
210
|
+
declare function TextSizeSetting({ value, onChange, label, labels: labelsProp, overflow, ...rest }: TextSizeSettingProps): react.JSX.Element;
|
|
211
|
+
type ContrastSettingProps = AppearanceToggleProps<ContrastMode>;
|
|
212
|
+
/**
|
|
213
|
+
* More contrast (0.32, §5, §6): System, Standard, More as one segmented control, beside
|
|
214
|
+
* the text size. Bind it to the stored MODE, "system" included — never to whether more
|
|
215
|
+
* contrast is on at the moment, or a device that asks for more contrast would show
|
|
216
|
+
* "More" and could not say "follow the device" (the theme's lesson, §8 of the settings
|
|
217
|
+
* contract). `useAccountAppearance().contrast` is that mode.
|
|
218
|
+
*/
|
|
219
|
+
declare function ContrastSetting({ value, onChange, label, labels: labelsProp, overflow, ...rest }: ContrastSettingProps): react.JSX.Element;
|
|
171
220
|
|
|
172
|
-
export { LanguageSetting, type LanguageSettingProps, ThemeSetting, type ThemeSettingProps, type ThemeSettingToggleProps };
|
|
221
|
+
export { ContrastSetting, type ContrastSettingProps, LanguageSetting, type LanguageSettingProps, TextSizeSetting, type TextSizeSettingProps, ThemeSetting, type ThemeSettingProps, type ThemeSettingToggleProps };
|
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Select } from "./ui.js";
|
|
4
4
|
import { ToggleGroup } from "./toggle-group.js";
|
|
5
|
+
import { TEXT_SIZES } from "../theme/text-size.js";
|
|
6
|
+
import { CONTRAST_MODES } from "../theme/contrast.js";
|
|
7
|
+
import { useAppearanceLabels } from "./appearance-labels.js";
|
|
5
8
|
function ThemeSetting(props) {
|
|
6
9
|
if (props.variant === "toggle") {
|
|
7
|
-
const { variant: _variant2, value: value2, onChange: onChange2, label: label2, optionLabels: optionLabels2, ...rest2 } = props;
|
|
10
|
+
const { variant: _variant2, value: value2, onChange: onChange2, label: label2, optionLabels: optionLabels2, overflow = "wrap", ...rest2 } = props;
|
|
8
11
|
return /* @__PURE__ */ jsx(
|
|
9
12
|
ToggleGroup,
|
|
10
13
|
{
|
|
11
14
|
...rest2,
|
|
15
|
+
overflow,
|
|
12
16
|
label: label2,
|
|
13
17
|
value: value2,
|
|
14
18
|
onChange: onChange2,
|
|
@@ -40,8 +44,42 @@ function ThemeSetting(props) {
|
|
|
40
44
|
function LanguageSetting({ value, onChange, label, options, id, ...rest }) {
|
|
41
45
|
return /* @__PURE__ */ jsx(Select, { ...rest, id, label, value, onChange: (e) => onChange(e.target.value), children: options.map((o) => /* @__PURE__ */ jsx("option", { value: o.code, children: o.label }, o.code)) });
|
|
42
46
|
}
|
|
47
|
+
function TextSizeSetting({ value, onChange, label, labels: labelsProp, overflow = "wrap", ...rest }) {
|
|
48
|
+
const labels = useAppearanceLabels(labelsProp);
|
|
49
|
+
const named = label !== void 0 && label !== null && label !== false;
|
|
50
|
+
return /* @__PURE__ */ jsx(
|
|
51
|
+
ToggleGroup,
|
|
52
|
+
{
|
|
53
|
+
...rest,
|
|
54
|
+
"aria-label": named || rest["aria-labelledby"] ? rest["aria-label"] : rest["aria-label"] ?? labels.textSize,
|
|
55
|
+
label,
|
|
56
|
+
overflow,
|
|
57
|
+
value,
|
|
58
|
+
onChange,
|
|
59
|
+
options: TEXT_SIZES.map((size) => ({ value: size, label: labels.textSizes[size] }))
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function ContrastSetting({ value, onChange, label, labels: labelsProp, overflow = "wrap", ...rest }) {
|
|
64
|
+
const labels = useAppearanceLabels(labelsProp);
|
|
65
|
+
const named = label !== void 0 && label !== null && label !== false;
|
|
66
|
+
return /* @__PURE__ */ jsx(
|
|
67
|
+
ToggleGroup,
|
|
68
|
+
{
|
|
69
|
+
...rest,
|
|
70
|
+
"aria-label": named || rest["aria-labelledby"] ? rest["aria-label"] : rest["aria-label"] ?? labels.contrast,
|
|
71
|
+
label,
|
|
72
|
+
overflow,
|
|
73
|
+
value,
|
|
74
|
+
onChange,
|
|
75
|
+
options: CONTRAST_MODES.map((mode) => ({ value: mode, label: labels.contrastModes[mode] }))
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
43
79
|
export {
|
|
80
|
+
ContrastSetting,
|
|
44
81
|
LanguageSetting,
|
|
82
|
+
TextSizeSetting,
|
|
45
83
|
ThemeSetting
|
|
46
84
|
};
|
|
47
85
|
//# sourceMappingURL=settings-fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/settings-fields.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Select } from \"./ui\";\nimport type { SelectProps } from \"./ui\";\nimport { ToggleGroup } from \"./toggle-group\";\nimport type { ToggleGroupBaseProps } from \"./toggle-group\";\nimport type { ThemePreference } from \"../theme/theme-store\";\n\n/**\n * App-agnostic settings-field components (feedback #333): the language + theme\n * controls that every app's settings page needs, so they live in @hb/ui and the\n * app just supplies the current value, a change handler and translated labels.\n * The app owns WHERE these render (its own settings page) and any app-specific\n * fields around them.\n */\n\n/**\n * Everything a {@link Select} takes, minus the two this component owns: the value is a\n * {@link ThemePreference} rather than a string, and `onChange` hands over the preference\n * itself because no caller of this wants the event. The rest — `disabled`, `required`,\n * `invalid`, `error`, a `data-tour` anchor — passes straight through, which is what makes\n * this a settings FIELD rather than a fixed widget.\n */\nexport interface ThemeSettingProps\n extends Omit<SelectProps, \"value\" | \"onChange\" | \"children\"> {\n /** The `Select` (default). See {@link ThemeSettingToggleProps} for `\"toggle\"`. */\n variant?: \"select\";\n value: ThemePreference;\n onChange: (value: ThemePreference) => void;\n label: ReactNode;\n /** Translated option labels. */\n optionLabels: { system: string; light: string; dark: string };\n id?: string;\n}\n\n/**\n * `variant=\"toggle\"` (0.31.0, docs/settings-harmonization.md §2.8): the three choices as\n * one segmented control instead of a select — system, light and dark side by side, the\n * choice visible without opening anything, in every app (keksdose offered light and dark\n * only; its store already knew \"system\"). A {@link ToggleGroup}'s props pass through —\n * `labelPlacement`, `disabledReason`, `commit`, `size` — minus the options and the value,\n * which this owns.\n *\n * Bind it to the PREFERENCE (`\"system\"` included), never to the resolved mode: on a\n * system-dark device a control bound to the mode shows \"dark\" and cannot say \"follow the\n * system\" (keksdose's control, §8).\n */\nexport interface ThemeSettingToggleProps\n extends Omit<ToggleGroupBaseProps<ThemePreference>, \"options\" | \"label\" | \"ariaLabel\"> {\n variant: \"toggle\";\n value: ThemePreference;\n onChange: (value: ThemePreference) => void;\n /**\n * Names the group: the field's label, or the label above it (`labelPlacement`). Leave\n * it out inside a card already titled \"Theme\" and name the group with `aria-label` or\n * `aria-labelledby` instead, so the card does not say \"Theme\" twice.\n */\n label?: ReactNode;\n /** Translated option labels. */\n optionLabels: { system: string; light: string; dark: string };\n id?: string;\n}\n\nexport function ThemeSetting(props: ThemeSettingProps | ThemeSettingToggleProps) {\n if (props.variant === \"toggle\") {\n const { variant: _variant, value, onChange, label, optionLabels, ...rest } = props;\n return (\n <ToggleGroup<ThemePreference>\n {...rest}\n label={label}\n value={value}\n onChange={onChange}\n options={[\n { value: \"system\", label: optionLabels.system },\n { value: \"light\", label: optionLabels.light },\n { value: \"dark\", label: optionLabels.dark },\n ]}\n />\n );\n }\n const { variant: _variant, value, onChange, label, optionLabels, id, ...rest } = props;\n return (\n <Select\n {...rest}\n id={id}\n label={label}\n value={value}\n onChange={(e) => onChange(e.target.value as ThemePreference)}\n >\n <option value=\"system\">{optionLabels.system}</option>\n <option value=\"light\">{optionLabels.light}</option>\n <option value=\"dark\">{optionLabels.dark}</option>\n </Select>\n );\n}\n\n/** See {@link ThemeSettingProps}: a `Select`'s props with the value and the change\n * handler re-typed to the language CODE the caller stores. */\nexport interface LanguageSettingProps\n extends Omit<SelectProps, \"value\" | \"onChange\" | \"children\"> {\n value: string;\n onChange: (code: string) => void;\n label: ReactNode;\n options: { code: string; label: string }[];\n id?: string;\n}\n\nexport function LanguageSetting({ value, onChange, label, options, id, ...rest }: LanguageSettingProps) {\n return (\n <Select {...rest} id={id} label={label} value={value} onChange={(e) => onChange(e.target.value)}>\n {options.map((o) => (\n <option key={o.code} value={o.code}>\n {o.label}\n </option>\n ))}\n </Select>\n );\n}\n"],"mappings":";AAkEM,cAeF,YAfE;AAjEN,SAAS,cAAc;AAEvB,SAAS,mBAAmB;AA2DrB,SAAS,aAAa,OAAoD;AAC/E,MAAI,MAAM,YAAY,UAAU;AAC9B,UAAM,EAAE,SAASA,WAAU,OAAAC,QAAO,UAAAC,WAAU,OAAAC,QAAO,cAAAC,eAAc,GAAGC,MAAK,IAAI;AAC7E,WACE;AAAA,MAAC;AAAA;AAAA,QACE,GAAGA;AAAA,QACJ,OAAOF;AAAA,QACP,OAAOF;AAAA,QACP,UAAUC;AAAA,QACV,SAAS;AAAA,UACP,EAAE,OAAO,UAAU,OAAOE,cAAa,OAAO;AAAA,UAC9C,EAAE,OAAO,SAAS,OAAOA,cAAa,MAAM;AAAA,UAC5C,EAAE,OAAO,QAAQ,OAAOA,cAAa,KAAK;AAAA,QAC5C;AAAA;AAAA,IACF;AAAA,EAEJ;AACA,QAAM,EAAE,SAAS,UAAU,OAAO,UAAU,OAAO,cAAc,IAAI,GAAG,KAAK,IAAI;AACjF,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAwB;AAAA,MAE3D;AAAA,4BAAC,YAAO,OAAM,UAAU,uBAAa,QAAO;AAAA,QAC5C,oBAAC,YAAO,OAAM,SAAS,uBAAa,OAAM;AAAA,QAC1C,oBAAC,YAAO,OAAM,QAAQ,uBAAa,MAAK;AAAA;AAAA;AAAA,EAC1C;AAEJ;AAaO,SAAS,gBAAgB,EAAE,OAAO,UAAU,OAAO,SAAS,IAAI,GAAG,KAAK,GAAyB;AACtG,SACE,oBAAC,UAAQ,GAAG,MAAM,IAAQ,OAAc,OAAc,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK,GAC3F,kBAAQ,IAAI,CAAC,MACZ,oBAAC,YAAoB,OAAO,EAAE,MAC3B,YAAE,SADQ,EAAE,IAEf,CACD,GACH;AAEJ;","names":["_variant","value","onChange","label","optionLabels","rest"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/settings-fields.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Select } from \"./ui\";\nimport type { SelectProps } from \"./ui\";\nimport { ToggleGroup } from \"./toggle-group\";\nimport type { ToggleGroupBaseProps } from \"./toggle-group\";\nimport type { ThemePreference } from \"../theme/theme-store\";\nimport { TEXT_SIZES } from \"../theme/text-size\";\nimport type { TextSize } from \"../theme/text-size\";\nimport { CONTRAST_MODES } from \"../theme/contrast\";\nimport type { ContrastMode } from \"../theme/contrast\";\nimport { useAppearanceLabels } from \"./appearance-labels\";\nimport type { AppearanceLabels } from \"./appearance-labels\";\n\n/**\n * App-agnostic settings-field components (feedback #333): the language + theme\n * controls that every app's settings page needs — and, since 0.32, the text size and\n * the contrast (docs/text-size-harmonization.md §6), whose words are the kit's own\n * `appearance` namespace — so they live in @hb/ui and the app just supplies the\n * current value, a change handler and translated labels.\n * The app owns WHERE these render (its own settings page) and any app-specific\n * fields around them.\n */\n\n/**\n * Everything a {@link Select} takes, minus the two this component owns: the value is a\n * {@link ThemePreference} rather than a string, and `onChange` hands over the preference\n * itself because no caller of this wants the event. The rest — `disabled`, `required`,\n * `invalid`, `error`, a `data-tour` anchor — passes straight through, which is what makes\n * this a settings FIELD rather than a fixed widget.\n */\nexport interface ThemeSettingProps\n extends Omit<SelectProps, \"value\" | \"onChange\" | \"children\"> {\n /** The `Select` (default). See {@link ThemeSettingToggleProps} for `\"toggle\"`. */\n variant?: \"select\";\n value: ThemePreference;\n onChange: (value: ThemePreference) => void;\n label: ReactNode;\n /** Translated option labels. */\n optionLabels: { system: string; light: string; dark: string };\n id?: string;\n}\n\n/**\n * `variant=\"toggle\"` (0.31.0, docs/settings-harmonization.md §2.8): the three choices as\n * one segmented control instead of a select — system, light and dark side by side, the\n * choice visible without opening anything, in every app (keksdose offered light and dark\n * only; its store already knew \"system\"). A {@link ToggleGroup}'s props pass through —\n * `labelPlacement`, `disabledReason`, `commit`, `size`, `overflow` — minus the options\n * and the value, which this owns.\n *\n * The options wrap rather than truncate (`overflow=\"wrap\"`), as in its two siblings\n * {@link TextSizeSetting} and {@link ContrastSetting} (0.32.1, Kurvenschmiede's 0.32\n * report: \"Syst… Li… D…\" in a card at Extra large on a 360 px phone).\n *\n * Bind it to the PREFERENCE (`\"system\"` included), never to the resolved mode: on a\n * system-dark device a control bound to the mode shows \"dark\" and cannot say \"follow the\n * system\" (keksdose's control, §8).\n */\nexport interface ThemeSettingToggleProps\n extends Omit<ToggleGroupBaseProps<ThemePreference>, \"options\" | \"label\" | \"ariaLabel\"> {\n variant: \"toggle\";\n value: ThemePreference;\n onChange: (value: ThemePreference) => void;\n /**\n * Names the group: the field's label, or the label above it (`labelPlacement`). Leave\n * it out inside a card already titled \"Theme\" and name the group with `aria-label` or\n * `aria-labelledby` instead, so the card does not say \"Theme\" twice.\n */\n label?: ReactNode;\n /** Translated option labels. */\n optionLabels: { system: string; light: string; dark: string };\n id?: string;\n}\n\nexport function ThemeSetting(props: ThemeSettingProps | ThemeSettingToggleProps) {\n if (props.variant === \"toggle\") {\n const { variant: _variant, value, onChange, label, optionLabels, overflow = \"wrap\", ...rest } = props;\n return (\n <ToggleGroup<ThemePreference>\n {...rest}\n overflow={overflow}\n label={label}\n value={value}\n onChange={onChange}\n options={[\n { value: \"system\", label: optionLabels.system },\n { value: \"light\", label: optionLabels.light },\n { value: \"dark\", label: optionLabels.dark },\n ]}\n />\n );\n }\n const { variant: _variant, value, onChange, label, optionLabels, id, ...rest } = props;\n return (\n <Select\n {...rest}\n id={id}\n label={label}\n value={value}\n onChange={(e) => onChange(e.target.value as ThemePreference)}\n >\n <option value=\"system\">{optionLabels.system}</option>\n <option value=\"light\">{optionLabels.light}</option>\n <option value=\"dark\">{optionLabels.dark}</option>\n </Select>\n );\n}\n\n/** See {@link ThemeSettingProps}: a `Select`'s props with the value and the change\n * handler re-typed to the language CODE the caller stores. */\nexport interface LanguageSettingProps\n extends Omit<SelectProps, \"value\" | \"onChange\" | \"children\"> {\n value: string;\n onChange: (code: string) => void;\n label: ReactNode;\n options: { code: string; label: string }[];\n id?: string;\n}\n\nexport function LanguageSetting({ value, onChange, label, options, id, ...rest }: LanguageSettingProps) {\n return (\n <Select {...rest} id={id} label={label} value={value} onChange={(e) => onChange(e.target.value)}>\n {options.map((o) => (\n <option key={o.code} value={o.code}>\n {o.label}\n </option>\n ))}\n </Select>\n );\n}\n\n/**\n * What {@link TextSizeSetting} and {@link ContrastSetting} take: a {@link ToggleGroup}'s\n * props — `labelPlacement`, `disabledReason`, `commit`, `size`, `overflow` — minus the\n * options and the value, which they own, as {@link ThemeSettingToggleProps} does.\n */\ntype AppearanceToggleProps<T extends string> = Omit<ToggleGroupBaseProps<T>, \"options\" | \"label\" | \"ariaLabel\"> & {\n value: T;\n onChange: (value: T) => void;\n /**\n * The field's visible label. Leave it out inside a row already titled with the\n * setting's name: the group is then named by `aria-label` / `aria-labelledby` if\n * given, else by the kit's own word (\"Text size\", \"Contrast\").\n */\n label?: ReactNode;\n /** The `appearance` namespace, for this instance. */\n labels?: Partial<AppearanceLabels>;\n};\n\nexport type TextSizeSettingProps = AppearanceToggleProps<TextSize>;\n\n/**\n * The text size (0.32, docs/text-size-harmonization.md §6): Normal, Large, Extra large as\n * one segmented control, in the core `appearance` group after the theme. Bind it to the\n * size IN FORCE — `useAccountAppearance().textSize` — and hand a pick to its\n * `pickTextSize`, which stores the device's choice and, signed in, the account's.\n *\n * The options wrap rather than truncate (`overflow=\"wrap\"`): at Extra large on a 360 px\n * phone the group has 240 px, and \"Extra large\" cut to \"Extra l…\" would be the one\n * setting that cannot read its own value.\n */\nexport function TextSizeSetting({ value, onChange, label, labels: labelsProp, overflow = \"wrap\", ...rest }: TextSizeSettingProps) {\n const labels = useAppearanceLabels(labelsProp);\n const named = label !== undefined && label !== null && label !== false;\n return (\n <ToggleGroup<TextSize>\n {...rest}\n aria-label={named || rest[\"aria-labelledby\"] ? rest[\"aria-label\"] : (rest[\"aria-label\"] ?? labels.textSize)}\n label={label}\n overflow={overflow}\n value={value}\n onChange={onChange}\n options={TEXT_SIZES.map((size) => ({ value: size, label: labels.textSizes[size] }))}\n />\n );\n}\n\nexport type ContrastSettingProps = AppearanceToggleProps<ContrastMode>;\n\n/**\n * More contrast (0.32, §5, §6): System, Standard, More as one segmented control, beside\n * the text size. Bind it to the stored MODE, \"system\" included — never to whether more\n * contrast is on at the moment, or a device that asks for more contrast would show\n * \"More\" and could not say \"follow the device\" (the theme's lesson, §8 of the settings\n * contract). `useAccountAppearance().contrast` is that mode.\n */\nexport function ContrastSetting({ value, onChange, label, labels: labelsProp, overflow = \"wrap\", ...rest }: ContrastSettingProps) {\n const labels = useAppearanceLabels(labelsProp);\n const named = label !== undefined && label !== null && label !== false;\n return (\n <ToggleGroup<ContrastMode>\n {...rest}\n aria-label={named || rest[\"aria-labelledby\"] ? rest[\"aria-label\"] : (rest[\"aria-label\"] ?? labels.contrast)}\n label={label}\n overflow={overflow}\n value={value}\n onChange={onChange}\n options={CONTRAST_MODES.map((mode) => ({ value: mode, label: labels.contrastModes[mode] }))}\n />\n );\n}\n"],"mappings":";AA8EM,cAgBF,YAhBE;AA7EN,SAAS,cAAc;AAEvB,SAAS,mBAAmB;AAG5B,SAAS,kBAAkB;AAE3B,SAAS,sBAAsB;AAE/B,SAAS,2BAA2B;AAgE7B,SAAS,aAAa,OAAoD;AAC/E,MA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K,GAAyB;AAChI,QAAM,SAAS,oBAAoB,UAAU;AAC7C,QAAM,QAAQ,UAAU,UAAa,UAAU,QAAQ,UAAU;AACjE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,cAAY,SAAS,KAAK,iBAAiB,IAAI,KAAK,YAAY,IAAK,KAAK,YAAY,KAAK,OAAO;AAAA,MAClG;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,WAAW,IAAI,CAAC,UAAU,EAAE,OAAO,MAAM,OAAO,OAAO,UAAU,IAAI,EAAE,EAAE;AAAA;AAAA,EACpF;AAEJ;AAWO,SAAS,gBAAgB,EAAE,OAAO,UAAU,OAAO,QAAQ,YAAY,WAAW,QAAQ,GAAG,KAAK,GAAyB;AAChI,QAAM,SAAS,oBAAoB,UAAU;AAC7C,QAAM,QAAQ,UAAU,UAAa,UAAU,QAAQ,UAAU;AACjE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,cAAY,SAAS,KAAK,iBAAiB,IAAI,KAAK,YAAY,IAAK,KAAK,YAAY,KAAK,OAAO;AAAA,MAClG;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS,eAAe,IAAI,CAAC,UAAU,EAAE,OAAO,MAAM,OAAO,OAAO,cAAc,IAAI,EAAE,EAAE;AAAA;AAAA,EAC5F;AAEJ;","names":["_variant","value","onChange","label","optionLabels","rest"]}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import 'react';
|
|
2
2
|
import './account-chips.js';
|
|
3
3
|
import './dialog-frame.js';
|
|
4
|
-
export {
|
|
4
|
+
export { cP as DEFAULT_SHARE_CARD_LABELS, eZ as ShareAddRequest, e_ as ShareCandidate, e$ as ShareCard, f0 as ShareCardLabels, f1 as ShareCardProps, f2 as ShareDialog, f3 as ShareDialogProps, f4 as ShareGrantee, f5 as SharePanel, f6 as SharePanelProps, f7 as SharePendingGrant, f8 as ShareRole } from '../delete-account-setting-FLyJf-kZ.js';
|
|
5
5
|
import 'lucide-react';
|
|
6
6
|
import '../lib/format.js';
|
|
7
7
|
import './chip.js';
|
|
8
|
-
import '
|
|
8
|
+
import './field-parts.js';
|
|
9
|
+
import './tooltip.js';
|
|
10
|
+
import '../hooks/use-anchored-rect.js';
|
|
11
|
+
import '../lib/clipping.js';
|
|
12
|
+
import '../data-table-labels-kpAAVi6g.js';
|
|
9
13
|
import './data-table-sort.js';
|
|
10
14
|
import './swipeable-row.js';
|
|
11
15
|
import './modal.js';
|
|
12
16
|
import '../hooks/use-search-param-state.js';
|
|
13
|
-
import './tooltip.js';
|
|
14
|
-
import '../hooks/use-anchored-rect.js';
|
|
15
|
-
import '../lib/clipping.js';
|
|
16
17
|
import './mini-calendar.js';
|
|
17
18
|
import './calendar-heatmap.js';
|
|
18
19
|
import './popover.js';
|
|
20
|
+
import '../hooks/use-breakpoint.js';
|
|
19
21
|
import './field-sync.js';
|
|
20
22
|
import '../wizard/types.js';
|
|
21
23
|
import '../tour/tour.js';
|
|
@@ -79,6 +81,9 @@ import '../admin/admin-parts.js';
|
|
|
79
81
|
import '../admin/admin-action-log.js';
|
|
80
82
|
import '../settings/settings-labels.js';
|
|
81
83
|
import '../demo/demo-labels.js';
|
|
84
|
+
import './appearance-labels.js';
|
|
85
|
+
import '../theme/contrast.js';
|
|
86
|
+
import '../theme/text-size.js';
|
|
82
87
|
import './reauth-dialog.js';
|
|
83
88
|
import './server-wake.js';
|
|
84
89
|
import '../lib/server-wake.js';
|
|
@@ -92,4 +97,4 @@ import './sign-chip.js';
|
|
|
92
97
|
import './column-mapper.js';
|
|
93
98
|
import '../lib/column-mapping.js';
|
|
94
99
|
import '../lib/table-text.js';
|
|
95
|
-
import './
|
|
100
|
+
import './focus-ring.js';
|
|
@@ -46,6 +46,7 @@ function ShareRoleChip({ role }) {
|
|
|
46
46
|
const chip = /* @__PURE__ */ jsx(RoleChip, { value: role.key, roles: { [role.key]: role } });
|
|
47
47
|
return role.description ? /* @__PURE__ */ jsx(Tooltip, { label: role.description, children: chip }) : chip;
|
|
48
48
|
}
|
|
49
|
+
const ROW_CONTROLS = "ms-auto flex min-w-0 max-w-full flex-wrap items-center justify-end gap-1";
|
|
49
50
|
function LockedRoleChoice({ reason, children }) {
|
|
50
51
|
return reason === void 0 ? children : /* @__PURE__ */ jsx(Tooltip, { label: reason, children });
|
|
51
52
|
}
|
|
@@ -81,6 +82,7 @@ function SharePanel({
|
|
|
81
82
|
const roleOf = (key) => roles.find((r) => r.key === key);
|
|
82
83
|
const choosable = roles.length > 1;
|
|
83
84
|
const canAdd = !readOnly && onAdd !== void 0;
|
|
85
|
+
const rowReason = canAdd ? "tooltip" : "auto";
|
|
84
86
|
const run = async (key, action) => {
|
|
85
87
|
setBusy(key);
|
|
86
88
|
setFailure(null);
|
|
@@ -230,7 +232,7 @@ function SharePanel({
|
|
|
230
232
|
] }),
|
|
231
233
|
(g.kind === "team" || g.email) && /* @__PURE__ */ jsx("div", { "data-private": true, className: "truncate text-xs text-[var(--text-muted)]", children: g.kind === "team" ? labels.team : g.email })
|
|
232
234
|
] }),
|
|
233
|
-
(changeable || editable && onRemove) && /* @__PURE__ */ jsxs("div", { className:
|
|
235
|
+
(changeable || editable && onRemove) && /* @__PURE__ */ jsxs("div", { className: ROW_CONTROLS, children: [
|
|
234
236
|
changeable && /* @__PURE__ */ jsx(LockedRoleChoice, { reason: lock.locked ? lock.reason : void 0, children: /* @__PURE__ */ jsx(
|
|
235
237
|
ToggleGroup,
|
|
236
238
|
{
|
|
@@ -251,6 +253,8 @@ function SharePanel({
|
|
|
251
253
|
size: "xs",
|
|
252
254
|
commit: true,
|
|
253
255
|
label: labels.remove,
|
|
256
|
+
labelVisible: false,
|
|
257
|
+
disabledReasonDisplay: rowReason,
|
|
254
258
|
pending: busy === key,
|
|
255
259
|
disabled: busy !== null,
|
|
256
260
|
onClick: async () => {
|
|
@@ -290,7 +294,7 @@ function SharePanel({
|
|
|
290
294
|
/* @__PURE__ */ jsx(ShareRoleChip, { role: roleOf(p.role) })
|
|
291
295
|
] })
|
|
292
296
|
] }),
|
|
293
|
-
(p.link || !readOnly && onRevokePending) && /* @__PURE__ */ jsxs("div", { className:
|
|
297
|
+
(p.link || !readOnly && onRevokePending) && /* @__PURE__ */ jsxs("div", { className: ROW_CONTROLS, children: [
|
|
294
298
|
p.link && /* @__PURE__ */ jsx(CopyButton, { size: "xs", tone: "muted", text: p.link, label: labels.copyLink }),
|
|
295
299
|
!readOnly && onRevokePending && /* @__PURE__ */ jsx(
|
|
296
300
|
IconButton,
|
|
@@ -299,6 +303,8 @@ function SharePanel({
|
|
|
299
303
|
size: "xs",
|
|
300
304
|
commit: true,
|
|
301
305
|
label: labels.revokePending,
|
|
306
|
+
labelVisible: false,
|
|
307
|
+
disabledReasonDisplay: rowReason,
|
|
302
308
|
pending: busy === key,
|
|
303
309
|
disabled: busy !== null,
|
|
304
310
|
onClick: async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/share-card.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { Trash2, UserPlus, UsersRound } from \"lucide-react\";\n\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { AlertBanner } from \"./alert-banner\";\nimport { Autocomplete } from \"./autocomplete\";\nimport type { ComboOption } from \"./combobox-core\";\nimport { Chip } from \"./chip\";\nimport { RoleChip } from \"./account-chips\";\nimport type { RoleDefinition } from \"./account-chips\";\nimport { useConfirm } from \"./confirm-dialog\";\nimport { CopyButton } from \"./copy-button\";\nimport { DialogFrame } from \"./dialog-frame\";\nimport type { DialogFrameProps } from \"./dialog-frame\";\nimport { Caption, SectionLabel } from \"./text\";\nimport { ToggleGroup } from \"./toggle-group\";\nimport { Tooltip } from \"./tooltip\";\nimport { Button, Card, IconButton, Spinner } from \"./ui\";\nimport { useWriteLock } from \"./write-lock\";\nimport type { CardProps } from \"./ui\";\n\n/**\n * Who holds one record, and the owner's every way of changing that — Kurvenschmiede's\n * `features/sharing/share-dialog.tsx` and keksdose's `features/budgets/budget-share-card.tsx`,\n * which are the same component twice (Kurvenschmiede's own doc comment says so).\n *\n * Presentational: the kit draws the rows, asks before a removal (the kit's\n * {@link useConfirm}), keeps the field and the busy state, and checks only that an\n * address is SHAPED like one. Everything that is policy stays with the app — who may\n * share, whether an address has an account (that is what makes a grant pending), what\n * a role permits, every request — through the callbacks, which may return a promise.\n */\n\n// ── Labels ────────────────────────────────────────────────────────────────────\n\nexport interface ShareCardLabels {\n /** ShareDialog's heading. */\n dialogTitle: string;\n /** ShareDialog's close button. */\n close: string;\n /** The add field's label. */\n email: string;\n /** The add field's label when `addWithoutEmail` lets it stay empty. */\n emailOptional: string;\n emailPlaceholder: string;\n /** Under the field when what was typed is not an address. */\n invalidEmail: string;\n /** Accessible name of the role choice beside the field. */\n role: string;\n /** Accessible name of one grantee's role choice. */\n roleOf: (name: string) => string;\n /** The add button. */\n add: string;\n /** Heading over the list. */\n whoHasAccess: string;\n /** The list is empty. */\n nobodyYet: string;\n /** Chip on a grant whose address has no account yet. */\n pending: string;\n /** A pending grant with no address — a link anybody holding it can redeem. */\n openInvite: string;\n copyLink: string;\n /** A candidate that is a team (its sublabel, and the line under a team row). */\n team: string;\n /** Under the field while a team is the one named. */\n teamHint: (name: string) => string;\n /** The remove button on a grantee. */\n remove: string;\n removeConfirm: (name: string) => string;\n /** The remove button on a pending grant. */\n revokePending: string;\n revokePendingConfirm: (name: string) => string;\n /** A callback rejected and no `formatError` says better. */\n failed: string;\n /** Shown while `loading`. */\n loading: string;\n}\n\nexport const DEFAULT_SHARE_CARD_LABELS: ShareCardLabels = {\n dialogTitle: \"Share\",\n close: \"Close\",\n email: \"Email address\",\n emailOptional: \"Email address (optional)\",\n emailPlaceholder: \"name@example.com\",\n invalidEmail: \"Enter a complete email address.\",\n role: \"Role\",\n roleOf: (name) => `Role of ${name}`,\n add: \"Share\",\n whoHasAccess: \"Who has access\",\n nobodyYet: \"Nobody else has access yet.\",\n pending: \"Pending\",\n openInvite: \"Open invite link\",\n copyLink: \"Copy link\",\n team: \"Team\",\n teamHint: (name) => `Everyone in ${name} gets access.`,\n remove: \"Remove access\",\n removeConfirm: (name) => `Remove access for ${name}?`,\n revokePending: \"Withdraw invitation\",\n revokePendingConfirm: (name) => `Withdraw the invitation for ${name}?`,\n failed: \"That did not work. Please try again.\",\n loading: \"Loading…\",\n};\n\n// ── Data shapes ───────────────────────────────────────────────────────────────\n\n/**\n * One role of the app's vocabulary: Kurvenschmiede's viewer/editor, keksdose's guest.\n *\n * The admin roster's {@link RoleDefinition} (label, tone, icon) plus the key it is\n * filed under — an ARRAY here rather than the keyed `RoleVocabulary` record,\n * because the order is the order of the role choice's segments.\n */\nexport type ShareRole = RoleDefinition & {\n key: string;\n /** What the role allows — under the role choice once chosen, and the chip's tooltip. */\n description?: string;\n};\n\n/** Somebody (or a team) who holds the record now. */\nexport interface ShareGrantee {\n id: string | number;\n name: string;\n /** The second line. A team row says {@link ShareCardLabels.team} instead. */\n email?: string | null;\n /** A {@link ShareRole.key}. */\n role: string;\n /** `team`: the grant reaches everybody in it (Kurvenschmiede). Default `person`. */\n kind?: \"person\" | \"team\";\n /** Shown, but neither its role nor its access can be changed here (an owner row). */\n locked?: boolean;\n /** The app's own line under the row — keksdose's per-guest key delivery. */\n extra?: ReactNode;\n}\n\n/** A grant waiting for its address to have an account — or, with no address, an\n * open invite link (keksdose). */\nexport interface SharePendingGrant {\n id: string | number;\n email?: string | null;\n /** A {@link ShareRole.key}; left out when the app has only one role. */\n role?: string;\n /** The invite link, offered with a copy button. */\n link?: string;\n}\n\n/** A completion offered while typing: a past grantee, or one of the sharer's teams. */\nexport interface ShareCandidate {\n id: string | number;\n name: string;\n /** A person's address: taking the row fills the field with it, and the grant is\n * then an ordinary address grant. */\n email?: string | null;\n /** `team` (or a person with no address): taking the row names THIS candidate, and\n * `onAdd` receives it instead of an address. */\n kind?: \"person\" | \"team\";\n icon?: ReactNode;\n}\n\n/** What the add button asks for. Exactly one of `email` / `candidate` is set, except\n * under `addWithoutEmail`, where both may be null (an open invite). */\nexport interface ShareAddRequest {\n email: string | null;\n candidate: ShareCandidate | null;\n /** A {@link ShareRole.key}. */\n role: string;\n}\n\ntype MaybePromise = void | Promise<unknown>;\n\n// ── Props ─────────────────────────────────────────────────────────────────────\n\nexport interface SharePanelProps {\n grantees: ShareGrantee[];\n /** The role vocabulary, in display order. One role: no choice is offered and each\n * row shows its chip. */\n roles: ShareRole[];\n pending?: SharePendingGrant[];\n /** Completions for the field. Left out: the field is a plain address field. */\n candidates?: ShareCandidate[];\n /** The role a new grant starts with. Default: the first of `roles`. */\n defaultRole?: string;\n /** Resolve to clear the field; reject to keep it and show the error. Left out (or\n * `readOnly`): no add form. */\n onAdd?: (request: ShareAddRequest) => MaybePromise;\n /** Left out: roles are shown as chips. */\n onRoleChange?: (grantee: ShareGrantee, role: string) => MaybePromise;\n /** Called after the kit's confirm. Left out: no remove button. */\n onRemove?: (grantee: ShareGrantee) => MaybePromise;\n /** Called after the kit's confirm. Left out: no withdraw button. */\n onRevokePending?: (grant: SharePendingGrant) => MaybePromise;\n /** keksdose: an empty field is a request too — an invite link with no address. */\n addWithoutEmail?: boolean;\n /** Under the add field: whatever the app needs said there (Kurvenschmiede's \"your\n * pending grant does not let anybody register\"). A function receives the taken\n * candidate, so it can say something else while a team is named. */\n caption?: ReactNode | ((candidate: ShareCandidate | null) => ReactNode);\n /** Above everything — what sharing means here (keksdose's guest explanation). */\n intro?: ReactNode;\n /** The list is being fetched: a spinner instead of the rows. */\n loading?: boolean;\n /** The app's own error, shown in the error box (wins over a caught rejection). */\n error?: ReactNode;\n /** Turns a callback's rejection into words. Default {@link ShareCardLabels.failed}. */\n formatError?: (error: unknown) => ReactNode;\n /** Look, do not touch: no form, chips for roles, no remove buttons. Copying an\n * invite link still works. */\n readOnly?: boolean;\n /** Focus the field on mount — a dialog that exists to add somebody. */\n autoFocus?: boolean;\n labels?: Partial<ShareCardLabels>;\n}\n\n// Shape only. Whether the address exists, is allowed, or is the sharer's own is the\n// app's question — the field must never become a way to probe for accounts.\nconst EMAIL_SHAPE = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\n/** The kit's {@link RoleChip}, so a role looks the same here as in the admin roster,\n * with the role's description in a tooltip. */\nfunction ShareRoleChip({ role }: { role: ShareRole | undefined }) {\n if (!role) return null;\n const chip = <RoleChip value={role.key} roles={{ [role.key]: role }} />;\n return role.description ? <Tooltip label={role.description}>{chip}</Tooltip> : chip;\n}\n\n/**\n * A row's role choice saves on change, so it is a commit that cannot take `commit`:\n * under a write lock it is disabled, and the lock's reason is put in the kit Tooltip\n * around it — the same sentence the locked buttons beside it give.\n */\nfunction LockedRoleChoice({ reason, children }: { reason: ReactNode; children: ReactNode }) {\n return reason === undefined ? children : <Tooltip label={reason}>{children}</Tooltip>;\n}\n\n/**\n * The body both forms share: the add form, then the list. Exported for an app that\n * frames it itself (a settings section, a sheet).\n */\nexport function SharePanel({\n grantees,\n roles,\n pending = [],\n candidates,\n defaultRole,\n onAdd,\n onRoleChange,\n onRemove,\n onRevokePending,\n addWithoutEmail = false,\n caption,\n intro,\n loading = false,\n error,\n formatError,\n readOnly = false,\n autoFocus,\n labels: labelsProp,\n}: SharePanelProps) {\n // The `shareCard` namespace: prop > `<UiKitProvider labels>` > English.\n const labels = useKitLabels(\"shareCard\", DEFAULT_SHARE_CARD_LABELS, labelsProp);\n const confirm = useConfirm();\n // Every commit below opts into the surrounding WriteLockProvider with `commit`; the\n // role choices save on change, cannot take it, and read the lock themselves.\n const lock = useWriteLock();\n const [email, setEmail] = useState(\"\");\n // A candidate taken from the completion. Typing again lets it go: the field then\n // names an address again, and a chosen team beside free text would be two answers\n // to \"who\" (Kurvenschmiede's rule).\n const [target, setTarget] = useState<ShareCandidate | null>(null);\n const [newRole, setNewRole] = useState(defaultRole ?? roles[0]?.key ?? \"\");\n const [invalid, setInvalid] = useState(false);\n // One action at a time, for the whole panel: two in flight against one record's\n // grants can answer out of order. The key says which control draws the spinner.\n const [busy, setBusy] = useState<string | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n\n const roleOf = (key: string | undefined) => roles.find((r) => r.key === key);\n const choosable = roles.length > 1;\n const canAdd = !readOnly && onAdd !== undefined;\n\n const run = async (key: string, action: () => MaybePromise): Promise<boolean> => {\n setBusy(key);\n setFailure(null);\n try {\n await action();\n return true;\n } catch (caught) {\n setFailure(formatError ? formatError(caught) : labels.failed);\n return false;\n } finally {\n setBusy(null);\n }\n };\n\n const address = email.trim();\n const empty = !target && address === \"\";\n\n const submit = async () => {\n // Enter in the field is a commit too — the button's lock does not see it.\n if (!onAdd || busy || lock.locked) return;\n if (empty && !addWithoutEmail) return;\n if (!target && address !== \"\" && !EMAIL_SHAPE.test(address)) {\n setInvalid(true);\n return;\n }\n const request: ShareAddRequest = {\n email: target ? null : address || null,\n candidate: target,\n role: newRole,\n };\n if (await run(\"add\", () => onAdd(request))) {\n setEmail(\"\");\n setTarget(null);\n }\n };\n\n const options: ComboOption<string>[] = (candidates ?? []).map((c) => ({\n value: String(c.id),\n label: c.name,\n sublabel: c.kind === \"team\" ? labels.team : (c.email ?? undefined),\n icon: c.icon ?? (c.kind === \"team\" ? <UsersRound className=\"size-4\" /> : undefined),\n }));\n\n // The completion is a convenience, not a search: an address that matches nobody is\n // the ordinary case (somebody new), so no \"No results\" box opens over the field —\n // and over its error. The same narrowing Autocomplete applies, asked first.\n const needle = (target ? \"\" : email).trim().toLowerCase();\n const offers =\n needle !== \"\" &&\n options.some((o) => o.label.toLowerCase().includes(needle) || (o.sublabel ?? \"\").toLowerCase().includes(needle));\n\n const captionNode = typeof caption === \"function\" ? caption(target) : caption;\n const shownError = error ?? failure;\n const nobody = grantees.length === 0 && pending.length === 0;\n\n return (\n <div className=\"space-y-3\">\n {intro && <div className=\"text-xs text-[var(--text-muted)]\">{intro}</div>}\n\n {canAdd && (\n <div className=\"space-y-2\">\n <div\n className={cn(\n \"grid grid-cols-1 gap-2\",\n choosable && \"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start\",\n )}\n >\n <Autocomplete<string>\n label={addWithoutEmail ? labels.emailOptional : labels.email}\n placeholder={labels.emailPlaceholder}\n value={target ? target.name : email}\n options={options}\n open={offers ? undefined : false}\n fillOnSelect={false}\n // eslint-disable-next-line jsx-a11y/no-autofocus -- a documented prop the caller opts into (off by default); the field never takes focus on its own.\n autoFocus={autoFocus}\n inputMode=\"email\"\n autoComplete=\"off\"\n autoCapitalize=\"none\"\n spellCheck={false}\n disabled={busy !== null}\n error={invalid ? labels.invalidEmail : undefined}\n onChange={(text) => {\n setTarget(null);\n setInvalid(false);\n setFailure(null);\n setEmail(text);\n }}\n onSelect={(option) => {\n const chosen = (candidates ?? []).find((c) => String(c.id) === option.value);\n if (!chosen) return;\n setInvalid(false);\n if (chosen.kind !== \"team\" && chosen.email) {\n setTarget(null);\n setEmail(chosen.email);\n } else {\n setTarget(chosen);\n setEmail(\"\");\n }\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") void submit();\n }}\n />\n {choosable && (\n <ToggleGroup<string>\n aria-label={labels.role}\n options={roles.map((r) => ({ value: r.key, label: r.label }))}\n value={newRole}\n onChange={setNewRole}\n disabled={busy !== null}\n caption={\n roles.some((r) => r.description) ? (key: string) => roleOf(key)?.description : undefined\n }\n // Level with the floating field beside it, as the two apps do by hand.\n optionClassName=\"sm:min-h-10\"\n />\n )}\n </div>\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <div className=\"min-w-0 flex-1 basis-48 space-y-1\">\n {target?.kind === \"team\" && <Caption>{labels.teamHint(target.name)}</Caption>}\n {captionNode && <Caption as=\"div\">{captionNode}</Caption>}\n </div>\n <Button\n variant=\"brand\"\n commit\n pending={busy === \"add\"}\n disabled={busy !== null || (empty && !addWithoutEmail)}\n onClick={() => void submit()}\n className=\"ms-auto\"\n >\n <UserPlus className=\"size-4\" aria-hidden />\n {labels.add}\n </Button>\n </div>\n </div>\n )}\n\n {shownError && (\n <AlertBanner tone=\"danger\" size=\"sm\">\n {shownError}\n </AlertBanner>\n )}\n\n {loading ? (\n <div className=\"flex justify-center py-3\">\n <Spinner label={labels.loading} />\n </div>\n ) : (\n <div className=\"space-y-2\">\n <SectionLabel as=\"h4\">{labels.whoHasAccess}</SectionLabel>\n {nobody && <Caption>{labels.nobodyYet}</Caption>}\n <ul className=\"divide-y divide-[var(--border)]\">\n {grantees.map((g) => {\n const editable = !readOnly && !g.locked;\n const changeable = editable && onRoleChange !== undefined && choosable;\n const key = `grantee:${g.id}`;\n return (\n <li key={key} className=\"space-y-1.5 py-2 first:pt-0 last:pb-0\">\n {/* Wraps rather than squeezes: on a phone the controls drop under\n the name, full row, instead of truncating it to a letter. */}\n <div className=\"flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5\">\n <div className=\"min-w-0 flex-1 basis-40\">\n <div className=\"flex min-w-0 items-center gap-1.5 text-sm font-medium text-[var(--text-primary)]\">\n {g.kind === \"team\" && <UsersRound className=\"size-4 shrink-0\" aria-hidden />}\n <span data-private className=\"truncate\">\n {g.name}\n </span>\n {!changeable && <ShareRoleChip role={roleOf(g.role)} />}\n </div>\n {(g.kind === \"team\" || g.email) && (\n <div data-private className=\"truncate text-xs text-[var(--text-muted)]\">\n {g.kind === \"team\" ? labels.team : g.email}\n </div>\n )}\n </div>\n {(changeable || (editable && onRemove)) && (\n <div className=\"ms-auto flex shrink-0 items-center gap-1\">\n {changeable && (\n <LockedRoleChoice reason={lock.locked ? lock.reason : undefined}>\n <ToggleGroup<string>\n size=\"sm\"\n aria-label={labels.roleOf(g.name)}\n options={roles.map((r) => ({ value: r.key, label: r.label }))}\n value={g.role}\n disabled={busy !== null || lock.locked}\n onChange={(next) => {\n if (next !== g.role) void run(`role:${g.id}`, () => onRoleChange(g, next));\n }}\n />\n </LockedRoleChoice>\n )}\n {editable && onRemove && (\n <IconButton\n tone=\"danger\"\n size=\"xs\"\n commit\n label={labels.remove}\n pending={busy === key}\n disabled={busy !== null}\n onClick={async () => {\n const yes = await confirm({\n title: labels.removeConfirm(g.name),\n confirmLabel: labels.remove,\n tone: \"danger\",\n });\n if (yes) await run(key, () => onRemove(g));\n }}\n >\n <Trash2 />\n </IconButton>\n )}\n </div>\n )}\n </div>\n {g.extra}\n </li>\n );\n })}\n {pending.map((p) => {\n const key = `pending:${p.id}`;\n const name = p.email || labels.openInvite;\n return (\n <li key={key} className=\"py-2 first:pt-0 last:pb-0\">\n <div className=\"flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5\">\n <div className=\"min-w-0 flex-1 basis-40\">\n <div\n data-private={p.email ? true : undefined}\n className={cn(\n \"truncate text-sm\",\n p.email ? \"text-[var(--text-primary)]\" : \"text-[var(--text-muted)]\",\n )}\n >\n {name}\n </div>\n <div className=\"mt-0.5 flex flex-wrap items-center gap-1\">\n <Chip size=\"sm\" shape=\"square\" tone=\"warning\" caps>\n {labels.pending}\n </Chip>\n <ShareRoleChip role={roleOf(p.role)} />\n </div>\n </div>\n {(p.link || (!readOnly && onRevokePending)) && (\n <div className=\"ms-auto flex shrink-0 items-center gap-1\">\n {p.link && <CopyButton size=\"xs\" tone=\"muted\" text={p.link} label={labels.copyLink} />}\n {!readOnly && onRevokePending && (\n <IconButton\n tone=\"danger\"\n size=\"xs\"\n commit\n label={labels.revokePending}\n pending={busy === key}\n disabled={busy !== null}\n onClick={async () => {\n const yes = await confirm({\n title: labels.revokePendingConfirm(name),\n confirmLabel: labels.revokePending,\n tone: \"danger\",\n });\n if (yes) await run(key, () => onRevokePending(p));\n }}\n >\n <Trash2 />\n </IconButton>\n )}\n </div>\n )}\n </div>\n </li>\n );\n })}\n </ul>\n </div>\n )}\n </div>\n );\n}\n\n// ── The two frames ────────────────────────────────────────────────────────────\n\nexport interface ShareCardProps extends SharePanelProps {\n /** A heading over the card. */\n title?: ReactNode;\n /** The Card's variant. Default `outline` — a block inside a section, as keksdose's\n * card under a budget row is. */\n variant?: CardProps[\"variant\"];\n className?: string;\n}\n\n/** {@link SharePanel} in a card — keksdose's inline form, under the row it shares. */\nexport function ShareCard({ title, variant = \"outline\", className, ...panel }: ShareCardProps) {\n return (\n <Card variant={variant} padding=\"sm\" className={cn(\"space-y-3\", className)}>\n {title && <h3 className=\"text-sm font-semibold text-[var(--text-primary)]\">{title}</h3>}\n <SharePanel {...panel} />\n </Card>\n );\n}\n\nexport interface ShareDialogProps\n extends SharePanelProps,\n Pick<DialogFrameProps, \"open\" | \"onClose\" | \"size\" | \"className\"> {\n /** The heading. Default {@link ShareCardLabels.dialogTitle}. */\n title?: ReactNode;\n /** Under the heading — what is being shared (Kurvenschmiede passes its name). */\n description?: ReactNode;\n}\n\n/**\n * {@link SharePanel} in the kit's {@link DialogFrame} with a Close button —\n * Kurvenschmiede's form. Sharing commits as it goes, so there is nothing to save or\n * cancel: Close is the only action.\n */\nexport function ShareDialog({ open, onClose, size, className, title, description, ...panel }: ShareDialogProps) {\n const labels = useKitLabels(\"shareCard\", DEFAULT_SHARE_CARD_LABELS, panel.labels);\n return (\n <DialogFrame\n open={open}\n onClose={onClose}\n size={size}\n className={className}\n title={title ?? labels.dialogTitle}\n description={description}\n actions={(close) => (\n <Button variant=\"secondary\" onClick={close}>\n {labels.close}\n </Button>\n )}\n >\n <SharePanel {...panel} />\n </DialogFrame>\n );\n}\n"],"mappings":";AA8Ne,cAwHL,YAxHK;AA9Nf,SAAS,gBAAgB;AAEzB,SAAS,QAAQ,UAAU,kBAAkB;AAE7C,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAE7B,SAAS,YAAY;AACrB,SAAS,gBAAgB;AAEzB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAE5B,SAAS,SAAS,oBAAoB;AACtC,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,QAAQ,MAAM,YAAY,eAAe;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,GAAG,OAAO;AAAA,KACzB;AAEJ;AAgBO,SAAS,YAAY,EAAE,MAAM,SAAS,MAAM,WAAW,OAAO,aAAa,GAAG,MAAM,GAAqB;AAC9G,QAAM,SAAS,aAAa,aAAa,2BAA2B,MAAM,MAAM;AAChF,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO,SAAS,OAAO;AAAA,MACvB;AAAA,MACA,SAAS,CAAC,UACR,oBAAC,UAAO,SAAQ,aAAY,SAAS,OAClC,iBAAO,OACV;AAAA,MAGF,8BAAC,cAAY,GAAG,OAAO;AAAA;AAAA,EACzB;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/share-card.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { Trash2, UserPlus, UsersRound } from \"lucide-react\";\n\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { cn } from \"../lib/cn\";\nimport { AlertBanner } from \"./alert-banner\";\nimport { Autocomplete } from \"./autocomplete\";\nimport type { ComboOption } from \"./combobox-core\";\nimport { Chip } from \"./chip\";\nimport { RoleChip } from \"./account-chips\";\nimport type { RoleDefinition } from \"./account-chips\";\nimport { useConfirm } from \"./confirm-dialog\";\nimport { CopyButton } from \"./copy-button\";\nimport { DialogFrame } from \"./dialog-frame\";\nimport type { DialogFrameProps } from \"./dialog-frame\";\nimport { Caption, SectionLabel } from \"./text\";\nimport { ToggleGroup } from \"./toggle-group\";\nimport { Tooltip } from \"./tooltip\";\nimport { Button, Card, IconButton, Spinner } from \"./ui\";\nimport { useWriteLock } from \"./write-lock\";\nimport type { CardProps } from \"./ui\";\nimport type { DisabledReasonDisplay } from \"./field-parts\";\n\n/**\n * Who holds one record, and the owner's every way of changing that — Kurvenschmiede's\n * `features/sharing/share-dialog.tsx` and keksdose's `features/budgets/budget-share-card.tsx`,\n * which are the same component twice (Kurvenschmiede's own doc comment says so).\n *\n * Presentational: the kit draws the rows, asks before a removal (the kit's\n * {@link useConfirm}), keeps the field and the busy state, and checks only that an\n * address is SHAPED like one. Everything that is policy stays with the app — who may\n * share, whether an address has an account (that is what makes a grant pending), what\n * a role permits, every request — through the callbacks, which may return a promise.\n */\n\n// ── Labels ────────────────────────────────────────────────────────────────────\n\nexport interface ShareCardLabels {\n /** ShareDialog's heading. */\n dialogTitle: string;\n /** ShareDialog's close button. */\n close: string;\n /** The add field's label. */\n email: string;\n /** The add field's label when `addWithoutEmail` lets it stay empty. */\n emailOptional: string;\n emailPlaceholder: string;\n /** Under the field when what was typed is not an address. */\n invalidEmail: string;\n /** Accessible name of the role choice beside the field. */\n role: string;\n /** Accessible name of one grantee's role choice. */\n roleOf: (name: string) => string;\n /** The add button. */\n add: string;\n /** Heading over the list. */\n whoHasAccess: string;\n /** The list is empty. */\n nobodyYet: string;\n /** Chip on a grant whose address has no account yet. */\n pending: string;\n /** A pending grant with no address — a link anybody holding it can redeem. */\n openInvite: string;\n copyLink: string;\n /** A candidate that is a team (its sublabel, and the line under a team row). */\n team: string;\n /** Under the field while a team is the one named. */\n teamHint: (name: string) => string;\n /** The remove button on a grantee. */\n remove: string;\n removeConfirm: (name: string) => string;\n /** The remove button on a pending grant. */\n revokePending: string;\n revokePendingConfirm: (name: string) => string;\n /** A callback rejected and no `formatError` says better. */\n failed: string;\n /** Shown while `loading`. */\n loading: string;\n}\n\nexport const DEFAULT_SHARE_CARD_LABELS: ShareCardLabels = {\n dialogTitle: \"Share\",\n close: \"Close\",\n email: \"Email address\",\n emailOptional: \"Email address (optional)\",\n emailPlaceholder: \"name@example.com\",\n invalidEmail: \"Enter a complete email address.\",\n role: \"Role\",\n roleOf: (name) => `Role of ${name}`,\n add: \"Share\",\n whoHasAccess: \"Who has access\",\n nobodyYet: \"Nobody else has access yet.\",\n pending: \"Pending\",\n openInvite: \"Open invite link\",\n copyLink: \"Copy link\",\n team: \"Team\",\n teamHint: (name) => `Everyone in ${name} gets access.`,\n remove: \"Remove access\",\n removeConfirm: (name) => `Remove access for ${name}?`,\n revokePending: \"Withdraw invitation\",\n revokePendingConfirm: (name) => `Withdraw the invitation for ${name}?`,\n failed: \"That did not work. Please try again.\",\n loading: \"Loading…\",\n};\n\n// ── Data shapes ───────────────────────────────────────────────────────────────\n\n/**\n * One role of the app's vocabulary: Kurvenschmiede's viewer/editor, keksdose's guest.\n *\n * The admin roster's {@link RoleDefinition} (label, tone, icon) plus the key it is\n * filed under — an ARRAY here rather than the keyed `RoleVocabulary` record,\n * because the order is the order of the role choice's segments.\n */\nexport type ShareRole = RoleDefinition & {\n key: string;\n /** What the role allows — under the role choice once chosen, and the chip's tooltip. */\n description?: string;\n};\n\n/** Somebody (or a team) who holds the record now. */\nexport interface ShareGrantee {\n id: string | number;\n name: string;\n /** The second line. A team row says {@link ShareCardLabels.team} instead. */\n email?: string | null;\n /** A {@link ShareRole.key}. */\n role: string;\n /** `team`: the grant reaches everybody in it (Kurvenschmiede). Default `person`. */\n kind?: \"person\" | \"team\";\n /** Shown, but neither its role nor its access can be changed here (an owner row). */\n locked?: boolean;\n /** The app's own line under the row — keksdose's per-guest key delivery. */\n extra?: ReactNode;\n}\n\n/** A grant waiting for its address to have an account — or, with no address, an\n * open invite link (keksdose). */\nexport interface SharePendingGrant {\n id: string | number;\n email?: string | null;\n /** A {@link ShareRole.key}; left out when the app has only one role. */\n role?: string;\n /** The invite link, offered with a copy button. */\n link?: string;\n}\n\n/** A completion offered while typing: a past grantee, or one of the sharer's teams. */\nexport interface ShareCandidate {\n id: string | number;\n name: string;\n /** A person's address: taking the row fills the field with it, and the grant is\n * then an ordinary address grant. */\n email?: string | null;\n /** `team` (or a person with no address): taking the row names THIS candidate, and\n * `onAdd` receives it instead of an address. */\n kind?: \"person\" | \"team\";\n icon?: ReactNode;\n}\n\n/** What the add button asks for. Exactly one of `email` / `candidate` is set, except\n * under `addWithoutEmail`, where both may be null (an open invite). */\nexport interface ShareAddRequest {\n email: string | null;\n candidate: ShareCandidate | null;\n /** A {@link ShareRole.key}. */\n role: string;\n}\n\ntype MaybePromise = void | Promise<unknown>;\n\n// ── Props ─────────────────────────────────────────────────────────────────────\n\nexport interface SharePanelProps {\n grantees: ShareGrantee[];\n /** The role vocabulary, in display order. One role: no choice is offered and each\n * row shows its chip. */\n roles: ShareRole[];\n pending?: SharePendingGrant[];\n /** Completions for the field. Left out: the field is a plain address field. */\n candidates?: ShareCandidate[];\n /** The role a new grant starts with. Default: the first of `roles`. */\n defaultRole?: string;\n /** Resolve to clear the field; reject to keep it and show the error. Left out (or\n * `readOnly`): no add form. */\n onAdd?: (request: ShareAddRequest) => MaybePromise;\n /** Left out: roles are shown as chips. */\n onRoleChange?: (grantee: ShareGrantee, role: string) => MaybePromise;\n /** Called after the kit's confirm. Left out: no remove button. */\n onRemove?: (grantee: ShareGrantee) => MaybePromise;\n /** Called after the kit's confirm. Left out: no withdraw button. */\n onRevokePending?: (grant: SharePendingGrant) => MaybePromise;\n /** keksdose: an empty field is a request too — an invite link with no address. */\n addWithoutEmail?: boolean;\n /** Under the add field: whatever the app needs said there (Kurvenschmiede's \"your\n * pending grant does not let anybody register\"). A function receives the taken\n * candidate, so it can say something else while a team is named. */\n caption?: ReactNode | ((candidate: ShareCandidate | null) => ReactNode);\n /** Above everything — what sharing means here (keksdose's guest explanation). */\n intro?: ReactNode;\n /** The list is being fetched: a spinner instead of the rows. */\n loading?: boolean;\n /** The app's own error, shown in the error box (wins over a caught rejection). */\n error?: ReactNode;\n /** Turns a callback's rejection into words. Default {@link ShareCardLabels.failed}. */\n formatError?: (error: unknown) => ReactNode;\n /** Look, do not touch: no form, chips for roles, no remove buttons. Copying an\n * invite link still works. */\n readOnly?: boolean;\n /** Focus the field on mount — a dialog that exists to add somebody. */\n autoFocus?: boolean;\n labels?: Partial<ShareCardLabels>;\n}\n\n// Shape only. Whether the address exists, is allowed, or is the sharer's own is the\n// app's question — the field must never become a way to probe for accounts.\nconst EMAIL_SHAPE = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\n/** The kit's {@link RoleChip}, so a role looks the same here as in the admin roster,\n * with the role's description in a tooltip. */\nfunction ShareRoleChip({ role }: { role: ShareRole | undefined }) {\n if (!role) return null;\n const chip = <RoleChip value={role.key} roles={{ [role.key]: role }} />;\n return role.description ? <Tooltip label={role.description}>{chip}</Tooltip> : chip;\n}\n\n/**\n * A row's controls: the role toggle and the remove icon, or a pending grant's copy and\n * revoke. Held to the row and wrapping inside it (0.32.1, the 360 px Extra-large sweep;\n * docs/text-size-harmonization.md §4 \"nothing overflows\"): under a write lock on a touch\n * screen or at Large the remove icon gives its reason as a line under it, up to 20rem\n * wide, and a `shrink-0` box ran 31 px past a 390 px phone at Normal and 269 px past a\n * 360 px one at Extra large. Where the controls fit in one row, nothing changes.\n */\nconst ROW_CONTROLS = \"ms-auto flex min-w-0 max-w-full flex-wrap items-center justify-end gap-1\";\n\n/**\n * A row's role choice saves on change, so it is a commit that cannot take `commit`:\n * under a write lock it is disabled, and the lock's reason is put in the kit Tooltip\n * around it — the same sentence the locked buttons beside it give.\n */\nfunction LockedRoleChoice({ reason, children }: { reason: ReactNode; children: ReactNode }) {\n return reason === undefined ? children : <Tooltip label={reason}>{children}</Tooltip>;\n}\n\n/**\n * The body both forms share: the add form, then the list. Exported for an app that\n * frames it itself (a settings section, a sheet).\n */\nexport function SharePanel({\n grantees,\n roles,\n pending = [],\n candidates,\n defaultRole,\n onAdd,\n onRoleChange,\n onRemove,\n onRevokePending,\n addWithoutEmail = false,\n caption,\n intro,\n loading = false,\n error,\n formatError,\n readOnly = false,\n autoFocus,\n labels: labelsProp,\n}: SharePanelProps) {\n // The `shareCard` namespace: prop > `<UiKitProvider labels>` > English.\n const labels = useKitLabels(\"shareCard\", DEFAULT_SHARE_CARD_LABELS, labelsProp);\n const confirm = useConfirm();\n // Every commit below opts into the surrounding WriteLockProvider with `commit`; the\n // role choices save on change, cannot take it, and read the lock themselves.\n const lock = useWriteLock();\n const [email, setEmail] = useState(\"\");\n // A candidate taken from the completion. Typing again lets it go: the field then\n // names an address again, and a chosen team beside free text would be two answers\n // to \"who\" (Kurvenschmiede's rule).\n const [target, setTarget] = useState<ShareCandidate | null>(null);\n const [newRole, setNewRole] = useState(defaultRole ?? roles[0]?.key ?? \"\");\n const [invalid, setInvalid] = useState(false);\n // One action at a time, for the whole panel: two in flight against one record's\n // grants can answer out of order. The key says which control draws the spinner.\n const [busy, setBusy] = useState<string | null>(null);\n const [failure, setFailure] = useState<ReactNode>(null);\n\n const roleOf = (key: string | undefined) => roles.find((r) => r.key === key);\n const choosable = roles.length > 1;\n const canAdd = !readOnly && onAdd !== undefined;\n // Under a write lock the form's Share button gives the lock's sentence as a line (on\n // touch and at Large). A row's remove or revoke icon then keeps it in its tooltip, as\n // the role toggle beside it does, rather than repeat the same line under every row\n // (0.32.1, the 360 px Extra-large sweep). Without the form the rows' lines are the\n // only place it is said, so they stay — and ROW_CONTROLS wraps them.\n const rowReason: DisabledReasonDisplay = canAdd ? \"tooltip\" : \"auto\";\n\n const run = async (key: string, action: () => MaybePromise): Promise<boolean> => {\n setBusy(key);\n setFailure(null);\n try {\n await action();\n return true;\n } catch (caught) {\n setFailure(formatError ? formatError(caught) : labels.failed);\n return false;\n } finally {\n setBusy(null);\n }\n };\n\n const address = email.trim();\n const empty = !target && address === \"\";\n\n const submit = async () => {\n // Enter in the field is a commit too — the button's lock does not see it.\n if (!onAdd || busy || lock.locked) return;\n if (empty && !addWithoutEmail) return;\n if (!target && address !== \"\" && !EMAIL_SHAPE.test(address)) {\n setInvalid(true);\n return;\n }\n const request: ShareAddRequest = {\n email: target ? null : address || null,\n candidate: target,\n role: newRole,\n };\n if (await run(\"add\", () => onAdd(request))) {\n setEmail(\"\");\n setTarget(null);\n }\n };\n\n const options: ComboOption<string>[] = (candidates ?? []).map((c) => ({\n value: String(c.id),\n label: c.name,\n sublabel: c.kind === \"team\" ? labels.team : (c.email ?? undefined),\n icon: c.icon ?? (c.kind === \"team\" ? <UsersRound className=\"size-4\" /> : undefined),\n }));\n\n // The completion is a convenience, not a search: an address that matches nobody is\n // the ordinary case (somebody new), so no \"No results\" box opens over the field —\n // and over its error. The same narrowing Autocomplete applies, asked first.\n const needle = (target ? \"\" : email).trim().toLowerCase();\n const offers =\n needle !== \"\" &&\n options.some((o) => o.label.toLowerCase().includes(needle) || (o.sublabel ?? \"\").toLowerCase().includes(needle));\n\n const captionNode = typeof caption === \"function\" ? caption(target) : caption;\n const shownError = error ?? failure;\n const nobody = grantees.length === 0 && pending.length === 0;\n\n return (\n <div className=\"space-y-3\">\n {intro && <div className=\"text-xs text-[var(--text-muted)]\">{intro}</div>}\n\n {canAdd && (\n <div className=\"space-y-2\">\n <div\n className={cn(\n \"grid grid-cols-1 gap-2\",\n choosable && \"sm:grid-cols-[minmax(0,1fr)_auto] sm:items-start\",\n )}\n >\n <Autocomplete<string>\n label={addWithoutEmail ? labels.emailOptional : labels.email}\n placeholder={labels.emailPlaceholder}\n value={target ? target.name : email}\n options={options}\n open={offers ? undefined : false}\n fillOnSelect={false}\n // eslint-disable-next-line jsx-a11y/no-autofocus -- a documented prop the caller opts into (off by default); the field never takes focus on its own.\n autoFocus={autoFocus}\n inputMode=\"email\"\n autoComplete=\"off\"\n autoCapitalize=\"none\"\n spellCheck={false}\n disabled={busy !== null}\n error={invalid ? labels.invalidEmail : undefined}\n onChange={(text) => {\n setTarget(null);\n setInvalid(false);\n setFailure(null);\n setEmail(text);\n }}\n onSelect={(option) => {\n const chosen = (candidates ?? []).find((c) => String(c.id) === option.value);\n if (!chosen) return;\n setInvalid(false);\n if (chosen.kind !== \"team\" && chosen.email) {\n setTarget(null);\n setEmail(chosen.email);\n } else {\n setTarget(chosen);\n setEmail(\"\");\n }\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") void submit();\n }}\n />\n {choosable && (\n <ToggleGroup<string>\n aria-label={labels.role}\n options={roles.map((r) => ({ value: r.key, label: r.label }))}\n value={newRole}\n onChange={setNewRole}\n disabled={busy !== null}\n caption={\n roles.some((r) => r.description) ? (key: string) => roleOf(key)?.description : undefined\n }\n // Level with the floating field beside it, as the two apps do by hand.\n optionClassName=\"sm:min-h-10\"\n />\n )}\n </div>\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <div className=\"min-w-0 flex-1 basis-48 space-y-1\">\n {target?.kind === \"team\" && <Caption>{labels.teamHint(target.name)}</Caption>}\n {captionNode && <Caption as=\"div\">{captionNode}</Caption>}\n </div>\n <Button\n variant=\"brand\"\n commit\n pending={busy === \"add\"}\n disabled={busy !== null || (empty && !addWithoutEmail)}\n onClick={() => void submit()}\n className=\"ms-auto\"\n >\n <UserPlus className=\"size-4\" aria-hidden />\n {labels.add}\n </Button>\n </div>\n </div>\n )}\n\n {shownError && (\n <AlertBanner tone=\"danger\" size=\"sm\">\n {shownError}\n </AlertBanner>\n )}\n\n {loading ? (\n <div className=\"flex justify-center py-3\">\n <Spinner label={labels.loading} />\n </div>\n ) : (\n <div className=\"space-y-2\">\n <SectionLabel as=\"h4\">{labels.whoHasAccess}</SectionLabel>\n {nobody && <Caption>{labels.nobodyYet}</Caption>}\n <ul className=\"divide-y divide-[var(--border)]\">\n {grantees.map((g) => {\n const editable = !readOnly && !g.locked;\n const changeable = editable && onRoleChange !== undefined && choosable;\n const key = `grantee:${g.id}`;\n return (\n <li key={key} className=\"space-y-1.5 py-2 first:pt-0 last:pb-0\">\n {/* Wraps rather than squeezes: on a phone the controls drop under\n the name, full row, instead of truncating it to a letter. */}\n <div className=\"flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5\">\n <div className=\"min-w-0 flex-1 basis-40\">\n <div className=\"flex min-w-0 items-center gap-1.5 text-sm font-medium text-[var(--text-primary)]\">\n {g.kind === \"team\" && <UsersRound className=\"size-4 shrink-0\" aria-hidden />}\n <span data-private className=\"truncate\">\n {g.name}\n </span>\n {!changeable && <ShareRoleChip role={roleOf(g.role)} />}\n </div>\n {(g.kind === \"team\" || g.email) && (\n <div data-private className=\"truncate text-xs text-[var(--text-muted)]\">\n {g.kind === \"team\" ? labels.team : g.email}\n </div>\n )}\n </div>\n {(changeable || (editable && onRemove)) && (\n <div className={ROW_CONTROLS}>\n {changeable && (\n <LockedRoleChoice reason={lock.locked ? lock.reason : undefined}>\n <ToggleGroup<string>\n size=\"sm\"\n aria-label={labels.roleOf(g.name)}\n options={roles.map((r) => ({ value: r.key, label: r.label }))}\n value={g.role}\n disabled={busy !== null || lock.locked}\n onChange={(next) => {\n if (next !== g.role) void run(`role:${g.id}`, () => onRoleChange(g, next));\n }}\n />\n </LockedRoleChoice>\n )}\n {editable && onRemove && (\n <IconButton\n tone=\"danger\"\n size=\"xs\"\n commit\n label={labels.remove}\n // The icon alone at every text size (§10.8): the row's one\n // control beside its role toggle, where \"Remove access\" as\n // text at Large would not fit a 240 px row. It carries a\n // spinner and the write lock, which a \"⋯\" menu entry\n // cannot, and its confirmation names the action in words.\n labelVisible={false}\n disabledReasonDisplay={rowReason}\n pending={busy === key}\n disabled={busy !== null}\n onClick={async () => {\n const yes = await confirm({\n title: labels.removeConfirm(g.name),\n confirmLabel: labels.remove,\n tone: \"danger\",\n });\n if (yes) await run(key, () => onRemove(g));\n }}\n >\n <Trash2 />\n </IconButton>\n )}\n </div>\n )}\n </div>\n {g.extra}\n </li>\n );\n })}\n {pending.map((p) => {\n const key = `pending:${p.id}`;\n const name = p.email || labels.openInvite;\n return (\n <li key={key} className=\"py-2 first:pt-0 last:pb-0\">\n <div className=\"flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5\">\n <div className=\"min-w-0 flex-1 basis-40\">\n <div\n data-private={p.email ? true : undefined}\n className={cn(\n \"truncate text-sm\",\n p.email ? \"text-[var(--text-primary)]\" : \"text-[var(--text-muted)]\",\n )}\n >\n {name}\n </div>\n <div className=\"mt-0.5 flex flex-wrap items-center gap-1\">\n <Chip size=\"sm\" shape=\"square\" tone=\"warning\" caps>\n {labels.pending}\n </Chip>\n <ShareRoleChip role={roleOf(p.role)} />\n </div>\n </div>\n {(p.link || (!readOnly && onRevokePending)) && (\n <div className={ROW_CONTROLS}>\n {p.link && <CopyButton size=\"xs\" tone=\"muted\" text={p.link} label={labels.copyLink} />}\n {!readOnly && onRevokePending && (\n <IconButton\n tone=\"danger\"\n size=\"xs\"\n commit\n label={labels.revokePending}\n // As the grantee's remove above: one action beside the\n // copy icon (which is an icon at every size), and the\n // confirmation says it in words.\n labelVisible={false}\n disabledReasonDisplay={rowReason}\n pending={busy === key}\n disabled={busy !== null}\n onClick={async () => {\n const yes = await confirm({\n title: labels.revokePendingConfirm(name),\n confirmLabel: labels.revokePending,\n tone: \"danger\",\n });\n if (yes) await run(key, () => onRevokePending(p));\n }}\n >\n <Trash2 />\n </IconButton>\n )}\n </div>\n )}\n </div>\n </li>\n );\n })}\n </ul>\n </div>\n )}\n </div>\n );\n}\n\n// ── The two frames ────────────────────────────────────────────────────────────\n\nexport interface ShareCardProps extends SharePanelProps {\n /** A heading over the card. */\n title?: ReactNode;\n /** The Card's variant. Default `outline` — a block inside a section, as keksdose's\n * card under a budget row is. */\n variant?: CardProps[\"variant\"];\n className?: string;\n}\n\n/** {@link SharePanel} in a card — keksdose's inline form, under the row it shares. */\nexport function ShareCard({ title, variant = \"outline\", className, ...panel }: ShareCardProps) {\n return (\n <Card variant={variant} padding=\"sm\" className={cn(\"space-y-3\", className)}>\n {title && <h3 className=\"text-sm font-semibold text-[var(--text-primary)]\">{title}</h3>}\n <SharePanel {...panel} />\n </Card>\n );\n}\n\nexport interface ShareDialogProps\n extends SharePanelProps,\n Pick<DialogFrameProps, \"open\" | \"onClose\" | \"size\" | \"className\"> {\n /** The heading. Default {@link ShareCardLabels.dialogTitle}. */\n title?: ReactNode;\n /** Under the heading — what is being shared (Kurvenschmiede passes its name). */\n description?: ReactNode;\n}\n\n/**\n * {@link SharePanel} in the kit's {@link DialogFrame} with a Close button —\n * Kurvenschmiede's form. Sharing commits as it goes, so there is nothing to save or\n * cancel: Close is the only action.\n */\nexport function ShareDialog({ open, onClose, size, className, title, description, ...panel }: ShareDialogProps) {\n const labels = useKitLabels(\"shareCard\", DEFAULT_SHARE_CARD_LABELS, panel.labels);\n return (\n <DialogFrame\n open={open}\n onClose={onClose}\n size={size}\n className={className}\n title={title ?? labels.dialogTitle}\n description={description}\n actions={(close) => (\n <Button variant=\"secondary\" onClick={close}>\n {labels.close}\n </Button>\n )}\n >\n <SharePanel {...panel} />\n </DialogFrame>\n );\n}\n"],"mappings":";AA+Ne,cAwIL,YAxIK;AA/Nf,SAAS,gBAAgB;AAEzB,SAAS,QAAQ,UAAU,kBAAkB;AAE7C,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAE7B,SAAS,YAAY;AACrB,SAAS,gBAAgB;AAEzB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAE5B,SAAS,SAAS,oBAAoB;AACtC,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AACxB,SAAS,QAAQ,MAAM,YAAY,eAAe;AAClD,SAAS,oBAAoB;AA6DtB,MAAM,4BAA6C;AAAA,EACxD,aAAa;AAAA,EACb,OAAO;AAAA,EACP,OAAO;AAAA,EACP,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,MAAM;AAAA,EACN,QAAQ,CAAC,SAAS,WAAW,IAAI;AAAA,EACjC,KAAK;AAAA,EACL,cAAc;AAAA,EACd,WAAW;AAAA,EACX,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU,CAAC,SAAS,eAAe,IAAI;AAAA,EACvC,QAAQ;AAAA,EACR,eAAe,CAAC,SAAS,qBAAqB,IAAI;AAAA,EAClD,eAAe;AAAA,EACf,sBAAsB,CAAC,SAAS,+BAA+B,IAAI;AAAA,EACnE,QAAQ;AAAA,EACR,SAAS;AACX;AAiHA,MAAM,cAAc;AAIpB,SAAS,cAAc,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@ interface SignChipLabels {
|
|
|
11
11
|
* turns it into — `current` and `next` are the two words above. The other option is
|
|
12
12
|
* nowhere on screen to be read, so the name has to say both. */
|
|
13
13
|
direction: (current: string, next: string) => string;
|
|
14
|
+
/** 0.32: what a press does, in words under the chip at Large and Extra large —
|
|
15
|
+
* `next` is the other direction's word ("Switch to Inflow"). The tooltip's half of
|
|
16
|
+
* `direction`, shown, since a fact may not live only in a tooltip there (§4). */
|
|
17
|
+
switchTo: (next: string) => string;
|
|
14
18
|
}
|
|
15
19
|
declare const DEFAULT_SIGN_CHIP_LABELS: SignChipLabels;
|
|
16
20
|
interface SignChipProps {
|
|
@@ -5,17 +5,20 @@ import { Chip } from "./chip.js";
|
|
|
5
5
|
import { Tooltip } from "./tooltip.js";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
7
|
import { useKitLabels } from "../i18n/kit-labels.js";
|
|
8
|
+
import { useLargeText } from "../hooks/use-large-text.js";
|
|
8
9
|
const DEFAULT_SIGN_CHIP_LABELS = {
|
|
9
10
|
outflow: "Outflow",
|
|
10
11
|
inflow: "Inflow",
|
|
11
|
-
direction: (current, next) => `Direction: ${current} \u2014 switch to ${next}
|
|
12
|
+
direction: (current, next) => `Direction: ${current} \u2014 switch to ${next}`,
|
|
13
|
+
switchTo: (next) => `Switch to ${next}`
|
|
12
14
|
};
|
|
13
15
|
function SignChip({ negative, onNegativeChange, disabled, labels: labelsProp, className }) {
|
|
14
16
|
const labels = useKitLabels("signChip", DEFAULT_SIGN_CHIP_LABELS, labelsProp);
|
|
15
17
|
const current = negative ? labels.outflow : labels.inflow;
|
|
16
18
|
const next = negative ? labels.inflow : labels.outflow;
|
|
17
19
|
const name = labels.direction(current, next);
|
|
18
|
-
|
|
20
|
+
const large = useLargeText();
|
|
21
|
+
const chip = /* @__PURE__ */ jsxs(
|
|
19
22
|
Chip,
|
|
20
23
|
{
|
|
21
24
|
size: "lg",
|
|
@@ -24,13 +27,23 @@ function SignChip({ negative, onNegativeChange, disabled, labels: labelsProp, cl
|
|
|
24
27
|
onClick: () => onNegativeChange(!negative),
|
|
25
28
|
disabled,
|
|
26
29
|
"aria-label": name,
|
|
27
|
-
className: cn("shrink-0 gap-1.5 whitespace-nowrap px-3 font-medium md:min-h-0 md:py-2.5", className),
|
|
30
|
+
className: cn("shrink-0 gap-1.5 whitespace-nowrap px-3 font-medium md:min-h-0 md:py-2.5", !large && className),
|
|
28
31
|
children: [
|
|
29
32
|
current,
|
|
30
33
|
/* @__PURE__ */ jsx(ArrowUpDown, { className: "ms-1.5 inline size-3.5 align-[-0.2em] opacity-60", "aria-hidden": true })
|
|
31
34
|
]
|
|
32
35
|
}
|
|
33
|
-
)
|
|
36
|
+
);
|
|
37
|
+
if (!large) {
|
|
38
|
+
return /* @__PURE__ */ jsx(Tooltip, { label: name, lazy: true, children: chip });
|
|
39
|
+
}
|
|
40
|
+
return (
|
|
41
|
+
// The caller's placement (`self-end`…) moves to the pair, which is now the row's item.
|
|
42
|
+
/* @__PURE__ */ jsxs("span", { "data-slot": "sign-chip", className: cn("inline-flex shrink-0 flex-col items-start gap-0.5", className), children: [
|
|
43
|
+
chip,
|
|
44
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "text-xs text-[var(--text-muted)]", children: labels.switchTo(next) })
|
|
45
|
+
] })
|
|
46
|
+
);
|
|
34
47
|
}
|
|
35
48
|
export {
|
|
36
49
|
DEFAULT_SIGN_CHIP_LABELS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/sign-chip.tsx"],"sourcesContent":["import { ArrowUpDown, Minus, Plus } from \"lucide-react\";\nimport { Chip } from \"./chip\";\nimport { Tooltip } from \"./tooltip\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\n\n// ── Labels ────────────────────────────────────────────────────────────────────\n\n/** The words a {@link SignChip} says — the `signChip` namespace of\n * `<UiKitProvider labels>`, and per chip through its `labels` prop. */\nexport interface SignChipLabels {\n /** The chip's text while the figure is negative — money going out. */\n outflow: string;\n /** The chip's text while the figure is positive — money coming in. */\n inflow: string;\n /** The chip's accessible name and its tooltip: the state it is in, and what a press\n * turns it into — `current` and `next` are the two words above. The other option is\n * nowhere on screen to be read, so the name has to say both. */\n direction: (current: string, next: string) => string;\n}\n\nexport const DEFAULT_SIGN_CHIP_LABELS: SignChipLabels = {\n outflow: \"Outflow\",\n inflow: \"Inflow\",\n direction: (current, next) => `Direction: ${current} — switch to ${next}`,\n};\n\nexport interface SignChipProps {\n /** The figure is negative (an outflow) — the same flag {@link AmountInput}'s\n * `negative` is, so one state feeds both: `<AmountInput negative={neg}\n * onNegativeChange={setNeg} />` and `<SignChip negative={neg}\n * onNegativeChange={setNeg} />`. */\n negative: boolean;\n /** A press: the other direction. */\n onNegativeChange: (negative: boolean) => void;\n disabled?: boolean;\n /** Per-chip overrides of the `signChip` namespace. */\n labels?: Partial<SignChipLabels>;\n /** On the chip. Place it in its row from here — keksdose's form passes `self-end`\n * to sit it on the display figure's baseline strip. */\n className?: string;\n}\n\n/**\n * The SIGN of an amount, as one chip that shows only the state it is in — keksdose\n * K15, its `DirectionToggle` (feedback #417, #430, #431, dev#434) made a kit piece,\n * so the figure and its direction come from one package and wear one palette.\n *\n * WHY A CHIP, NOT A SEGMENTED CONTROL. A two-option toggle spends half its width\n * telling you what the figure is NOT, and at a phone's width it was the widest thing on\n * the form after the figure itself (#417). This sits beside the amount and reads as one\n * phrase with it — \"−42,50 Outflow\" — and a press flips it. Hiding the alternative costs\n * discoverability, so two things pay it back: the ± glyph and the swap arrows say \"this\n * is a control\", not a badge; and the name and tooltip spell out both the current state\n * and what a press will do.\n *\n * NOT A PRESSED/UNPRESSED TOGGLE. A {@link Chip} toggle has a FIXED label naming its\n * on-state, with `aria-pressed` carrying the state. Here the word IS the state, so it\n * is an action button with no `aria-pressed`: \"Direction: Inflow, not pressed\" would\n * name no on-state for \"not pressed\" to be the absence of. The name changing under\n * focus is the echo.\n *\n * THE COLOUR is the money pairing — the chip's `expense` / `income` tones, the same\n * `--money-expense` / `--money-income` that {@link AmountInput}'s `tone` paints the\n * figure with (dev#434): only the text and the border carry the tint, on a neutral\n * surface, because a filled pill next to a tinted figure reads as one smear.\n *\n * SIZE. `lg` on a phone — the 44px touch target beside a display figure that has no\n * field height to match — and from `md` up exactly a labelled field's 42px, so it never\n * stands taller than the fields in its grid row (#431).\n *\n * An exported chip rather than an `AmountInput signControl` slot: the slot would have\n * to own the row the two share, and every form lays that row out differently (beside\n * the figure on a phone, in a grid column on a desktop). The chip is the part that was\n * being re-written; the row stays the form's.\n */\nexport function SignChip({ negative, onNegativeChange, disabled, labels: labelsProp, className }: SignChipProps) {\n const labels = useKitLabels(\"signChip\", DEFAULT_SIGN_CHIP_LABELS, labelsProp);\n const current = negative ? labels.outflow : labels.inflow;\n const next = negative ? labels.inflow : labels.outflow;\n const name = labels.direction(current, next);\n
|
|
1
|
+
{"version":3,"sources":["../../src/components/sign-chip.tsx"],"sourcesContent":["import { ArrowUpDown, Minus, Plus } from \"lucide-react\";\nimport { Chip } from \"./chip\";\nimport { Tooltip } from \"./tooltip\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { useLargeText } from \"../hooks/use-large-text\";\n\n// ── Labels ────────────────────────────────────────────────────────────────────\n\n/** The words a {@link SignChip} says — the `signChip` namespace of\n * `<UiKitProvider labels>`, and per chip through its `labels` prop. */\nexport interface SignChipLabels {\n /** The chip's text while the figure is negative — money going out. */\n outflow: string;\n /** The chip's text while the figure is positive — money coming in. */\n inflow: string;\n /** The chip's accessible name and its tooltip: the state it is in, and what a press\n * turns it into — `current` and `next` are the two words above. The other option is\n * nowhere on screen to be read, so the name has to say both. */\n direction: (current: string, next: string) => string;\n /** 0.32: what a press does, in words under the chip at Large and Extra large —\n * `next` is the other direction's word (\"Switch to Inflow\"). The tooltip's half of\n * `direction`, shown, since a fact may not live only in a tooltip there (§4). */\n switchTo: (next: string) => string;\n}\n\nexport const DEFAULT_SIGN_CHIP_LABELS: SignChipLabels = {\n outflow: \"Outflow\",\n inflow: \"Inflow\",\n direction: (current, next) => `Direction: ${current} — switch to ${next}`,\n switchTo: (next) => `Switch to ${next}`,\n};\n\nexport interface SignChipProps {\n /** The figure is negative (an outflow) — the same flag {@link AmountInput}'s\n * `negative` is, so one state feeds both: `<AmountInput negative={neg}\n * onNegativeChange={setNeg} />` and `<SignChip negative={neg}\n * onNegativeChange={setNeg} />`. */\n negative: boolean;\n /** A press: the other direction. */\n onNegativeChange: (negative: boolean) => void;\n disabled?: boolean;\n /** Per-chip overrides of the `signChip` namespace. */\n labels?: Partial<SignChipLabels>;\n /** On the chip. Place it in its row from here — keksdose's form passes `self-end`\n * to sit it on the display figure's baseline strip. */\n className?: string;\n}\n\n/**\n * The SIGN of an amount, as one chip that shows only the state it is in — keksdose\n * K15, its `DirectionToggle` (feedback #417, #430, #431, dev#434) made a kit piece,\n * so the figure and its direction come from one package and wear one palette.\n *\n * WHY A CHIP, NOT A SEGMENTED CONTROL. A two-option toggle spends half its width\n * telling you what the figure is NOT, and at a phone's width it was the widest thing on\n * the form after the figure itself (#417). This sits beside the amount and reads as one\n * phrase with it — \"−42,50 Outflow\" — and a press flips it. Hiding the alternative costs\n * discoverability, so two things pay it back: the ± glyph and the swap arrows say \"this\n * is a control\", not a badge; and the name and tooltip spell out both the current state\n * and what a press will do.\n *\n * NOT A PRESSED/UNPRESSED TOGGLE. A {@link Chip} toggle has a FIXED label naming its\n * on-state, with `aria-pressed` carrying the state. Here the word IS the state, so it\n * is an action button with no `aria-pressed`: \"Direction: Inflow, not pressed\" would\n * name no on-state for \"not pressed\" to be the absence of. The name changing under\n * focus is the echo.\n *\n * THE COLOUR is the money pairing — the chip's `expense` / `income` tones, the same\n * `--money-expense` / `--money-income` that {@link AmountInput}'s `tone` paints the\n * figure with (dev#434): only the text and the border carry the tint, on a neutral\n * surface, because a filled pill next to a tinted figure reads as one smear.\n *\n * SIZE. `lg` on a phone — the 44px touch target beside a display figure that has no\n * field height to match — and from `md` up exactly a labelled field's 42px, so it never\n * stands taller than the fields in its grid row (#431).\n *\n * An exported chip rather than an `AmountInput signControl` slot: the slot would have\n * to own the row the two share, and every form lays that row out differently (beside\n * the figure on a phone, in a grid column on a desktop). The chip is the part that was\n * being re-written; the row stays the form's.\n */\nexport function SignChip({ negative, onNegativeChange, disabled, labels: labelsProp, className }: SignChipProps) {\n const labels = useKitLabels(\"signChip\", DEFAULT_SIGN_CHIP_LABELS, labelsProp);\n const current = negative ? labels.outflow : labels.inflow;\n const next = negative ? labels.inflow : labels.outflow;\n const name = labels.direction(current, next);\n // §4: at Large the chip's word is joined by what a press does, as a line under it —\n // and the bubble that said only that goes.\n const large = useLargeText();\n const chip = (\n <Chip\n size=\"lg\"\n tone={negative ? \"expense\" : \"income\"}\n icon={negative ? Minus : Plus}\n onClick={() => onNegativeChange(!negative)}\n disabled={disabled}\n aria-label={name}\n // `gap-1.5 px-3`: the chip's narrower body, because on a 375px screen every\n // pixel of it is taken from the figure beside it (#430). `md:py-2.5` with the\n // hairline border is the 42px a labelled field measures (#431).\n className={cn(\"shrink-0 gap-1.5 whitespace-nowrap px-3 font-medium md:min-h-0 md:py-2.5\", !large && className)}\n >\n {current}\n {/* The swap arrows after the word, in the label's own row: decoration (the\n name already says what a press does), set a little apart from the word. */}\n <ArrowUpDown className=\"ms-1.5 inline size-3.5 align-[-0.2em] opacity-60\" aria-hidden />\n </Chip>\n );\n if (!large) {\n return (\n <Tooltip label={name} lazy>\n {chip}\n </Tooltip>\n );\n }\n return (\n // The caller's placement (`self-end`…) moves to the pair, which is now the row's item.\n <span data-slot=\"sign-chip\" className={cn(\"inline-flex shrink-0 flex-col items-start gap-0.5\", className)}>\n {chip}\n {/* Hidden from the accessibility tree: the chip's name already says it. */}\n <span aria-hidden className=\"text-xs text-[var(--text-muted)]\">\n {labels.switchTo(next)}\n </span>\n </span>\n );\n}\n"],"mappings":";AA2FM,SAeE,KAfF;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it<ComponentPropsWithoutRef<"div">, "onCha
|
|
|
113
113
|
exportInk?: string;
|
|
114
114
|
/** Fill behind the exported PNG. Default transparent. */
|
|
115
115
|
exportBackground?: string;
|
|
116
|
-
/** Base stroke width in CSS pixels. Default 2.5.
|
|
116
|
+
/** Base stroke width in CSS pixels at Normal text size. Default 2.5. It grows with the
|
|
117
|
+
* text size (× 1.25 / × 1.5, docs/text-size-harmonization.md §10.11), as the pad's
|
|
118
|
+
* rem height does, so a signature keeps its weight on a larger pad. */
|
|
117
119
|
lineWidth?: number;
|
|
118
120
|
/** Classes for the canvas — its height, chiefly (default `h-40`). */
|
|
119
121
|
canvasClassName?: string;
|