@eifi1/ui-kit 0.54.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -76
- package/dist/admin/plan-change.js +2 -2
- package/dist/admin/plan-change.js.map +1 -1
- package/dist/admin/user-roster.d.ts +6 -0
- package/dist/admin/user-roster.js +4 -0
- package/dist/admin/user-roster.js.map +1 -1
- package/dist/billing/billing-labels.d.ts +26 -0
- package/dist/billing/billing-labels.js +9 -0
- package/dist/billing/billing-labels.js.map +1 -1
- package/dist/billing/subscription-standing.d.ts +61 -0
- package/dist/billing/subscription-standing.js +51 -0
- package/dist/billing/subscription-standing.js.map +1 -0
- package/dist/billing/usage-meter.d.ts +52 -0
- package/dist/billing/usage-meter.js +52 -0
- package/dist/billing/usage-meter.js.map +1 -0
- package/dist/chart.d.ts +1 -0
- package/dist/chart.js +4 -0
- package/dist/chart.js.map +1 -1
- package/dist/components/alert-banner.js +2 -3
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.js +3 -15
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/autocomplete.js +2 -2
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/bulk-action-bar.js +2 -1
- package/dist/components/bulk-action-bar.js.map +1 -1
- package/dist/components/button.d.ts +35 -1
- package/dist/components/button.js +5 -9
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-heatmap.js +2 -2
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/camera-button.d.ts +89 -0
- package/dist/components/camera-button.js +122 -0
- package/dist/components/camera-button.js.map +1 -0
- package/dist/components/camera-capture.d.ts +66 -0
- package/dist/components/camera-capture.js +190 -0
- package/dist/components/camera-capture.js.map +1 -0
- package/dist/components/camera-labels.d.ts +20 -0
- package/dist/components/camera-labels.js +15 -0
- package/dist/components/camera-labels.js.map +1 -0
- package/dist/components/chart-edge.d.ts +9 -0
- package/dist/components/chart-edge.js +14 -3
- package/dist/components/chart-edge.js.map +1 -1
- package/dist/components/chart-zoom-core.js +34 -29
- package/dist/components/chart-zoom-core.js.map +1 -1
- package/dist/components/checkbox-group.js +1 -1
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/combobox-core.js +3 -2
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.js +2 -2
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/consent-again-notice-labels.d.ts +25 -0
- package/dist/components/consent-again-notice-labels.js +15 -0
- package/dist/components/consent-again-notice-labels.js.map +1 -0
- package/dist/components/consent-again-notice.d.ts +85 -0
- package/dist/components/consent-again-notice.js +94 -0
- package/dist/components/consent-again-notice.js.map +1 -0
- package/dist/components/country-select.js +2 -7
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/currency-select.js +2 -2
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm.js +2 -2
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-column-settings.js +2 -2
- package/dist/components/data-table-column-settings.js.map +1 -1
- package/dist/components/data-table-fit.js.map +1 -1
- package/dist/components/data-table-virtual.js +13 -3
- package/dist/components/data-table-virtual.js.map +1 -1
- package/dist/components/date-field.js +2 -2
- package/dist/components/date-field.js.map +1 -1
- package/dist/components/date-picker.js +2 -2
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.js +2 -6
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/dialog-frame.d.ts +3 -1
- package/dist/components/dialog-frame.js.map +1 -1
- package/dist/components/dropdown.js +7 -3
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/entity-combobox.js +2 -2
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/field-parts.d.ts +108 -6
- package/dist/components/field-parts.js +59 -6
- package/dist/components/field-parts.js.map +1 -1
- package/dist/components/field-suggestion-labels.d.ts +2 -0
- package/dist/components/field-suggestion-labels.js +10 -0
- package/dist/components/field-suggestion-labels.js.map +1 -0
- package/dist/components/field.js +1 -1
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-button.d.ts +1 -1
- package/dist/components/file-button.js.map +1 -1
- package/dist/components/floating-panel.d.ts +7 -6
- package/dist/components/floating-panel.js +3 -17
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/form-actions.d.ts +3 -2
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/hover-menu.js +3 -2
- package/dist/components/hover-menu.js.map +1 -1
- package/dist/components/icon-button.d.ts +23 -5
- package/dist/components/icon-button.js +6 -8
- package/dist/components/icon-button.js.map +1 -1
- package/dist/components/inline-confirm.js +2 -1
- package/dist/components/inline-confirm.js.map +1 -1
- package/dist/components/inline-entity-combobox.js +2 -2
- package/dist/components/inline-entity-combobox.js.map +1 -1
- package/dist/components/input.js +2 -2
- package/dist/components/input.js.map +1 -1
- package/dist/components/jump-calendar.js +3 -3
- package/dist/components/jump-calendar.js.map +1 -1
- package/dist/components/legal.d.ts +13 -1
- package/dist/components/legal.js +12 -0
- package/dist/components/legal.js.map +1 -1
- package/dist/components/legended-series-chart.d.ts +80 -0
- package/dist/components/legended-series-chart.js +70 -0
- package/dist/components/legended-series-chart.js.map +1 -0
- package/dist/components/lightbox.js +2 -1
- package/dist/components/lightbox.js.map +1 -1
- package/dist/components/mini-calendar.js +13 -5
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.d.ts +23 -2
- package/dist/components/modal.js +24 -6
- package/dist/components/modal.js.map +1 -1
- package/dist/components/month-picker.d.ts +1 -1
- package/dist/components/month-picker.js +6 -6
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.js +2 -2
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/multi-select.js +2 -6
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/number-input.js +2 -2
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/page-header-layout.d.ts +18 -0
- package/dist/components/page-header-layout.js +23 -0
- package/dist/components/page-header-layout.js.map +1 -0
- package/dist/components/page-header-skeleton.d.ts +41 -0
- package/dist/components/page-header-skeleton.js +52 -0
- package/dist/components/page-header-skeleton.js.map +1 -0
- package/dist/components/page-header.js +4 -17
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/popover.js +7 -2
- package/dist/components/popover.js.map +1 -1
- package/dist/components/release-notes-labels.d.ts +16 -0
- package/dist/components/release-notes-labels.js +18 -0
- package/dist/components/release-notes-labels.js.map +1 -0
- package/dist/components/release-notes.d.ts +65 -0
- package/dist/components/release-notes.js +65 -0
- package/dist/components/release-notes.js.map +1 -0
- package/dist/components/select.js +2 -2
- package/dist/components/select.js.map +1 -1
- package/dist/components/series-chart-labels.d.ts +9 -0
- package/dist/components/series-chart-labels.js +3 -1
- package/dist/components/series-chart-labels.js.map +1 -1
- package/dist/components/series-chart.d.ts +5 -0
- package/dist/components/series-chart.js +89 -36
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/toggle-group.js +3 -2
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/treemap-layout.js.map +1 -1
- package/dist/components/treemap.d.ts +17 -15
- package/dist/components/treemap.js +167 -85
- package/dist/components/treemap.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/eslint/role-utilities.d.ts +2 -2
- package/dist/eslint/role-utilities.js.map +1 -1
- package/dist/feedback/feedback-inbox-page.d.ts +260 -0
- package/dist/feedback/feedback-inbox-page.js +207 -0
- package/dist/feedback/feedback-inbox-page.js.map +1 -0
- package/dist/feedback/feedback-vocabulary.js +2 -2
- package/dist/feedback/feedback-vocabulary.js.map +1 -1
- package/dist/feedback.d.ts +1 -0
- package/dist/feedback.js +6 -0
- package/dist/feedback.js.map +1 -1
- package/dist/hooks/use-debounce.d.ts +32 -5
- package/dist/hooks/use-debounce.js +6 -5
- package/dist/hooks/use-debounce.js.map +1 -1
- package/dist/hooks/use-file-picker.d.ts +3 -1
- package/dist/hooks/use-file-picker.js.map +1 -1
- package/dist/hooks/use-focus-trap.d.ts +19 -3
- package/dist/hooks/use-focus-trap.js +15 -5
- package/dist/hooks/use-focus-trap.js.map +1 -1
- package/dist/hooks/use-has-camera.d.ts +36 -0
- package/dist/hooks/use-has-camera.js +53 -0
- package/dist/hooks/use-has-camera.js.map +1 -0
- package/dist/hooks/use-hotkey.js +1 -10
- package/dist/hooks/use-hotkey.js.map +1 -1
- package/dist/hooks/use-overlay-history.d.ts +6 -1
- package/dist/hooks/use-overlay-history.js +10 -2
- package/dist/hooks/use-overlay-history.js.map +1 -1
- package/dist/i18n/defaults.js +11 -1
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.js +75 -3
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +20 -0
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/en.js +92 -4
- package/dist/i18n/locales/en.js.map +3 -3
- package/dist/i18n/locales/es.js +71 -3
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +72 -2
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +74 -3
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +74 -3
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +71 -3
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +22 -1
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +24 -5
- package/dist/index.js +35 -1
- package/dist/index.js.map +1 -1
- package/dist/landing/landing-labels.d.ts +8 -0
- package/dist/landing/landing-labels.js +2 -1
- package/dist/landing/landing-labels.js.map +1 -1
- package/dist/lib/changelog.d.ts +130 -0
- package/dist/lib/changelog.js +137 -0
- package/dist/lib/changelog.js.map +1 -0
- package/dist/lib/clipboard-minus.js +2 -2
- package/dist/lib/clipboard-minus.js.map +1 -1
- package/dist/lib/dates.d.ts +29 -3
- package/dist/lib/dates.js +41 -12
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/editable-content.d.ts +33 -0
- package/dist/lib/editable-content.js +15 -0
- package/dist/lib/editable-content.js.map +1 -0
- package/dist/lib/focus-left.d.ts +47 -1
- package/dist/lib/focus-left.js +11 -2
- package/dist/lib/focus-left.js.map +1 -1
- package/dist/lib/server-wake.d.ts +49 -9
- package/dist/lib/server-wake.js +25 -14
- package/dist/lib/server-wake.js.map +1 -1
- package/dist/lib/session-refresh.d.ts +53 -0
- package/dist/lib/session-refresh.js +27 -1
- package/dist/lib/session-refresh.js.map +1 -1
- package/dist/rhf/fields.js +3 -3
- package/dist/rhf/fields.js.map +1 -1
- package/dist/shell/app-shell.d.ts +25 -1
- package/dist/shell/app-shell.js +3 -1
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/dev-menu.d.ts +3 -0
- package/dist/shell/dev-menu.js +4 -2
- package/dist/shell/dev-menu.js.map +1 -1
- package/dist/shell/held-changes-banner-labels.d.ts +23 -0
- package/dist/shell/held-changes-banner-labels.js +14 -0
- package/dist/shell/held-changes-banner-labels.js.map +1 -0
- package/dist/shell/held-changes-banner.d.ts +75 -0
- package/dist/shell/held-changes-banner.js +106 -0
- package/dist/shell/held-changes-banner.js.map +1 -0
- package/dist/shell/sync-status-indicator.d.ts +27 -12
- package/dist/shell/sync-status-indicator.js +13 -4
- package/dist/shell/sync-status-indicator.js.map +1 -1
- package/dist/shell/top-bar-parts-labels.d.ts +5 -0
- package/dist/shell/top-bar-parts-labels.js +3 -1
- package/dist/shell/top-bar-parts-labels.js.map +1 -1
- package/dist/shell.d.ts +2 -0
- package/dist/shell.js +3 -0
- package/dist/shell.js.map +1 -1
- package/dist/sync/engine.d.ts +11 -2
- package/dist/sync/engine.js +13 -5
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync/hooks.d.ts +3 -2
- package/dist/sync/hooks.js +4 -2
- package/dist/sync/hooks.js.map +1 -1
- package/dist/testing/css-variables.generated.d.ts +2 -2
- package/dist/testing/css-variables.generated.js +1 -1
- package/dist/testing/css-variables.generated.js.map +1 -1
- package/dist/theme/chart-palette.d.ts +18 -0
- package/dist/theme/chart-palette.js +17 -1
- package/dist/theme/chart-palette.js.map +1 -1
- package/dist/theme/contrast-tokens.d.ts +3 -3
- package/dist/theme/contrast-tokens.js.map +1 -1
- package/dist/theme/contrast.d.ts +4 -4
- package/dist/theme/contrast.js.map +1 -1
- package/dist/tour/tour-overlay.js +2 -1
- package/dist/tour/tour-overlay.js.map +1 -1
- package/package.json +5 -9
- package/tokens.css +19 -54
- package/src/account/account-parts.ts +0 -47
- package/src/account/account-settings-labels.ts +0 -240
- package/src/account/account-settings.tsx +0 -698
- package/src/account/data-export-setting-labels.ts +0 -20
- package/src/account/data-export-setting.tsx +0 -200
- package/src/account/delete-account-setting-labels.ts +0 -33
- package/src/account/delete-account-setting.tsx +0 -342
- package/src/account/email-change-setting-labels.ts +0 -31
- package/src/account/email-change-setting.tsx +0 -443
- package/src/account/passkeys-setting.tsx +0 -445
- package/src/account/sessions-setting-labels.ts +0 -24
- package/src/account/sessions-setting.tsx +0 -283
- package/src/admin/admin-action-confirm-labels.ts +0 -19
- package/src/admin/admin-action-confirm.tsx +0 -509
- package/src/admin/admin-action-log-labels.ts +0 -83
- package/src/admin/admin-action-log.tsx +0 -464
- package/src/admin/admin-area-labels.ts +0 -114
- package/src/admin/admin-forbidden.tsx +0 -75
- package/src/admin/admin-overview.tsx +0 -258
- package/src/admin/admin-parts.ts +0 -68
- package/src/admin/admin-sections.tsx +0 -208
- package/src/admin/admin-tool-links.tsx +0 -90
- package/src/admin/invitations-panel-labels.ts +0 -31
- package/src/admin/invitations-panel.tsx +0 -516
- package/src/admin/mail-test-card-labels.ts +0 -19
- package/src/admin/mail-test-card.tsx +0 -189
- package/src/admin/plan-change-labels.ts +0 -5
- package/src/admin/plan-change.tsx +0 -474
- package/src/admin/reviewer-scope-editor-labels.ts +0 -16
- package/src/admin/reviewer-scope-editor.tsx +0 -224
- package/src/admin/role-select-labels.ts +0 -16
- package/src/admin/role-select.tsx +0 -282
- package/src/admin/transfer-ownership-dialog-labels.ts +0 -20
- package/src/admin/transfer-ownership-dialog.tsx +0 -162
- package/src/admin/user-roster-labels.ts +0 -17
- package/src/admin/user-roster.tsx +0 -559
- package/src/auth/accept-invitation-labels.ts +0 -21
- package/src/auth/accept-invitation.tsx +0 -210
- package/src/auth/auth-errors-labels.ts +0 -23
- package/src/auth/auth-errors.ts +0 -439
- package/src/auth/complete-name-dialog-labels.ts +0 -16
- package/src/auth/complete-name-dialog.tsx +0 -253
- package/src/auth/email-tag.ts +0 -75
- package/src/auth/forgot-password-form-labels.ts +0 -20
- package/src/auth/forgot-password-form.tsx +0 -221
- package/src/auth/form-rules.ts +0 -40
- package/src/auth/new-password-fields.tsx +0 -85
- package/src/auth/not-found-page-labels.ts +0 -12
- package/src/auth/not-found-page.tsx +0 -95
- package/src/auth/register-form-labels.ts +0 -31
- package/src/auth/register-form.tsx +0 -456
- package/src/auth/reset-password-form-labels.ts +0 -27
- package/src/auth/reset-password-form.tsx +0 -341
- package/src/auth/sign-in-form-labels.ts +0 -44
- package/src/auth/sign-in-form.tsx +0 -858
- package/src/auth/status-parts.tsx +0 -132
- package/src/auth/verify-email-labels.ts +0 -26
- package/src/auth/verify-email.tsx +0 -445
- package/src/billing/billing-banner.tsx +0 -258
- package/src/billing/billing-labels.ts +0 -381
- package/src/billing/billing-lock.ts +0 -108
- package/src/billing/billing-overview.ts +0 -157
- package/src/billing/billing-standing.ts +0 -80
- package/src/billing/cancel-request.ts +0 -97
- package/src/billing/cancel-subscription.tsx +0 -98
- package/src/billing/checkout-processing.ts +0 -394
- package/src/billing/checkout-return.ts +0 -90
- package/src/billing/pay-page.ts +0 -330
- package/src/billing/plan-card.tsx +0 -562
- package/src/billing/plan-change-labels.ts +0 -66
- package/src/billing/plan-limit-notice.tsx +0 -148
- package/src/billing/plan-limit-toast.tsx +0 -90
- package/src/billing/plan-limit.ts +0 -52
- package/src/billing/plan-price.ts +0 -98
- package/src/billing/plan-switch.tsx +0 -216
- package/src/billing/provider-page.ts +0 -84
- package/src/billing/subscription-actions.tsx +0 -247
- package/src/billing/subscription-status-chip.tsx +0 -95
- package/src/chart.ts +0 -103
- package/src/components/account-chips-labels.ts +0 -16
- package/src/components/account-chips.tsx +0 -474
- package/src/components/alert-banner.tsx +0 -670
- package/src/components/amount-input.tsx +0 -816
- package/src/components/appearance-labels.ts +0 -63
- package/src/components/authed-image-labels.ts +0 -11
- package/src/components/authed-image.tsx +0 -209
- package/src/components/autocomplete.tsx +0 -645
- package/src/components/breadcrumbs-labels.ts +0 -10
- package/src/components/breadcrumbs.tsx +0 -205
- package/src/components/bulk-action-bar-labels.ts +0 -11
- package/src/components/bulk-action-bar.tsx +0 -443
- package/src/components/button-group.tsx +0 -223
- package/src/components/button-look.ts +0 -256
- package/src/components/button.tsx +0 -339
- package/src/components/calculator.tsx +0 -341
- package/src/components/calendar-heatmap-labels.ts +0 -15
- package/src/components/calendar-heatmap.tsx +0 -600
- package/src/components/card.tsx +0 -377
- package/src/components/chart-edge.ts +0 -106
- package/src/components/chart-figure.tsx +0 -35
- package/src/components/chart-height.ts +0 -30
- package/src/components/chart-zoom-core.tsx +0 -627
- package/src/components/chart-zoom.tsx +0 -22
- package/src/components/chart.tsx +0 -554
- package/src/components/checkbox-group.tsx +0 -247
- package/src/components/checkbox.tsx +0 -346
- package/src/components/chip-input.tsx +0 -370
- package/src/components/chip-labels.ts +0 -13
- package/src/components/chip.tsx +0 -843
- package/src/components/choice-card.tsx +0 -544
- package/src/components/column-mapper-labels.ts +0 -38
- package/src/components/column-mapper.tsx +0 -655
- package/src/components/combobox-core.tsx +0 -1321
- package/src/components/combobox-suggestions.tsx +0 -131
- package/src/components/combobox.tsx +0 -716
- package/src/components/confirm-context.ts +0 -7
- package/src/components/confirm-dialog-labels.ts +0 -13
- package/src/components/confirm-dialog.tsx +0 -341
- package/src/components/copy-button-labels.ts +0 -13
- package/src/components/copy-button.tsx +0 -192
- package/src/components/country-select-labels.ts +0 -11
- package/src/components/country-select.tsx +0 -539
- package/src/components/currency-option-list.tsx +0 -188
- package/src/components/currency-select.tsx +0 -343
- package/src/components/danger-confirm-labels.ts +0 -20
- package/src/components/danger-confirm.tsx +0 -987
- package/src/components/data-table-cells.tsx +0 -118
- package/src/components/data-table-column-settings.tsx +0 -198
- package/src/components/data-table-filter-popover.tsx +0 -289
- package/src/components/data-table-filters.ts +0 -315
- package/src/components/data-table-fit.ts +0 -301
- package/src/components/data-table-groups.tsx +0 -288
- package/src/components/data-table-head.tsx +0 -280
- package/src/components/data-table-labels.ts +0 -198
- package/src/components/data-table-leading-row.tsx +0 -58
- package/src/components/data-table-mobile.tsx +0 -1117
- package/src/components/data-table-pagination.tsx +0 -202
- package/src/components/data-table-resize.ts +0 -188
- package/src/components/data-table-row-actions.tsx +0 -302
- package/src/components/data-table-row.tsx +0 -496
- package/src/components/data-table-selection.ts +0 -71
- package/src/components/data-table-shared.tsx +0 -287
- package/src/components/data-table-sort.ts +0 -163
- package/src/components/data-table-virtual.ts +0 -576
- package/src/components/data-table.tsx +0 -2598
- package/src/components/date-field.tsx +0 -684
- package/src/components/date-format-setting.tsx +0 -64
- package/src/components/date-picker.tsx +0 -404
- package/src/components/date-range-picker.tsx +0 -518
- package/src/components/description-list-labels.ts +0 -9
- package/src/components/description-list.tsx +0 -386
- package/src/components/dialog-frame-labels.ts +0 -7
- package/src/components/dialog-frame.tsx +0 -284
- package/src/components/disclosure.tsx +0 -476
- package/src/components/dropdown.tsx +0 -461
- package/src/components/empty-state.tsx +0 -136
- package/src/components/entity-combobox.tsx +0 -422
- package/src/components/error-boundary-labels.ts +0 -20
- package/src/components/error-boundary.tsx +0 -675
- package/src/components/facing-pair.ts +0 -93
- package/src/components/field-base-labels.ts +0 -20
- package/src/components/field-base.tsx +0 -656
- package/src/components/field-parts.tsx +0 -825
- package/src/components/field-strip.tsx +0 -129
- package/src/components/field.tsx +0 -206
- package/src/components/file-button.tsx +0 -295
- package/src/components/file-dropzone.tsx +0 -559
- package/src/components/floating-panel-labels.ts +0 -10
- package/src/components/floating-panel.tsx +0 -828
- package/src/components/focus-ring.ts +0 -16
- package/src/components/form-actions-labels.ts +0 -11
- package/src/components/form-actions.tsx +0 -578
- package/src/components/full-bleed-dialog.tsx +0 -294
- package/src/components/grouped-picker.tsx +0 -184
- package/src/components/help-popover.tsx +0 -117
- package/src/components/hover-menu.tsx +0 -343
- package/src/components/iban-input-labels.ts +0 -14
- package/src/components/iban-input.tsx +0 -236
- package/src/components/icon-button.tsx +0 -959
- package/src/components/icon-picker-labels.ts +0 -13
- package/src/components/icon-picker.tsx +0 -232
- package/src/components/image-grid-labels.ts +0 -11
- package/src/components/image-grid.tsx +0 -202
- package/src/components/inline-confirm.tsx +0 -116
- package/src/components/inline-edit-field-labels.ts +0 -11
- package/src/components/inline-edit-field.tsx +0 -552
- package/src/components/inline-entity-combobox.tsx +0 -849
- package/src/components/input.tsx +0 -394
- package/src/components/jump-calendar.tsx +0 -265
- package/src/components/language-select.tsx +0 -93
- package/src/components/legal-labels.ts +0 -105
- package/src/components/legal-page.tsx +0 -711
- package/src/components/legal.tsx +0 -668
- package/src/components/lightbox-labels.ts +0 -18
- package/src/components/lightbox.tsx +0 -399
- package/src/components/line-items-labels.ts +0 -14
- package/src/components/line-items.tsx +0 -602
- package/src/components/list-labels.ts +0 -12
- package/src/components/list.tsx +0 -870
- package/src/components/loading-state.tsx +0 -78
- package/src/components/measured-grid-labels.ts +0 -25
- package/src/components/measured-grid.tsx +0 -837
- package/src/components/menu-item.tsx +0 -241
- package/src/components/mini-calendar-labels.ts +0 -17
- package/src/components/mini-calendar.tsx +0 -792
- package/src/components/modal.tsx +0 -534
- package/src/components/money-draft.ts +0 -83
- package/src/components/money-field.tsx +0 -76
- package/src/components/month-grid.tsx +0 -229
- package/src/components/month-picker-labels.ts +0 -22
- package/src/components/month-picker.tsx +0 -1087
- package/src/components/multi-entity-combobox.tsx +0 -369
- package/src/components/multi-select.tsx +0 -376
- package/src/components/nav-pills.tsx +0 -198
- package/src/components/number-field.tsx +0 -327
- package/src/components/number-input.tsx +0 -559
- package/src/components/numeric-field.ts +0 -169
- package/src/components/numpad-sheet.tsx +0 -285
- package/src/components/one-time-code-input.tsx +0 -270
- package/src/components/page-contents-labels.ts +0 -9
- package/src/components/page-contents.tsx +0 -282
- package/src/components/page-header-context.ts +0 -8
- package/src/components/page-header.tsx +0 -298
- package/src/components/password-strength-labels.ts +0 -22
- package/src/components/password-strength.tsx +0 -241
- package/src/components/phone-input-labels.ts +0 -10
- package/src/components/phone-input.tsx +0 -282
- package/src/components/picker-sheet.tsx +0 -330
- package/src/components/pie-chart-labels.ts +0 -40
- package/src/components/pie-chart.tsx +0 -480
- package/src/components/popover-labels.ts +0 -14
- package/src/components/popover.tsx +0 -268
- package/src/components/progress-bar-labels.ts +0 -10
- package/src/components/progress-bar.tsx +0 -479
- package/src/components/qr-code.tsx +0 -76
- package/src/components/reauth-dialog-labels.ts +0 -13
- package/src/components/reauth-dialog.tsx +0 -265
- package/src/components/row-actions-labels.ts +0 -12
- package/src/components/row-actions.tsx +0 -795
- package/src/components/scroll-area.tsx +0 -123
- package/src/components/search-field.tsx +0 -192
- package/src/components/select.tsx +0 -294
- package/src/components/separator.tsx +0 -33
- package/src/components/series-chart-axes.ts +0 -342
- package/src/components/series-chart-budget.ts +0 -150
- package/src/components/series-chart-labels.ts +0 -33
- package/src/components/series-chart-thin.ts +0 -180
- package/src/components/series-chart-ticks.ts +0 -194
- package/src/components/series-chart.tsx +0 -1906
- package/src/components/server-wake-labels.ts +0 -11
- package/src/components/server-wake.tsx +0 -129
- package/src/components/settings-fields.tsx +0 -237
- package/src/components/share-card-labels.ts +0 -30
- package/src/components/share-card.tsx +0 -675
- package/src/components/signature-pad-labels.ts +0 -24
- package/src/components/signature-pad.tsx +0 -747
- package/src/components/signed-amount-labels.ts +0 -10
- package/src/components/signed-amount.tsx +0 -336
- package/src/components/skeleton.tsx +0 -80
- package/src/components/slider.tsx +0 -338
- package/src/components/sparkline-labels.ts +0 -14
- package/src/components/sparkline.tsx +0 -322
- package/src/components/spinner.tsx +0 -81
- package/src/components/stat-tile-labels.ts +0 -15
- package/src/components/stat-tile.tsx +0 -754
- package/src/components/status-dot.tsx +0 -170
- package/src/components/swatch-picker-labels.ts +0 -10
- package/src/components/swatch-picker.tsx +0 -283
- package/src/components/swipeable-row.tsx +0 -386
- package/src/components/switch.tsx +0 -273
- package/src/components/table-skeleton.tsx +0 -136
- package/src/components/table.tsx +0 -647
- package/src/components/tabs-labels.ts +0 -13
- package/src/components/tabs.tsx +0 -693
- package/src/components/text-link.tsx +0 -359
- package/src/components/text.tsx +0 -150
- package/src/components/textarea.tsx +0 -330
- package/src/components/tile-radio.tsx +0 -332
- package/src/components/time-input.tsx +0 -121
- package/src/components/toast-labels.ts +0 -12
- package/src/components/toast.tsx +0 -519
- package/src/components/toggle-group.tsx +0 -752
- package/src/components/toggle-legend.tsx +0 -394
- package/src/components/tooltip.tsx +0 -1149
- package/src/components/translation-review-editor.tsx +0 -290
- package/src/components/translation-review-labels.ts +0 -181
- package/src/components/translation-review-parts.tsx +0 -272
- package/src/components/translation-review.tsx +0 -1240
- package/src/components/tree-view.tsx +0 -589
- package/src/components/treemap-labels.ts +0 -47
- package/src/components/treemap-layout.ts +0 -210
- package/src/components/treemap.tsx +0 -1184
- package/src/components/trigger-aria.ts +0 -44
- package/src/components/use-anchor-dir.ts +0 -20
- package/src/components/use-mobile-reveal.ts +0 -62
- package/src/components/use-table-state.ts +0 -753
- package/src/components/user-avatar.tsx +0 -116
- package/src/components/wizard-stepper.tsx +0 -42
- package/src/components/write-lock-labels.ts +0 -10
- package/src/components/write-lock.tsx +0 -253
- package/src/currencies.ts +0 -90
- package/src/data-table.ts +0 -42
- package/src/demo/demo-banner.tsx +0 -153
- package/src/demo/demo-countdown.ts +0 -136
- package/src/demo/demo-ended.tsx +0 -90
- package/src/demo/demo-labels.ts +0 -78
- package/src/demo/demo-session.ts +0 -32
- package/src/demo/demo-start.tsx +0 -156
- package/src/eslint/index.ts +0 -161
- package/src/eslint/role-utilities.generated.ts +0 -146
- package/src/eslint/role-utilities.ts +0 -233
- package/src/feedback/feedback-attachment-download.tsx +0 -77
- package/src/feedback/feedback-attachment-labels.ts +0 -37
- package/src/feedback/feedback-attachment.tsx +0 -1239
- package/src/feedback/feedback-capture.ts +0 -287
- package/src/feedback/feedback-comment-thread.tsx +0 -353
- package/src/feedback/feedback-context-labels.ts +0 -11
- package/src/feedback/feedback-context.tsx +0 -245
- package/src/feedback/feedback-crash.ts +0 -547
- package/src/feedback/feedback-diagnostics.tsx +0 -41
- package/src/feedback/feedback-dialog-labels.ts +0 -29
- package/src/feedback/feedback-dialog.tsx +0 -452
- package/src/feedback/feedback-entry-file.tsx +0 -150
- package/src/feedback/feedback-inbox.tsx +0 -552
- package/src/feedback/feedback-labels.ts +0 -144
- package/src/feedback/feedback-menu-labels.ts +0 -12
- package/src/feedback/feedback-menu.tsx +0 -177
- package/src/feedback/feedback-mutation.ts +0 -20
- package/src/feedback/feedback-page-link.ts +0 -90
- package/src/feedback/feedback-public-labels.ts +0 -81
- package/src/feedback/feedback-public-list.tsx +0 -524
- package/src/feedback/feedback-public-switch.tsx +0 -102
- package/src/feedback/feedback-public-types.ts +0 -101
- package/src/feedback/feedback-record.ts +0 -428
- package/src/feedback/feedback-replies-context.ts +0 -9
- package/src/feedback/feedback-replies.tsx +0 -343
- package/src/feedback/feedback-rework-entry-chip.tsx +0 -18
- package/src/feedback/feedback-row-detail-labels.ts +0 -31
- package/src/feedback/feedback-row-detail.tsx +0 -871
- package/src/feedback/feedback-status-undo.ts +0 -109
- package/src/feedback/feedback-submit-dialog.tsx +0 -131
- package/src/feedback/feedback-submit.tsx +0 -270
- package/src/feedback/feedback-swipe.tsx +0 -192
- package/src/feedback/feedback-table-labels.ts +0 -27
- package/src/feedback/feedback-table.tsx +0 -912
- package/src/feedback/feedback-thread-labels.ts +0 -22
- package/src/feedback/feedback-thread-parts-labels.ts +0 -41
- package/src/feedback/feedback-thread.tsx +0 -905
- package/src/feedback/feedback-vocabulary.ts +0 -263
- package/src/feedback/feedback-vote-button.tsx +0 -124
- package/src/feedback.ts +0 -116
- package/src/hooks/use-anchored-panel.ts +0 -396
- package/src/hooks/use-anchored-rect.ts +0 -77
- package/src/hooks/use-announce.ts +0 -85
- package/src/hooks/use-authed-src.ts +0 -167
- package/src/hooks/use-body-scroll-lock.ts +0 -119
- package/src/hooks/use-breakpoint.ts +0 -133
- package/src/hooks/use-close-transition.ts +0 -107
- package/src/hooks/use-copy-to-clipboard.ts +0 -122
- package/src/hooks/use-debounce.ts +0 -114
- package/src/hooks/use-dismiss.ts +0 -371
- package/src/hooks/use-document-title.ts +0 -33
- package/src/hooks/use-file-drop.ts +0 -121
- package/src/hooks/use-file-picker-labels.ts +0 -28
- package/src/hooks/use-file-picker.tsx +0 -359
- package/src/hooks/use-focus-trap.ts +0 -199
- package/src/hooks/use-hotkey.ts +0 -212
- package/src/hooks/use-large-text.ts +0 -41
- package/src/hooks/use-long-press.ts +0 -140
- package/src/hooks/use-media-query.ts +0 -39
- package/src/hooks/use-mounted.ts +0 -39
- package/src/hooks/use-noindex.ts +0 -37
- package/src/hooks/use-overlay-history.ts +0 -714
- package/src/hooks/use-row-swipe.ts +0 -207
- package/src/hooks/use-search-param-state.ts +0 -434
- package/src/hooks/use-windowed-rows.ts +0 -225
- package/src/i18n/defaults.ts +0 -267
- package/src/i18n/german.ts +0 -2059
- package/src/i18n/kit-labels.tsx +0 -1003
- package/src/i18n/languages.ts +0 -349
- package/src/i18n/locales/de-CH.ts +0 -24
- package/src/i18n/locales/en.ts +0 -267
- package/src/i18n/locales/es.ts +0 -1999
- package/src/i18n/locales/fr.ts +0 -2037
- package/src/i18n/locales/hu.ts +0 -2004
- package/src/i18n/locales/it.ts +0 -2014
- package/src/i18n/locales/zh.ts +0 -1912
- package/src/i18n/plurals.ts +0 -86
- package/src/i18n/review.ts +0 -475
- package/src/i18n/shared-labels.ts +0 -138
- package/src/i18n/swiss.ts +0 -29
- package/src/index.ts +0 -1191
- package/src/landing/access.ts +0 -93
- package/src/landing/landing-actions.tsx +0 -97
- package/src/landing/landing-labels.ts +0 -59
- package/src/landing/landing-sections.tsx +0 -341
- package/src/landing/page-seo.ts +0 -261
- package/src/landing/public-header.tsx +0 -121
- package/src/landing/public-page.tsx +0 -106
- package/src/landing/routing.tsx +0 -225
- package/src/lib/broadcast.ts +0 -52
- package/src/lib/calc.ts +0 -323
- package/src/lib/chip-edge-snap.ts +0 -212
- package/src/lib/clipboard-minus.ts +0 -107
- package/src/lib/clipping.ts +0 -34
- package/src/lib/cn.ts +0 -28
- package/src/lib/column-mapping.ts +0 -234
- package/src/lib/countries.ts +0 -91
- package/src/lib/data-attributes.ts +0 -14
- package/src/lib/date-format.ts +0 -227
- package/src/lib/dates.ts +0 -288
- package/src/lib/day-format.ts +0 -96
- package/src/lib/decimal-marks.ts +0 -108
- package/src/lib/describe-failure.ts +0 -18
- package/src/lib/device-settings.ts +0 -147
- package/src/lib/direction.ts +0 -74
- package/src/lib/document-navigation.ts +0 -17
- package/src/lib/document-title.ts +0 -41
- package/src/lib/download.ts +0 -172
- package/src/lib/float-clearance.ts +0 -70
- package/src/lib/floating-stack.ts +0 -70
- package/src/lib/focus-left.ts +0 -156
- package/src/lib/format.ts +0 -585
- package/src/lib/http-status.ts +0 -38
- package/src/lib/iban.ts +0 -251
- package/src/lib/ime.ts +0 -24
- package/src/lib/intl-cache.ts +0 -27
- package/src/lib/iso-day.ts +0 -13
- package/src/lib/lazy-with-fallback.ts +0 -82
- package/src/lib/logger.ts +0 -69
- package/src/lib/minus.ts +0 -50
- package/src/lib/path-pattern.ts +0 -55
- package/src/lib/person-name.ts +0 -155
- package/src/lib/phone.ts +0 -208
- package/src/lib/plain-text.ts +0 -22
- package/src/lib/presence.ts +0 -18
- package/src/lib/qr-encode.ts +0 -444
- package/src/lib/quiet-focus.ts +0 -32
- package/src/lib/reduced-motion.ts +0 -22
- package/src/lib/refs.ts +0 -22
- package/src/lib/round.ts +0 -43
- package/src/lib/safe-storage.ts +0 -119
- package/src/lib/server-wake.ts +0 -315
- package/src/lib/session-refresh.ts +0 -472
- package/src/lib/share-format.ts +0 -18
- package/src/lib/status-tone.ts +0 -43
- package/src/lib/strip-fade.ts +0 -287
- package/src/lib/table-text.ts +0 -554
- package/src/lib/text-case.ts +0 -19
- package/src/lib/text-match.ts +0 -169
- package/src/lib/thenable.ts +0 -19
- package/src/lib/translation-review.ts +0 -769
- package/src/notifications/device-zone-report.ts +0 -67
- package/src/notifications/feedback-notification-types-labels.ts +0 -33
- package/src/notifications/feedback-notification-types.ts +0 -71
- package/src/notifications/notification-bell.tsx +0 -119
- package/src/notifications/notification-inbox.tsx +0 -309
- package/src/notifications/notification-parts.tsx +0 -81
- package/src/notifications/notification-types-setting.tsx +0 -406
- package/src/notifications/notification-types.ts +0 -89
- package/src/notifications/notifications-labels.ts +0 -287
- package/src/notifications/push-device-setting.tsx +0 -230
- package/src/notifications/push-devices-setting.tsx +0 -374
- package/src/notifications/push-worker.ts +0 -168
- package/src/notifications/quiet-hours-setting.tsx +0 -238
- package/src/notifications/unsubscribe-panel.tsx +0 -200
- package/src/notifications/use-push-device.ts +0 -448
- package/src/offline/local-first.ts +0 -100
- package/src/offline/pwa-update-prompt-labels.ts +0 -9
- package/src/offline/pwa-update-prompt.tsx +0 -78
- package/src/offline/query-persistence.ts +0 -391
- package/src/offline/service-worker-updates.ts +0 -81
- package/src/offline/shared-computer-labels.ts +0 -8
- package/src/offline/shared-computer.tsx +0 -87
- package/src/offline/sign-out-pending-dialog-labels.ts +0 -21
- package/src/offline/sign-out-pending-dialog.tsx +0 -135
- package/src/offline.ts +0 -37
- package/src/push-worker.ts +0 -25
- package/src/rhf/fields.tsx +0 -2187
- package/src/rhf/form-core.tsx +0 -324
- package/src/rhf/form.tsx +0 -12
- package/src/rhf/line-items.tsx +0 -135
- package/src/rhf/use-rhf-wizard-step.ts +0 -104
- package/src/rhf.ts +0 -21
- package/src/search/command-palette-labels.ts +0 -16
- package/src/search/command-palette.tsx +0 -624
- package/src/search/global-search-labels.ts +0 -13
- package/src/search/global-search.tsx +0 -660
- package/src/search/search-index.ts +0 -283
- package/src/search/use-command-key.ts +0 -23
- package/src/search.ts +0 -14
- package/src/settings/device-reset-setting-labels.ts +0 -20
- package/src/settings/device-reset-setting.tsx +0 -116
- package/src/settings/settings-card-classes.ts +0 -11
- package/src/settings/settings-catalogue.ts +0 -150
- package/src/settings/settings-context.ts +0 -33
- package/src/settings/settings-heading.tsx +0 -67
- package/src/settings/settings-labels.ts +0 -87
- package/src/settings/settings-layout.tsx +0 -471
- package/src/settings/settings-section.tsx +0 -108
- package/src/settings/use-account-appearance.ts +0 -148
- package/src/settings/use-account-language.ts +0 -146
- package/src/settings/use-settings-focus.ts +0 -128
- package/src/settings/use-settings-route.ts +0 -258
- package/src/shell/account-menu-language.tsx +0 -130
- package/src/shell/account-menu-text-size.tsx +0 -80
- package/src/shell/admin-menu.tsx +0 -183
- package/src/shell/app-shell-labels.ts +0 -11
- package/src/shell/app-shell.tsx +0 -1560
- package/src/shell/auth-layout.tsx +0 -186
- package/src/shell/company-switcher-labels.ts +0 -13
- package/src/shell/company-switcher.tsx +0 -136
- package/src/shell/dev-menu.tsx +0 -257
- package/src/shell/fill-height.tsx +0 -45
- package/src/shell/language-code.ts +0 -5
- package/src/shell/option-switcher-menu.tsx +0 -84
- package/src/shell/sync-status-indicator.tsx +0 -303
- package/src/shell/top-bar-actions.tsx +0 -87
- package/src/shell/top-bar-brand.tsx +0 -78
- package/src/shell/top-bar-parts-labels.ts +0 -148
- package/src/shell/top-bar.tsx +0 -40
- package/src/shell/topbar-action-menu.tsx +0 -567
- package/src/shell/topbar-controls.tsx +0 -269
- package/src/shell/tour-menu.tsx +0 -187
- package/src/shell.ts +0 -108
- package/src/sync/db.ts +0 -129
- package/src/sync/engine.ts +0 -1011
- package/src/sync/hooks.ts +0 -98
- package/src/sync/testing.ts +0 -73
- package/src/sync/wire.ts +0 -61
- package/src/sync.ts +0 -37
- package/src/table-text.ts +0 -8
- package/src/testing/css-variables.generated.ts +0 -112
- package/src/testing/css-variables.ts +0 -189
- package/src/testing/index.ts +0 -29
- package/src/testing/react.ts +0 -58
- package/src/testing/tour.ts +0 -41
- package/src/testing/viewport.ts +0 -357
- package/src/theme/chart-palette.ts +0 -232
- package/src/theme/color.ts +0 -272
- package/src/theme/contrast-tokens.ts +0 -268
- package/src/theme/contrast.ts +0 -250
- package/src/theme/palette-derive.ts +0 -825
- package/src/theme/palette-presets.ts +0 -544
- package/src/theme/palette-store.ts +0 -108
- package/src/theme/text-size.ts +0 -289
- package/src/theme/theme-store.ts +0 -157
- package/src/tour/tour-catalogue-labels.ts +0 -75
- package/src/tour/tour-catalogue.tsx +0 -335
- package/src/tour/tour-dock.ts +0 -134
- package/src/tour/tour-engine.ts +0 -37
- package/src/tour/tour-gates.ts +0 -218
- package/src/tour/tour-guide-button.tsx +0 -64
- package/src/tour/tour-guide-labels.ts +0 -15
- package/src/tour/tour-info.ts +0 -144
- package/src/tour/tour-labels.ts +0 -23
- package/src/tour/tour-overlay.tsx +0 -1170
- package/src/tour/tour.tsx +0 -750
- package/src/tour/use-tour-progress.ts +0 -671
- package/src/tour/use-tour-url-sync.ts +0 -266
- package/src/tour.ts +0 -21
- package/src/vite-env.d.ts +0 -23
- package/src/wizard/stepper-nav.tsx +0 -360
- package/src/wizard/types.ts +0 -275
- package/src/wizard/use-wizard.ts +0 -560
- package/src/wizard/validation.ts +0 -39
- package/src/wizard/wizard-context.tsx +0 -74
- package/src/wizard/wizard-labels.ts +0 -29
- package/src/wizard/wizard-step.tsx +0 -76
- package/src/wizard/wizard-summary.tsx +0 -84
- package/src/wizard.ts +0 -15
|
@@ -1,589 +0,0 @@
|
|
|
1
|
-
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
2
|
-
import type { ComponentPropsWithRef, KeyboardEvent, MouseEvent, ReactNode } from "react";
|
|
3
|
-
import { ChevronRight } from "lucide-react";
|
|
4
|
-
import { cn } from "../lib/cn";
|
|
5
|
-
import { horizontalStep } from "../lib/direction";
|
|
6
|
-
import { Spinner } from "./spinner";
|
|
7
|
-
import { FOCUS_RING } from "./focus-ring";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A hierarchy you walk with the keyboard: kastlan's chart of accounts (Assets › Current
|
|
11
|
-
* assets › Bank › 1020 Operating account), and — through {@link TreeRow} alone — the
|
|
12
|
-
* row labels of its gantt, which indent and fold like a tree but sit beside a timeline
|
|
13
|
-
* and so cannot be one.
|
|
14
|
-
*
|
|
15
|
-
* Both apps had written it as nested `<div>`s with a chevron button per row: every
|
|
16
|
-
* row a Tab stop (a 300-account chart was 300 presses to get past), no way to say
|
|
17
|
-
* "level 3 of 5, collapsed" to a screen reader, and no ←/→ at all. This is the WAI-ARIA
|
|
18
|
-
* tree pattern instead:
|
|
19
|
-
*
|
|
20
|
-
* - `role="tree"` › `treeitem` (with `aria-level`, `aria-expanded` on a parent,
|
|
21
|
-
* `aria-selected` when selectable) › `role="group"` for its children — so the
|
|
22
|
-
* reader announces the position and the state it needs.
|
|
23
|
-
* - ONE Tab stop (roving tabindex). ↑/↓ walk the visible rows, → opens a closed
|
|
24
|
-
* parent and then steps into it, ← closes an open one and then steps out to the
|
|
25
|
-
* parent, Home/End jump to the ends, `*` opens every sibling, and typing a few
|
|
26
|
-
* letters jumps to the next row that starts with them. ←/→ follow the reading
|
|
27
|
-
* direction (`horizontalStep`): in an RTL tree the children hang off to the left,
|
|
28
|
-
* and ← is what opens them.
|
|
29
|
-
* - Enter / Space, or a click, select. The chevron alone toggles on click.
|
|
30
|
-
*
|
|
31
|
-
* `expanded` and `selected` each work controlled or uncontrolled.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/* ── Nodes ───────────────────────────────────────────────────────────────── */
|
|
35
|
-
|
|
36
|
-
export interface TreeNode<T = unknown> {
|
|
37
|
-
/** Unique across the whole tree — it is what `expanded` and `selected` hold. */
|
|
38
|
-
id: string;
|
|
39
|
-
label: ReactNode;
|
|
40
|
-
/** The text type-ahead matches. Defaults to the row's rendered text. */
|
|
41
|
-
textValue?: string;
|
|
42
|
-
/** Before the label: an account-type icon, a colour dot. */
|
|
43
|
-
icon?: ReactNode;
|
|
44
|
-
/** After the label, pushed to the end of the row: a balance, a count, an action. */
|
|
45
|
-
trailing?: ReactNode;
|
|
46
|
-
children?: readonly TreeNode<T>[];
|
|
47
|
-
/**
|
|
48
|
-
* The node has children that are not loaded yet — it gets a chevron, and opening it
|
|
49
|
-
* calls `loadChildren`. Pass the children in `items` once they arrive.
|
|
50
|
-
*/
|
|
51
|
-
hasChildren?: boolean;
|
|
52
|
-
/** Focusable and announced as unavailable (`aria-disabled`), but not selectable. */
|
|
53
|
-
disabled?: boolean;
|
|
54
|
-
/** Anything of the host's own, handed back to `renderItem` and `onSelectedChange`. */
|
|
55
|
-
data?: T;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** What {@link TreeViewProps.renderItem} is told about a row. */
|
|
59
|
-
export interface TreeItemState {
|
|
60
|
-
level: number;
|
|
61
|
-
expanded: boolean;
|
|
62
|
-
selected: boolean;
|
|
63
|
-
/** It has children, loaded or not — it shows a chevron. */
|
|
64
|
-
expandable: boolean;
|
|
65
|
-
loading: boolean;
|
|
66
|
-
disabled: boolean;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* ── TreeRow ─────────────────────────────────────────────────────────────── */
|
|
70
|
-
|
|
71
|
-
export interface TreeRowProps extends ComponentPropsWithRef<"div"> {
|
|
72
|
-
/** 1 for a top-level row. Sets the indent and the number of guides. */
|
|
73
|
-
level: number;
|
|
74
|
-
/** `true`/`false` for a row that can fold; leave it `undefined` for a leaf, which
|
|
75
|
-
* gets a chevron-sized gap instead so labels at one level still line up. */
|
|
76
|
-
expanded?: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Make the chevron a real button (with `aria-expanded`, named by the label) that
|
|
79
|
-
* calls this. For a row used ON ITS OWN — kastlan's gantt labels, where each row is
|
|
80
|
-
* a line of a timeline and not an item of a tree widget. Inside {@link TreeView} it
|
|
81
|
-
* is omitted: the tree owns the keys, and a button per row would be a Tab stop per
|
|
82
|
-
* row, which is what the tree exists to remove.
|
|
83
|
-
*/
|
|
84
|
-
onToggle?: () => void;
|
|
85
|
-
/** The toggle button's name. By default it is named by the row's label (the state
|
|
86
|
-
* is `aria-expanded`'s to say); required when `children` replaces the label. */
|
|
87
|
-
toggleLabel?: string;
|
|
88
|
-
label: ReactNode;
|
|
89
|
-
icon?: ReactNode;
|
|
90
|
-
trailing?: ReactNode;
|
|
91
|
-
/** Pixels per level. Default 16. */
|
|
92
|
-
indent?: number;
|
|
93
|
-
/** Draw a vertical hairline per ancestor level. Default `true`. */
|
|
94
|
-
guides?: boolean;
|
|
95
|
-
selected?: boolean;
|
|
96
|
-
/** A spinner in place of the chevron, while lazy children load. */
|
|
97
|
-
loading?: boolean;
|
|
98
|
-
/** Replace the label + trailing part of the row (the indent and chevron stay). */
|
|
99
|
-
children?: ReactNode;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const DEFAULT_INDENT = 16;
|
|
103
|
-
/** The chevron's box; the guide for a level runs through its centre. */
|
|
104
|
-
const CHEVRON = 16;
|
|
105
|
-
/** The row's start padding, before any indent. */
|
|
106
|
-
const ROW_PAD = 4;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* One row: indent, guides, chevron, icon, label, trailing — no tree semantics of its
|
|
110
|
-
* own. {@link TreeView} is built from it, and a host that needs the look without the
|
|
111
|
-
* widget (a gantt's label column) uses it directly.
|
|
112
|
-
*
|
|
113
|
-
* Laid out with logical properties throughout (`padding-inline-start`,
|
|
114
|
-
* `inset-inline-start`), so the indent, the guides and the chevron all hang from the
|
|
115
|
-
* reading start in an RTL layout without a second code path.
|
|
116
|
-
*/
|
|
117
|
-
export function TreeRow({
|
|
118
|
-
level,
|
|
119
|
-
expanded,
|
|
120
|
-
onToggle,
|
|
121
|
-
toggleLabel,
|
|
122
|
-
label,
|
|
123
|
-
icon,
|
|
124
|
-
trailing,
|
|
125
|
-
indent = DEFAULT_INDENT,
|
|
126
|
-
guides = true,
|
|
127
|
-
selected,
|
|
128
|
-
loading,
|
|
129
|
-
children,
|
|
130
|
-
className,
|
|
131
|
-
style,
|
|
132
|
-
...rest
|
|
133
|
-
}: TreeRowProps) {
|
|
134
|
-
const labelId = useId();
|
|
135
|
-
const depth = Math.max(0, level - 1);
|
|
136
|
-
const expandable = expanded !== undefined;
|
|
137
|
-
// A right-pointing chevron that turns DOWN when open. In RTL it is mirrored to point
|
|
138
|
-
// left, and turning that one clockwise would point it UP — so it turns the other way.
|
|
139
|
-
const chevron = (
|
|
140
|
-
<ChevronRight
|
|
141
|
-
aria-hidden
|
|
142
|
-
className={cn(
|
|
143
|
-
"size-4 transition-transform motion-reduce:transition-none rtl:-scale-x-100",
|
|
144
|
-
expanded && "rotate-90 rtl:-rotate-90",
|
|
145
|
-
)}
|
|
146
|
-
/>
|
|
147
|
-
);
|
|
148
|
-
return (
|
|
149
|
-
<div
|
|
150
|
-
{...rest}
|
|
151
|
-
data-tree-row=""
|
|
152
|
-
data-selected={selected || undefined}
|
|
153
|
-
style={{ paddingInlineStart: ROW_PAD + depth * indent, ...style }}
|
|
154
|
-
className={cn(
|
|
155
|
-
"relative flex min-h-8 items-center gap-1.5 rounded pe-2 text-sm",
|
|
156
|
-
selected ? "bg-active font-medium text-primary" : "text-secondary",
|
|
157
|
-
className,
|
|
158
|
-
)}
|
|
159
|
-
>
|
|
160
|
-
{guides &&
|
|
161
|
-
Array.from({ length: depth }, (_, i) => (
|
|
162
|
-
<span
|
|
163
|
-
key={i}
|
|
164
|
-
aria-hidden
|
|
165
|
-
data-tree-guide=""
|
|
166
|
-
className="pointer-events-none absolute inset-y-0 w-px bg-[var(--border)]"
|
|
167
|
-
style={{ insetInlineStart: ROW_PAD + i * indent + CHEVRON / 2 }}
|
|
168
|
-
/>
|
|
169
|
-
))}
|
|
170
|
-
{loading ? (
|
|
171
|
-
<span className="flex size-4 shrink-0 items-center justify-center">
|
|
172
|
-
<Spinner label={null} className="size-3 border" />
|
|
173
|
-
</span>
|
|
174
|
-
) : expandable && onToggle ? (
|
|
175
|
-
<button
|
|
176
|
-
type="button"
|
|
177
|
-
aria-expanded={expanded}
|
|
178
|
-
aria-label={toggleLabel}
|
|
179
|
-
aria-labelledby={toggleLabel ? undefined : labelId}
|
|
180
|
-
onClick={(e) => {
|
|
181
|
-
e.stopPropagation();
|
|
182
|
-
onToggle();
|
|
183
|
-
}}
|
|
184
|
-
className={cn(
|
|
185
|
-
"flex size-4 shrink-0 items-center justify-center rounded text-muted outline-none hover:text-primary",
|
|
186
|
-
FOCUS_RING,
|
|
187
|
-
)}
|
|
188
|
-
>
|
|
189
|
-
{chevron}
|
|
190
|
-
</button>
|
|
191
|
-
) : expandable ? (
|
|
192
|
-
<span
|
|
193
|
-
data-tree-toggle=""
|
|
194
|
-
className="flex size-4 shrink-0 cursor-pointer items-center justify-center text-muted"
|
|
195
|
-
>
|
|
196
|
-
{chevron}
|
|
197
|
-
</span>
|
|
198
|
-
) : (
|
|
199
|
-
<span aria-hidden className="size-4 shrink-0" />
|
|
200
|
-
)}
|
|
201
|
-
{children ?? (
|
|
202
|
-
<>
|
|
203
|
-
{icon && <span className="flex shrink-0 items-center">{icon}</span>}
|
|
204
|
-
{/* One line at Normal; from Large up it wraps and the `min-h-8` row grows
|
|
205
|
-
(text size §10.17, round 0.34 T1: the sweep read "1020 Operat…"). */}
|
|
206
|
-
<span id={labelId} data-tree-label="" className="min-w-0 flex-1 truncate-until-large">
|
|
207
|
-
{label}
|
|
208
|
-
</span>
|
|
209
|
-
{trailing !== undefined && trailing !== null && (
|
|
210
|
-
<span className="ms-auto flex shrink-0 items-center gap-1 text-xs tabular-nums text-muted">{trailing}</span>
|
|
211
|
-
)}
|
|
212
|
-
</>
|
|
213
|
-
)}
|
|
214
|
-
</div>
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/* ── TreeView ────────────────────────────────────────────────────────────── */
|
|
219
|
-
|
|
220
|
-
export interface TreeViewProps<T = unknown> extends Omit<
|
|
221
|
-
ComponentPropsWithRef<"ul">,
|
|
222
|
-
"onSelect" | "children" | "defaultValue"
|
|
223
|
-
> {
|
|
224
|
-
items: readonly TreeNode<T>[];
|
|
225
|
-
/** Open nodes, controlled. */
|
|
226
|
-
expanded?: readonly string[];
|
|
227
|
-
/** Open nodes on first render, uncontrolled. */
|
|
228
|
-
defaultExpanded?: readonly string[];
|
|
229
|
-
onExpandedChange?: (expanded: string[]) => void;
|
|
230
|
-
/** The selected node's id, controlled; `null` for none. */
|
|
231
|
-
selected?: string | null;
|
|
232
|
-
defaultSelected?: string | null;
|
|
233
|
-
onSelectedChange?: (id: string, node: TreeNode<T>) => void;
|
|
234
|
-
/** `"none"` makes it a navigation-only tree: no `aria-selected`, Enter toggles. */
|
|
235
|
-
selectionMode?: "single" | "none";
|
|
236
|
-
/** The whole row content after the chevron, per node. Wins over `label`/`trailing`. */
|
|
237
|
-
renderItem?: (node: TreeNode<T>, state: TreeItemState) => ReactNode;
|
|
238
|
-
/**
|
|
239
|
-
* Called when a node with `hasChildren` and no `children` is opened. While the
|
|
240
|
-
* promise is pending the row shows a spinner and is `aria-busy`; put the children
|
|
241
|
-
* into `items` before it resolves (or after — the row opens either way).
|
|
242
|
-
*/
|
|
243
|
-
loadChildren?: (node: TreeNode<T>) => Promise<void> | void;
|
|
244
|
-
/** Pixels per level. Default 16. */
|
|
245
|
-
indent?: number;
|
|
246
|
-
/** Vertical hairlines per level. Default `true`. */
|
|
247
|
-
indentGuides?: boolean;
|
|
248
|
-
/** Extra classes for each row (the `TreeRow`), e.g. a denser height. */
|
|
249
|
-
rowClassName?: string;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
interface FlatNode<T> {
|
|
253
|
-
node: TreeNode<T>;
|
|
254
|
-
level: number;
|
|
255
|
-
parentId: string | null;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const isExpandable = (n: TreeNode<unknown>) => Boolean(n.children?.length || n.hasChildren);
|
|
259
|
-
|
|
260
|
-
/** Controlled when `value` is given, otherwise state seeded from `initial`. */
|
|
261
|
-
function useControllable<V>(value: V | undefined, initial: V): [V, (next: V) => void] {
|
|
262
|
-
const [own, setOwn] = useState<V>(initial);
|
|
263
|
-
const controlled = value !== undefined;
|
|
264
|
-
const set = (next: V) => {
|
|
265
|
-
if (!controlled) setOwn(next);
|
|
266
|
-
};
|
|
267
|
-
return [controlled ? value : own, set];
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/** How long a type-ahead run stays open between keys — the APG's suggested half second. */
|
|
271
|
-
const TYPEAHEAD_MS = 500;
|
|
272
|
-
|
|
273
|
-
export function TreeView<T = unknown>({
|
|
274
|
-
items,
|
|
275
|
-
expanded: expandedProp,
|
|
276
|
-
defaultExpanded,
|
|
277
|
-
onExpandedChange,
|
|
278
|
-
selected: selectedProp,
|
|
279
|
-
defaultSelected,
|
|
280
|
-
onSelectedChange,
|
|
281
|
-
selectionMode = "single",
|
|
282
|
-
renderItem,
|
|
283
|
-
loadChildren,
|
|
284
|
-
indent = DEFAULT_INDENT,
|
|
285
|
-
indentGuides = true,
|
|
286
|
-
rowClassName,
|
|
287
|
-
className,
|
|
288
|
-
onKeyDown,
|
|
289
|
-
onClick,
|
|
290
|
-
...rest
|
|
291
|
-
}: TreeViewProps<T>) {
|
|
292
|
-
const [expandedList, setExpandedOwn] = useControllable<readonly string[]>(expandedProp, defaultExpanded ?? []);
|
|
293
|
-
const [selected, setSelectedOwn] = useControllable<string | null>(selectedProp, defaultSelected ?? null);
|
|
294
|
-
const expandedSet = useMemo(() => new Set(expandedList), [expandedList]);
|
|
295
|
-
const [loading, setLoading] = useState<ReadonlySet<string>>(() => new Set());
|
|
296
|
-
const [focusedId, setFocusedId] = useState<string | null>(null);
|
|
297
|
-
const itemRefs = useRef(new Map<string, HTMLLIElement>());
|
|
298
|
-
const pendingFocus = useRef<string | null>(null);
|
|
299
|
-
const typeahead = useRef({ text: "", at: 0 });
|
|
300
|
-
const baseId = useId();
|
|
301
|
-
|
|
302
|
-
// Every node by id (for parents and lookups), and the rows currently on screen in
|
|
303
|
-
// order — the list the arrow keys walk.
|
|
304
|
-
const { byId, visible } = useMemo(() => {
|
|
305
|
-
const map = new Map<string, FlatNode<T>>();
|
|
306
|
-
const rows: FlatNode<T>[] = [];
|
|
307
|
-
const walk = (nodes: readonly TreeNode<T>[], level: number, parentId: string | null, shown: boolean) => {
|
|
308
|
-
for (const node of nodes) {
|
|
309
|
-
const flat = { node, level, parentId };
|
|
310
|
-
map.set(node.id, flat);
|
|
311
|
-
if (shown) rows.push(flat);
|
|
312
|
-
if (node.children) walk(node.children, level + 1, node.id, shown && expandedSet.has(node.id));
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
walk(items, 1, null, true);
|
|
316
|
-
return { byId: map, visible: rows };
|
|
317
|
-
}, [items, expandedSet]);
|
|
318
|
-
|
|
319
|
-
// The one tabbable row. Focus that was inside a branch that has since closed (a
|
|
320
|
-
// click on its parent's chevron) moves up to the nearest ancestor still on screen,
|
|
321
|
-
// so the tab stop never points at a row that is not rendered.
|
|
322
|
-
const visibleIds = useMemo(() => new Set(visible.map((f) => f.node.id)), [visible]);
|
|
323
|
-
const nearestVisible = (id: string | null): string | null => {
|
|
324
|
-
let cur = id;
|
|
325
|
-
while (cur && !visibleIds.has(cur)) cur = byId.get(cur)?.parentId ?? null;
|
|
326
|
-
return cur;
|
|
327
|
-
};
|
|
328
|
-
const tabbable = nearestVisible(focusedId) ?? nearestVisible(selected) ?? visible[0]?.node.id ?? null;
|
|
329
|
-
|
|
330
|
-
useEffect(() => {
|
|
331
|
-
const id = pendingFocus.current;
|
|
332
|
-
if (!id) return;
|
|
333
|
-
pendingFocus.current = null;
|
|
334
|
-
itemRefs.current.get(id)?.focus();
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
const focusRow = (id: string) => {
|
|
338
|
-
setFocusedId(id);
|
|
339
|
-
// After the commit: moving into a branch that just opened targets a row that is
|
|
340
|
-
// not in the DOM yet.
|
|
341
|
-
pendingFocus.current = id;
|
|
342
|
-
itemRefs.current.get(id)?.focus();
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
const setExpanded = (next: Set<string>) => {
|
|
346
|
-
const list = [...next];
|
|
347
|
-
setExpandedOwn(list);
|
|
348
|
-
onExpandedChange?.(list);
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
const open = (node: TreeNode<T>) => {
|
|
352
|
-
if (expandedSet.has(node.id) || !isExpandable(node)) return;
|
|
353
|
-
const next = new Set(expandedSet);
|
|
354
|
-
next.add(node.id);
|
|
355
|
-
setExpanded(next);
|
|
356
|
-
if (loadChildren && node.hasChildren && !node.children?.length) {
|
|
357
|
-
const pending = loadChildren(node);
|
|
358
|
-
if (pending && typeof pending.then === "function") {
|
|
359
|
-
setLoading((s) => new Set(s).add(node.id));
|
|
360
|
-
const done = () =>
|
|
361
|
-
setLoading((s) => {
|
|
362
|
-
const n = new Set(s);
|
|
363
|
-
n.delete(node.id);
|
|
364
|
-
return n;
|
|
365
|
-
});
|
|
366
|
-
pending.then(done, done);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
|
|
371
|
-
const close = (node: TreeNode<T>) => {
|
|
372
|
-
if (!expandedSet.has(node.id)) return;
|
|
373
|
-
const next = new Set(expandedSet);
|
|
374
|
-
next.delete(node.id);
|
|
375
|
-
setExpanded(next);
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
const toggle = (node: TreeNode<T>) => (expandedSet.has(node.id) ? close(node) : open(node));
|
|
379
|
-
|
|
380
|
-
const select = (node: TreeNode<T>) => {
|
|
381
|
-
if (node.disabled) return;
|
|
382
|
-
if (selectionMode === "none") {
|
|
383
|
-
toggle(node);
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
setSelectedOwn(node.id);
|
|
387
|
-
onSelectedChange?.(node.id, node);
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
const idOf = (target: EventTarget | null): string | null =>
|
|
391
|
-
(target as Element | null)?.closest?.<HTMLElement>('[role="treeitem"]')?.dataset.treeId ?? null;
|
|
392
|
-
|
|
393
|
-
const textOf = (flat: FlatNode<T>): string => {
|
|
394
|
-
if (flat.node.textValue !== undefined) return flat.node.textValue;
|
|
395
|
-
if (typeof flat.node.label === "string") return flat.node.label;
|
|
396
|
-
const row = itemRefs.current.get(flat.node.id)?.querySelector("[data-tree-row]");
|
|
397
|
-
return row?.textContent ?? "";
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
const findByText = (fromIndex: number, text: string): string | null => {
|
|
401
|
-
const needle = text.toLocaleLowerCase();
|
|
402
|
-
for (let i = 1; i <= visible.length; i++) {
|
|
403
|
-
const flat = visible[(fromIndex + i) % visible.length];
|
|
404
|
-
if (textOf(flat).trim().toLocaleLowerCase().startsWith(needle)) return flat.node.id;
|
|
405
|
-
}
|
|
406
|
-
return null;
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
const handleKeyDown = (e: KeyboardEvent<HTMLUListElement>) => {
|
|
410
|
-
onKeyDown?.(e);
|
|
411
|
-
if (e.defaultPrevented) return;
|
|
412
|
-
const id = idOf(e.target);
|
|
413
|
-
const flat = id ? byId.get(id) : undefined;
|
|
414
|
-
if (!flat) return;
|
|
415
|
-
const { node } = flat;
|
|
416
|
-
const index = visible.findIndex((f) => f.node.id === node.id);
|
|
417
|
-
const expandedNow = expandedSet.has(node.id);
|
|
418
|
-
// Forward / backward along the reading direction, from the row itself.
|
|
419
|
-
const step = horizontalStep(e.key, e.target as Element);
|
|
420
|
-
// A space inside a type-ahead run is part of the name being typed ("current a…"),
|
|
421
|
-
// not a request to select.
|
|
422
|
-
const inRun = Date.now() - typeahead.current.at < TYPEAHEAD_MS && typeahead.current.text !== "";
|
|
423
|
-
const key = e.key === " " && inRun ? "typeahead" : e.key;
|
|
424
|
-
|
|
425
|
-
let handled = true;
|
|
426
|
-
if (step === 1) {
|
|
427
|
-
if (!isExpandable(node)) handled = false;
|
|
428
|
-
else if (!expandedNow) open(node);
|
|
429
|
-
else if (node.children?.length) focusRow(node.children[0].id);
|
|
430
|
-
} else if (step === -1) {
|
|
431
|
-
if (expandedNow) close(node);
|
|
432
|
-
else if (flat.parentId) focusRow(flat.parentId);
|
|
433
|
-
else handled = false;
|
|
434
|
-
} else {
|
|
435
|
-
switch (key) {
|
|
436
|
-
case "ArrowDown":
|
|
437
|
-
if (index < visible.length - 1) focusRow(visible[index + 1].node.id);
|
|
438
|
-
break;
|
|
439
|
-
case "ArrowUp":
|
|
440
|
-
if (index > 0) focusRow(visible[index - 1].node.id);
|
|
441
|
-
break;
|
|
442
|
-
case "Home":
|
|
443
|
-
if (visible.length) focusRow(visible[0].node.id);
|
|
444
|
-
break;
|
|
445
|
-
case "End":
|
|
446
|
-
if (visible.length) focusRow(visible[visible.length - 1].node.id);
|
|
447
|
-
break;
|
|
448
|
-
case "Enter":
|
|
449
|
-
case " ":
|
|
450
|
-
select(node);
|
|
451
|
-
break;
|
|
452
|
-
case "*": {
|
|
453
|
-
// Every sibling at this level, as the pattern suggests.
|
|
454
|
-
const siblings = flat.parentId ? (byId.get(flat.parentId)?.node.children ?? []) : items;
|
|
455
|
-
const next = new Set(expandedSet);
|
|
456
|
-
for (const s of siblings) if (isExpandable(s)) next.add(s.id);
|
|
457
|
-
setExpanded(next);
|
|
458
|
-
break;
|
|
459
|
-
}
|
|
460
|
-
default: {
|
|
461
|
-
const printable = e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
|
|
462
|
-
if (!printable) {
|
|
463
|
-
handled = false;
|
|
464
|
-
break;
|
|
465
|
-
}
|
|
466
|
-
const now = Date.now();
|
|
467
|
-
const run = now - typeahead.current.at < TYPEAHEAD_MS ? typeahead.current.text : "";
|
|
468
|
-
typeahead.current = { text: run + e.key, at: now };
|
|
469
|
-
const typed = typeahead.current.text;
|
|
470
|
-
// "aaa" cycles through the rows starting with "a", as a file list does;
|
|
471
|
-
// anything else extends the prefix, searched from the row after this one
|
|
472
|
-
// (or from this one, when it still matches the longer prefix).
|
|
473
|
-
const repeated = typed.length > 1 && [...typed].every((c) => c === typed[0]);
|
|
474
|
-
const target = repeated
|
|
475
|
-
? findByText(index, typed[0])
|
|
476
|
-
: typed.length > 1 && textOf(flat).trim().toLocaleLowerCase().startsWith(typed.toLocaleLowerCase())
|
|
477
|
-
? node.id
|
|
478
|
-
: findByText(index, typed);
|
|
479
|
-
if (target) focusRow(target);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
if (handled) {
|
|
484
|
-
e.preventDefault();
|
|
485
|
-
e.stopPropagation();
|
|
486
|
-
}
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
const handleClick = (e: MouseEvent<HTMLUListElement>) => {
|
|
490
|
-
onClick?.(e);
|
|
491
|
-
const id = idOf(e.target);
|
|
492
|
-
const flat = id ? byId.get(id) : undefined;
|
|
493
|
-
if (!flat) return;
|
|
494
|
-
// Controls a host rendered into a row (an action in `trailing`) are their own.
|
|
495
|
-
const control = (e.target as Element).closest("button, a[href], input, select, textarea");
|
|
496
|
-
if (control && itemRefs.current.get(flat.node.id)?.contains(control)) return;
|
|
497
|
-
setFocusedId(flat.node.id);
|
|
498
|
-
if ((e.target as Element).closest("[data-tree-toggle]")) {
|
|
499
|
-
toggle(flat.node);
|
|
500
|
-
return;
|
|
501
|
-
}
|
|
502
|
-
select(flat.node);
|
|
503
|
-
};
|
|
504
|
-
|
|
505
|
-
const renderNodes = (nodes: readonly TreeNode<T>[], level: number, path: string): ReactNode =>
|
|
506
|
-
nodes.map((node, i) => {
|
|
507
|
-
// Named by its own row, not by its content: a treeitem's content is the whole
|
|
508
|
-
// open branch below it, and "Assets Current assets 1020 Bank …" is not a name.
|
|
509
|
-
// A path of indices, because a host's id may hold spaces an idref cannot.
|
|
510
|
-
const rowId = `${baseId}-${path}${i}`;
|
|
511
|
-
const expandable = isExpandable(node);
|
|
512
|
-
const isOpen = expandable && expandedSet.has(node.id);
|
|
513
|
-
const isSelected = selectionMode !== "none" && selected === node.id;
|
|
514
|
-
const isLoading = loading.has(node.id);
|
|
515
|
-
const state: TreeItemState = {
|
|
516
|
-
level,
|
|
517
|
-
expanded: isOpen,
|
|
518
|
-
selected: isSelected,
|
|
519
|
-
expandable,
|
|
520
|
-
loading: isLoading,
|
|
521
|
-
disabled: Boolean(node.disabled),
|
|
522
|
-
};
|
|
523
|
-
return (
|
|
524
|
-
<li
|
|
525
|
-
key={node.id}
|
|
526
|
-
ref={(el) => {
|
|
527
|
-
if (el) itemRefs.current.set(node.id, el);
|
|
528
|
-
else itemRefs.current.delete(node.id);
|
|
529
|
-
}}
|
|
530
|
-
role="treeitem"
|
|
531
|
-
data-tree-id={node.id}
|
|
532
|
-
aria-labelledby={rowId}
|
|
533
|
-
aria-level={level}
|
|
534
|
-
aria-expanded={expandable ? isOpen : undefined}
|
|
535
|
-
aria-selected={selectionMode === "none" ? undefined : isSelected}
|
|
536
|
-
aria-disabled={node.disabled || undefined}
|
|
537
|
-
aria-busy={isLoading || undefined}
|
|
538
|
-
tabIndex={node.id === tabbable ? 0 : -1}
|
|
539
|
-
onFocus={(e) => {
|
|
540
|
-
// Only the row itself: a focus event bubbling up from a nested row, or from
|
|
541
|
-
// a control inside this one, is not this row being focused.
|
|
542
|
-
if (e.target === e.currentTarget) setFocusedId(node.id);
|
|
543
|
-
}}
|
|
544
|
-
// The ring goes on this row's own box, not the <li>: the <li> contains the
|
|
545
|
-
// whole open branch below it, and ringing that would outline a subtree.
|
|
546
|
-
className="outline-none [&:focus-visible>[data-tree-row]]:ring-focus [&:focus-visible>[data-tree-row]]:ring-brand"
|
|
547
|
-
>
|
|
548
|
-
<TreeRow
|
|
549
|
-
id={rowId}
|
|
550
|
-
level={level}
|
|
551
|
-
expanded={expandable ? isOpen : undefined}
|
|
552
|
-
label={node.label}
|
|
553
|
-
icon={node.icon}
|
|
554
|
-
trailing={node.trailing}
|
|
555
|
-
indent={indent}
|
|
556
|
-
guides={indentGuides}
|
|
557
|
-
selected={isSelected}
|
|
558
|
-
loading={isLoading}
|
|
559
|
-
className={cn(
|
|
560
|
-
node.disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-hover",
|
|
561
|
-
rowClassName,
|
|
562
|
-
)}
|
|
563
|
-
>
|
|
564
|
-
{renderItem ? renderItem(node, state) : undefined}
|
|
565
|
-
</TreeRow>
|
|
566
|
-
{isOpen && (
|
|
567
|
-
<ul role="group">
|
|
568
|
-
{/* Empty while lazy children load: a "Loading…" line in here would be
|
|
569
|
-
a child that is not a treeitem, and the parent row already says
|
|
570
|
-
`aria-busy` and shows the spinner. */}
|
|
571
|
-
{node.children?.length ? renderNodes(node.children, level + 1, `${path}${i}-`) : null}
|
|
572
|
-
</ul>
|
|
573
|
-
)}
|
|
574
|
-
</li>
|
|
575
|
-
);
|
|
576
|
-
});
|
|
577
|
-
|
|
578
|
-
return (
|
|
579
|
-
<ul
|
|
580
|
-
{...rest}
|
|
581
|
-
role="tree"
|
|
582
|
-
onKeyDown={handleKeyDown}
|
|
583
|
-
onClick={handleClick}
|
|
584
|
-
className={cn("flex flex-col text-sm", className)}
|
|
585
|
-
>
|
|
586
|
-
{renderNodes(items, 1, "")}
|
|
587
|
-
</ul>
|
|
588
|
-
);
|
|
589
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// All user-facing strings for `Treemap`, as the `treemap` namespace of
|
|
2
|
-
// `<UiKitProvider labels>`, and per map the `labels` prop over that (0.52, refactor audit
|
|
3
|
-
// 2026-10-30, DSP-5).
|
|
4
|
-
//
|
|
5
|
-
// A module of its own, with no recharts in it, for the reason `pie-chart-labels` is one:
|
|
6
|
-
// the label registry (src/i18n) imports the defaults, and must not pull the chart
|
|
7
|
-
// library in behind them.
|
|
8
|
-
|
|
9
|
-
export interface TreemapLabels {
|
|
10
|
-
/**
|
|
11
|
-
* One tile's accessible name — what a screen reader says for a tile, clickable or
|
|
12
|
-
* not, since its area is nothing it can say. `value` arrives through the map's
|
|
13
|
-
* `valueFormatter` when that returns text, else as the number in the provider's
|
|
14
|
-
* locale; `share` is the tile's share of what is drawn, already a formatted percent
|
|
15
|
-
* ("60 %" in German, "60%" in English) — the function only arranges them.
|
|
16
|
-
*
|
|
17
|
-
* `share` is `""` when the map's `shareInValue` says the formatter's text already holds
|
|
18
|
-
* it (0.53): leave out whatever frames it, as every catalogue drops its " (share)" —
|
|
19
|
-
* "Migros: CHF 412.30 · 12%", not "… · 12% ()".
|
|
20
|
-
*/
|
|
21
|
-
tile: (name: string, value: string, share: string) => string;
|
|
22
|
-
/**
|
|
23
|
-
* A group's accessible name (0.52, `TreemapNode.children`): its frame is a stop of the
|
|
24
|
-
* map's keyboard before its tiles, so a reader hears the group and its total once, on the
|
|
25
|
-
* way in. `value` and `share` as for {@link TreemapLabels.tile}, of the group's tiles
|
|
26
|
-
* together, the share `""` under `shareInValue` as there; the word "group" tells it from
|
|
27
|
-
* a tile of the same shape.
|
|
28
|
-
*/
|
|
29
|
-
group: (name: string, value: string, share: string) => string;
|
|
30
|
-
/**
|
|
31
|
-
* A name inside a group: `name` is the tile's (or a nested group's) own, from
|
|
32
|
-
* {@link TreemapLabels.tile} or {@link TreemapLabels.group}, and `group` the name of the
|
|
33
|
-
* group round it — applied once per group, the innermost first, so a tile two levels deep
|
|
34
|
-
* reads "Rent: 1,050 (40%), in Housing, in Fixed costs". In the name rather than said once
|
|
35
|
-
* by the frame, because Home, End and a click land on a tile without passing its frame.
|
|
36
|
-
*/
|
|
37
|
-
inGroup: (name: string, group: string) => string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// The share in brackets only when there is one: `""` under the map's `shareInValue` (0.53,
|
|
41
|
-
// keksdose after 0.52), which the catalogues in src/i18n/locales follow, each in its own
|
|
42
|
-
// typography.
|
|
43
|
-
export const DEFAULT_TREEMAP_LABELS: TreemapLabels = {
|
|
44
|
-
tile: (name, value, share) => `${name}: ${value}${share ? ` (${share})` : ""}`,
|
|
45
|
-
group: (name, value, share) => `${name}, group: ${value}${share ? ` (${share})` : ""}`,
|
|
46
|
-
inGroup: (name, group) => `${name}, in ${group}`,
|
|
47
|
-
};
|