@eifi1/ui-kit 0.4.1 → 0.5.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/LICENSE +32 -0
- package/README.md +498 -57
- package/dist/chart.d.ts +10 -0
- package/dist/chart.js +10 -0
- package/dist/chart.js.map +1 -0
- package/dist/components/account-settings.d.ts +11 -0
- package/dist/components/account-settings.js +19 -12
- package/dist/components/account-settings.js.map +1 -1
- package/dist/components/alert-banner.d.ts +10 -6
- package/dist/components/alert-banner.js +20 -16
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.d.ts +30 -4
- package/dist/components/amount-input.js +36 -14
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/calculator.d.ts +24 -7
- package/dist/components/calculator.js +37 -20
- package/dist/components/calculator.js.map +1 -1
- package/dist/components/chart-zoom.d.ts +156 -0
- package/dist/components/chart-zoom.js +262 -0
- package/dist/components/chart-zoom.js.map +1 -0
- package/dist/components/chart.d.ts +28 -3
- package/dist/components/chart.js +71 -32
- package/dist/components/chart.js.map +1 -1
- package/dist/components/checkbox.d.ts +51 -0
- package/dist/components/checkbox.js +123 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/chip.d.ts +128 -0
- package/dist/components/chip.js +357 -0
- package/dist/components/chip.js.map +1 -0
- package/dist/components/choice-parts.d.ts +24 -0
- package/dist/components/choice-parts.js +18 -0
- package/dist/components/choice-parts.js.map +1 -0
- package/dist/components/combobox-core.d.ts +52 -9
- package/dist/components/combobox-core.js +89 -19
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.d.ts +43 -33
- package/dist/components/combobox.js +409 -340
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/currency-select.d.ts +48 -8
- package/dist/components/currency-select.js +107 -65
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/data-table-filter-popover.d.ts +15 -3
- package/dist/components/data-table-filter-popover.js +23 -17
- 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-filters.js +3 -2
- package/dist/components/data-table-filters.js.map +1 -1
- package/dist/components/data-table-labels.d.ts +53 -2
- package/dist/components/data-table-labels.js +31 -2
- package/dist/components/data-table-labels.js.map +1 -1
- package/dist/components/data-table-pagination.d.ts +3 -1
- package/dist/components/data-table-pagination.js +16 -10
- package/dist/components/data-table-pagination.js.map +1 -1
- package/dist/components/data-table-sort.js +1 -0
- package/dist/components/data-table-sort.js.map +1 -1
- package/dist/components/data-table.d.ts +1 -1
- package/dist/components/data-table.js +201 -85
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +25 -9
- package/dist/components/date-picker.js +232 -94
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/dropdown.d.ts +74 -19
- package/dist/components/dropdown.js +72 -22
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/entity-combobox.d.ts +5 -4
- package/dist/components/entity-combobox.js +107 -76
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/facing-pair.d.ts +36 -0
- package/dist/components/facing-pair.js +40 -0
- package/dist/components/facing-pair.js.map +1 -0
- package/dist/components/field-sync.d.ts +164 -0
- package/dist/components/field-sync.js +264 -0
- package/dist/components/field-sync.js.map +1 -0
- package/dist/components/file-dropzone.d.ts +21 -7
- package/dist/components/file-dropzone.js +28 -7
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/full-bleed-dialog.d.ts +37 -26
- package/dist/components/full-bleed-dialog.js +20 -5
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/grouped-picker.d.ts +21 -10
- package/dist/components/grouped-picker.js +66 -52
- package/dist/components/grouped-picker.js.map +1 -1
- package/dist/components/hover-menu.d.ts +20 -4
- package/dist/components/hover-menu.js +15 -4
- package/dist/components/hover-menu.js.map +1 -1
- package/dist/components/mini-calendar.d.ts +102 -14
- package/dist/components/mini-calendar.js +256 -70
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.d.ts +9 -3
- package/dist/components/modal.js +34 -45
- package/dist/components/modal.js.map +1 -1
- package/dist/components/month-picker.d.ts +79 -0
- package/dist/components/month-picker.js +342 -0
- package/dist/components/month-picker.js.map +1 -0
- package/dist/components/multi-entity-combobox.d.ts +7 -6
- package/dist/components/multi-entity-combobox.js +112 -72
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/multi-select.d.ts +13 -11
- package/dist/components/multi-select.js +161 -84
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/number-field.d.ts +92 -0
- package/dist/components/number-field.js +111 -0
- package/dist/components/number-field.js.map +1 -0
- package/dist/components/number-input.d.ts +21 -2
- package/dist/components/number-input.js +2 -1
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.d.ts +25 -4
- package/dist/components/numpad-sheet.js +30 -13
- package/dist/components/numpad-sheet.js.map +1 -1
- package/dist/components/page-contents.d.ts +90 -0
- package/dist/components/page-contents.js +170 -0
- package/dist/components/page-contents.js.map +1 -0
- package/dist/components/password-strength.d.ts +106 -0
- package/dist/components/password-strength.js +132 -0
- package/dist/components/password-strength.js.map +1 -0
- package/dist/components/picker-sheet.d.ts +23 -15
- package/dist/components/picker-sheet.js +34 -14
- package/dist/components/picker-sheet.js.map +1 -1
- package/dist/components/popover.d.ts +62 -4
- package/dist/components/popover.js +52 -2
- package/dist/components/popover.js.map +1 -1
- package/dist/components/search-field.d.ts +25 -7
- package/dist/components/search-field.js +7 -5
- package/dist/components/search-field.js.map +1 -1
- package/dist/components/series-chart-labels.d.ts +14 -0
- package/dist/components/series-chart-labels.js +11 -0
- package/dist/components/series-chart-labels.js.map +1 -0
- package/dist/components/series-chart.d.ts +207 -0
- package/dist/components/series-chart.js +223 -0
- package/dist/components/series-chart.js.map +1 -0
- package/dist/components/settings-fields.d.ts +14 -4
- package/dist/components/settings-fields.js +19 -8
- package/dist/components/settings-fields.js.map +1 -1
- package/dist/components/signature-pad.d.ts +119 -0
- package/dist/components/signature-pad.js +405 -0
- package/dist/components/signature-pad.js.map +1 -0
- package/dist/components/slider.d.ts +80 -0
- package/dist/components/slider.js +155 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/sparkline.d.ts +93 -0
- package/dist/components/sparkline.js +205 -0
- package/dist/components/sparkline.js.map +1 -0
- package/dist/components/stat-tile.d.ts +151 -0
- package/dist/components/stat-tile.js +236 -0
- package/dist/components/stat-tile.js.map +1 -0
- package/dist/components/swipeable-row.d.ts +25 -2
- package/dist/components/swipeable-row.js +31 -0
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/switch.d.ts +60 -0
- package/dist/components/switch.js +81 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/time-input.d.ts +58 -0
- package/dist/components/time-input.js +50 -0
- package/dist/components/time-input.js.map +1 -0
- package/dist/components/toggle-group.d.ts +18 -3
- package/dist/components/toggle-group.js +10 -6
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle-legend.d.ts +115 -0
- package/dist/components/toggle-legend.js +114 -0
- package/dist/components/toggle-legend.js.map +1 -0
- package/dist/components/tooltip.d.ts +40 -11
- package/dist/components/tooltip.js +77 -20
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/treemap.d.ts +132 -0
- package/dist/components/treemap.js +179 -0
- package/dist/components/treemap.js.map +1 -0
- package/dist/components/ui.d.ts +159 -46
- package/dist/components/ui.js +220 -115
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-mobile-reveal.js +1 -0
- package/dist/components/use-mobile-reveal.js.map +1 -1
- package/dist/components/use-table-state.d.ts +1 -1
- package/dist/components/use-table-state.js +38 -17
- package/dist/components/use-table-state.js.map +1 -1
- package/dist/components/user-avatar.d.ts +5 -3
- package/dist/components/user-avatar.js +4 -2
- package/dist/components/user-avatar.js.map +1 -1
- package/dist/components/wizard-stepper.js +3 -2
- package/dist/components/wizard-stepper.js.map +1 -1
- package/dist/{data-table-filters-aXyf0Xub.d.ts → data-table-filters-DM1auUfH.d.ts} +27 -5
- package/dist/data-table.d.ts +7 -0
- package/dist/data-table.js +12 -0
- package/dist/data-table.js.map +1 -0
- package/dist/feedback/feedback-attachment.js +12 -11
- package/dist/feedback/feedback-attachment.js.map +1 -1
- package/dist/feedback/feedback-dialog.js +2 -1
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.d.ts +33 -7
- package/dist/feedback/feedback-inbox.js +49 -37
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback.d.ts +5 -0
- package/dist/feedback.js +5 -0
- package/dist/feedback.js.map +1 -0
- package/dist/hooks/use-anchored-panel.js +1 -0
- package/dist/hooks/use-anchored-panel.js.map +1 -1
- package/dist/hooks/use-anchored-rect.js +1 -0
- package/dist/hooks/use-anchored-rect.js.map +1 -1
- package/dist/hooks/use-announce.d.ts +46 -0
- package/dist/hooks/use-announce.js +37 -0
- package/dist/hooks/use-announce.js.map +1 -0
- package/dist/hooks/use-body-scroll-lock.js +1 -0
- package/dist/hooks/use-body-scroll-lock.js.map +1 -1
- package/dist/hooks/use-close-transition.js +1 -0
- package/dist/hooks/use-close-transition.js.map +1 -1
- package/dist/hooks/use-dismiss.js +1 -0
- package/dist/hooks/use-dismiss.js.map +1 -1
- package/dist/hooks/use-focus-trap.d.ts +16 -0
- package/dist/hooks/use-focus-trap.js +67 -0
- package/dist/hooks/use-focus-trap.js.map +1 -0
- package/dist/hooks/use-media-query.js +1 -0
- package/dist/hooks/use-media-query.js.map +1 -1
- package/dist/hooks/use-overlay-history.js +27 -1
- package/dist/hooks/use-overlay-history.js.map +1 -1
- package/dist/hooks/use-row-swipe.js +1 -0
- package/dist/hooks/use-row-swipe.js.map +1 -1
- package/dist/i18n/defaults.d.ts +31 -0
- package/dist/i18n/defaults.js +63 -0
- package/dist/i18n/defaults.js.map +1 -0
- package/dist/i18n/kit-labels.d.ts +250 -0
- package/dist/i18n/kit-labels.js +184 -0
- package/dist/i18n/kit-labels.js.map +1 -0
- package/dist/index.d.ts +47 -22
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/calc.js +1 -0
- package/dist/lib/calc.js.map +1 -1
- package/dist/lib/cn.js +1 -0
- package/dist/lib/cn.js.map +1 -1
- package/dist/lib/dates.js +1 -0
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/logger.js +1 -0
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/safe-storage.js +1 -0
- package/dist/lib/safe-storage.js.map +1 -1
- package/dist/search/command-palette.d.ts +11 -1
- package/dist/search/command-palette.js +21 -15
- package/dist/search/command-palette.js.map +1 -1
- package/dist/search.d.ts +2 -0
- package/dist/search.js +3 -0
- package/dist/search.js.map +1 -0
- package/dist/shell/app-shell.d.ts +33 -4
- package/dist/shell/app-shell.js +275 -78
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/option-switcher-menu.js +3 -2
- package/dist/shell/option-switcher-menu.js.map +1 -1
- package/dist/shell/role-switcher.d.ts +6 -0
- package/dist/shell/role-switcher.js +7 -4
- package/dist/shell/role-switcher.js.map +1 -1
- package/dist/shell/top-bar.d.ts +15 -7
- package/dist/shell/top-bar.js +3 -5
- package/dist/shell/top-bar.js.map +1 -1
- package/dist/shell/topbar-action-menu.js +3 -2
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell/topbar-controls.d.ts +5 -2
- package/dist/shell/topbar-controls.js +20 -15
- package/dist/shell/topbar-controls.js.map +1 -1
- package/dist/shell.d.ts +13 -0
- package/dist/shell.js +8 -0
- package/dist/shell.js.map +1 -0
- package/dist/theme/chart-palette.d.ts +19 -12
- package/dist/theme/chart-palette.js +24 -30
- package/dist/theme/chart-palette.js.map +1 -1
- package/dist/theme/color.d.ts +78 -0
- package/dist/theme/color.js +148 -0
- package/dist/theme/color.js.map +1 -0
- package/dist/theme/palette-derive.d.ts +140 -0
- package/dist/theme/palette-derive.js +376 -0
- package/dist/theme/palette-derive.js.map +1 -0
- package/dist/theme/palette-presets.d.ts +14 -1
- package/dist/theme/palette-presets.js +231 -3
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/theme/palette-store.js +1 -0
- package/dist/theme/palette-store.js.map +1 -1
- package/dist/theme/theme-store.js +1 -0
- package/dist/theme/theme-store.js.map +1 -1
- package/dist/tour/tour.d.ts +2 -1
- package/dist/tour/tour.js +15 -9
- package/dist/tour/tour.js.map +1 -1
- package/dist/tour.d.ts +2 -0
- package/dist/tour.js +3 -0
- package/dist/tour.js.map +1 -0
- package/dist/wizard/stepper-nav.js +10 -8
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard/types.d.ts +18 -2
- package/dist/wizard/types.js +4 -1
- package/dist/wizard/types.js.map +1 -1
- package/dist/wizard/use-wizard.js +12 -4
- package/dist/wizard/use-wizard.js.map +1 -1
- package/dist/wizard/validation.js +1 -0
- package/dist/wizard/validation.js.map +1 -1
- package/dist/wizard/wizard-context.js +1 -0
- package/dist/wizard/wizard-context.js.map +1 -1
- package/dist/wizard/wizard-step.js +1 -0
- package/dist/wizard/wizard-step.js.map +1 -1
- package/dist/wizard/wizard-summary.js +5 -3
- package/dist/wizard/wizard-summary.js.map +1 -1
- package/dist/wizard.d.ts +8 -0
- package/dist/wizard.js +9 -0
- package/dist/wizard.js.map +1 -0
- package/package.json +66 -13
- package/src/chart.ts +22 -0
- package/src/components/account-settings.tsx +275 -0
- package/src/components/alert-banner.tsx +75 -0
- package/src/components/amount-input.tsx +471 -0
- package/src/components/calculator.tsx +252 -0
- package/src/components/chart-zoom.tsx +499 -0
- package/src/components/chart.tsx +363 -0
- package/src/components/checkbox.tsx +222 -0
- package/src/components/chip.tsx +570 -0
- package/src/components/choice-parts.ts +33 -0
- package/src/components/combobox-core.tsx +540 -0
- package/src/components/combobox.tsx +1026 -0
- package/src/components/currency-select.tsx +269 -0
- package/src/components/data-table-filter-popover.tsx +252 -0
- package/src/components/data-table-filters.ts +176 -0
- package/src/components/data-table-labels.ts +190 -0
- package/src/components/data-table-pagination.tsx +126 -0
- package/src/components/data-table-sort.ts +70 -0
- package/src/components/data-table.tsx +1740 -0
- package/src/components/date-picker.tsx +631 -0
- package/src/components/dropdown.tsx +341 -0
- package/src/components/entity-combobox.tsx +215 -0
- package/src/components/facing-pair.ts +86 -0
- package/src/components/field-sync.tsx +472 -0
- package/src/components/file-dropzone.tsx +181 -0
- package/src/components/full-bleed-dialog.tsx +179 -0
- package/src/components/grouped-picker.tsx +157 -0
- package/src/components/hover-menu.tsx +183 -0
- package/src/components/mini-calendar.tsx +554 -0
- package/src/components/modal.tsx +287 -0
- package/src/components/month-picker.tsx +549 -0
- package/src/components/multi-entity-combobox.tsx +226 -0
- package/src/components/multi-select.tsx +303 -0
- package/src/components/number-field.tsx +225 -0
- package/src/components/number-input.tsx +211 -0
- package/src/components/numpad-sheet.tsx +264 -0
- package/src/components/page-contents.tsx +289 -0
- package/src/components/password-strength.tsx +258 -0
- package/src/components/picker-sheet.tsx +251 -0
- package/src/components/popover.tsx +195 -0
- package/src/components/search-field.tsx +146 -0
- package/src/components/series-chart-labels.ts +26 -0
- package/src/components/series-chart.tsx +481 -0
- package/src/components/settings-fields.tsx +68 -0
- package/src/components/signature-pad.tsx +630 -0
- package/src/components/slider.tsx +313 -0
- package/src/components/sparkline.tsx +329 -0
- package/src/components/stat-tile.tsx +448 -0
- package/src/components/swipeable-row.tsx +271 -0
- package/src/components/switch.tsx +170 -0
- package/src/components/time-input.tsx +107 -0
- package/src/components/toggle-group.tsx +153 -0
- package/src/components/toggle-legend.tsx +229 -0
- package/src/components/tooltip.tsx +477 -0
- package/src/components/treemap.tsx +390 -0
- package/src/components/ui.tsx +1284 -0
- package/src/components/use-mobile-reveal.ts +54 -0
- package/src/components/use-table-state.ts +295 -0
- package/src/components/user-avatar.tsx +61 -0
- package/src/components/wizard-stepper.tsx +37 -0
- package/src/data-table.ts +19 -0
- package/src/feedback/feedback-attachment.tsx +246 -0
- package/src/feedback/feedback-dialog.tsx +209 -0
- package/src/feedback/feedback-inbox.tsx +615 -0
- package/src/feedback.ts +8 -0
- package/src/hooks/use-anchored-panel.ts +169 -0
- package/src/hooks/use-anchored-rect.ts +78 -0
- package/src/hooks/use-announce.ts +85 -0
- package/src/hooks/use-body-scroll-lock.ts +94 -0
- package/src/hooks/use-close-transition.ts +99 -0
- package/src/hooks/use-dismiss.ts +77 -0
- package/src/hooks/use-focus-trap.ts +160 -0
- package/src/hooks/use-media-query.ts +23 -0
- package/src/hooks/use-overlay-history.ts +345 -0
- package/src/hooks/use-row-swipe.ts +212 -0
- package/src/i18n/defaults.ts +68 -0
- package/src/i18n/kit-labels.tsx +447 -0
- package/src/index.ts +169 -0
- package/src/lib/calc.ts +309 -0
- package/src/lib/cn.ts +5 -0
- package/src/lib/dates.ts +187 -0
- package/src/lib/logger.ts +73 -0
- package/src/lib/safe-storage.ts +37 -0
- package/src/search/command-palette.tsx +342 -0
- package/src/search.ts +3 -0
- package/src/shell/app-shell.tsx +772 -0
- package/src/shell/option-switcher-menu.tsx +72 -0
- package/src/shell/role-switcher.tsx +46 -0
- package/src/shell/top-bar.tsx +39 -0
- package/src/shell/topbar-action-menu.tsx +91 -0
- package/src/shell/topbar-controls.tsx +229 -0
- package/src/shell.ts +10 -0
- package/src/theme/chart-palette.ts +145 -0
- package/src/theme/color.ts +266 -0
- package/src/theme/palette-derive.ts +681 -0
- package/src/theme/palette-presets.ts +760 -0
- package/src/theme/palette-store.ts +94 -0
- package/src/theme/theme-store.ts +145 -0
- package/src/tour/tour.tsx +586 -0
- package/src/tour.ts +3 -0
- package/src/vite-env.d.ts +26 -0
- package/src/wizard/stepper-nav.tsx +221 -0
- package/src/wizard/types.ts +178 -0
- package/src/wizard/use-wizard.ts +345 -0
- package/src/wizard/validation.ts +37 -0
- package/src/wizard/wizard-context.tsx +29 -0
- package/src/wizard/wizard-step.tsx +14 -0
- package/src/wizard/wizard-summary.tsx +69 -0
- package/src/wizard.ts +14 -0
- package/tokens.css +222 -20
package/dist/shell/app-shell.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
3
4
|
import { createPortal } from "react-dom";
|
|
4
|
-
import { NavLink } from "react-router";
|
|
5
|
+
import { NavLink, matchPath, useLocation } from "react-router";
|
|
5
6
|
import { ChevronRight, PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
|
6
7
|
import { cn } from "../lib/cn.js";
|
|
7
8
|
import { readStored, writeStored } from "../lib/safe-storage.js";
|
|
@@ -9,6 +10,7 @@ import { Tooltip } from "../components/tooltip.js";
|
|
|
9
10
|
import { useAnchoredRect } from "../hooks/use-anchored-rect.js";
|
|
10
11
|
import { useEscapeKey } from "../hooks/use-dismiss.js";
|
|
11
12
|
import { useMediaQuery } from "../hooks/use-media-query.js";
|
|
13
|
+
import { DEFAULT_APP_SHELL_LABELS, useKitLabels } from "../i18n/kit-labels.js";
|
|
12
14
|
function useNavHeightVar(ref) {
|
|
13
15
|
const isMdUp = useMediaQuery("(min-width: 768px)", false);
|
|
14
16
|
useEffect(() => {
|
|
@@ -34,103 +36,204 @@ function AppShell({
|
|
|
34
36
|
footer,
|
|
35
37
|
sidebarFooter,
|
|
36
38
|
collapseStorageKey = "appLayout.sidebarCollapsed",
|
|
37
|
-
collapseLabel
|
|
38
|
-
expandLabel
|
|
39
|
+
collapseLabel,
|
|
40
|
+
expandLabel,
|
|
41
|
+
subNav = "flyout",
|
|
42
|
+
mobileSubNav = true,
|
|
43
|
+
toggleGroupLabel,
|
|
44
|
+
className,
|
|
45
|
+
...rest
|
|
39
46
|
}) {
|
|
47
|
+
const labels = useKitLabels("appShell", DEFAULT_APP_SHELL_LABELS, {
|
|
48
|
+
collapse: collapseLabel,
|
|
49
|
+
expand: expandLabel,
|
|
50
|
+
toggleGroup: toggleGroupLabel
|
|
51
|
+
});
|
|
40
52
|
const [collapsed, setCollapsed] = useState(() => readStored(collapseStorageKey) === "1");
|
|
53
|
+
const [openGroup, setOpenGroup] = useState(null);
|
|
41
54
|
const navRef = useRef(null);
|
|
42
55
|
useNavHeightVar(navRef);
|
|
43
56
|
useEffect(() => {
|
|
44
57
|
writeStored(collapseStorageKey, collapsed ? "1" : "0");
|
|
45
58
|
}, [collapsed, collapseStorageKey]);
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
59
|
+
return (
|
|
60
|
+
// The caller's attributes go on the shell's own root, never on the `data-tour="nav"`
|
|
61
|
+
// wrappers below — those are the kit's anchors for its own guided tour (#313/#322),
|
|
62
|
+
// and a second element answering to the same selector is a tour that highlights the
|
|
63
|
+
// wrong thing or nothing at all.
|
|
64
|
+
/* @__PURE__ */ jsxs("div", { ...rest, className: cn("relative flex flex-col min-h-screen md:h-dvh md:overflow-hidden", className), children: [
|
|
65
|
+
topBar,
|
|
66
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 min-h-0", children: [
|
|
67
|
+
/* @__PURE__ */ jsxs(
|
|
68
|
+
"aside",
|
|
69
|
+
{
|
|
70
|
+
className: `hidden md:flex md:flex-col md:sticky md:top-12 md:self-start md:h-[calc(100vh-3rem)] border-r border-[var(--border)] bg-[var(--bg-surface)] transition-[width] duration-200 ease-out overflow-hidden ${collapsed ? "md:w-14" : "md:w-60"}`,
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsx("nav", { className: "flex-1 px-2 py-3 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ jsx("div", { "data-tour": "nav", className: "space-y-1", children: nav.map((item) => /* @__PURE__ */ jsx(
|
|
73
|
+
SidebarNavItem,
|
|
74
|
+
{
|
|
75
|
+
item,
|
|
76
|
+
collapsed,
|
|
77
|
+
inline: subNav === "inline",
|
|
78
|
+
toggleGroupLabel: labels.toggleGroup,
|
|
79
|
+
openGroup,
|
|
80
|
+
setOpenGroup
|
|
81
|
+
},
|
|
82
|
+
item.to
|
|
83
|
+
)) }) }),
|
|
84
|
+
sidebarFooter?.(collapsed),
|
|
85
|
+
/* @__PURE__ */ jsx("div", { className: "border-t border-[var(--border)] p-2", children: collapsed ? /* @__PURE__ */ jsx(Tooltip, { label: labels.expand, side: "right", portal: true, className: "block", children: /* @__PURE__ */ jsx(
|
|
86
|
+
"button",
|
|
87
|
+
{
|
|
88
|
+
type: "button",
|
|
89
|
+
onClick: () => setCollapsed(false),
|
|
90
|
+
"aria-label": labels.expand,
|
|
91
|
+
className: "flex w-full items-center justify-center min-h-9 rounded-md text-[var(--text-muted)] hover:bg-[var(--bg-hover)] hover:text-[var(--text-secondary)]",
|
|
92
|
+
children: /* @__PURE__ */ jsx(PanelLeftOpen, { className: "size-4 shrink-0" })
|
|
93
|
+
}
|
|
94
|
+
) }) : /* @__PURE__ */ jsxs(
|
|
95
|
+
"button",
|
|
96
|
+
{
|
|
97
|
+
type: "button",
|
|
98
|
+
onClick: () => setCollapsed(true),
|
|
99
|
+
"aria-label": labels.collapse,
|
|
100
|
+
className: "flex w-full items-center gap-3 min-h-9 px-3 py-2 rounded-md text-sm text-[var(--text-muted)] hover:bg-[var(--bg-hover)] hover:text-[var(--text-secondary)]",
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ jsx(PanelLeftClose, { className: "size-4 shrink-0" }),
|
|
103
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: labels.collapse })
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
) })
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col min-w-0 md:min-h-0", children: [
|
|
111
|
+
/* @__PURE__ */ jsx("main", { className: "relative flex-1 max-w-full overflow-x-clip pb-[calc(var(--app-nav-h,4rem)+1.5rem)] md:pb-0 md:min-h-0 md:overflow-y-auto md:[scrollbar-gutter:stable_both-edges]", children }),
|
|
112
|
+
footer
|
|
113
|
+
] })
|
|
114
|
+
] }),
|
|
49
115
|
/* @__PURE__ */ jsxs(
|
|
50
|
-
"
|
|
116
|
+
"div",
|
|
51
117
|
{
|
|
52
|
-
|
|
118
|
+
ref: navRef,
|
|
119
|
+
className: "md:hidden fixed bottom-0 inset-x-0 z-30 border-t border-[var(--border)] bg-[var(--bg-surface)]",
|
|
53
120
|
children: [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"button",
|
|
121
|
+
mobileSubNav && /* @__PURE__ */ jsx(MobileSubNav, { nav }),
|
|
122
|
+
/* @__PURE__ */ jsx(
|
|
123
|
+
"nav",
|
|
58
124
|
{
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
children: /* @__PURE__ */ jsx(PanelLeftOpen, { className: "size-4 shrink-0" })
|
|
125
|
+
"data-tour": "nav",
|
|
126
|
+
className: "grid",
|
|
127
|
+
style: { gridTemplateColumns: `repeat(${nav.length}, minmax(0, 1fr))` },
|
|
128
|
+
children: nav.map((item) => /* @__PURE__ */ jsx(MobileNavItem, { item }, item.to))
|
|
64
129
|
}
|
|
65
|
-
)
|
|
66
|
-
"button",
|
|
67
|
-
{
|
|
68
|
-
type: "button",
|
|
69
|
-
onClick: () => setCollapsed(true),
|
|
70
|
-
"aria-label": collapseLabel,
|
|
71
|
-
className: "flex w-full items-center gap-3 min-h-9 px-3 py-2 rounded-md text-sm text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-slate-800 dark:hover:text-slate-200",
|
|
72
|
-
children: [
|
|
73
|
-
/* @__PURE__ */ jsx(PanelLeftClose, { className: "size-4 shrink-0" }),
|
|
74
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: collapseLabel })
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
) })
|
|
130
|
+
)
|
|
78
131
|
]
|
|
79
132
|
}
|
|
133
|
+
)
|
|
134
|
+
] })
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
function MobileNavItem({ item }) {
|
|
138
|
+
const subActive = useSubItemActive(item);
|
|
139
|
+
return /* @__PURE__ */ jsxs(
|
|
140
|
+
NavLink,
|
|
141
|
+
{
|
|
142
|
+
to: item.to,
|
|
143
|
+
end: item.end ?? true,
|
|
144
|
+
"data-tour": item.dataTour,
|
|
145
|
+
className: ({ isActive }) => (
|
|
146
|
+
// The active page needs a clear marker, not just a subtle text
|
|
147
|
+
// shade (feedback #327): brand-accent icon + label, bolder weight,
|
|
148
|
+
// and a top accent bar spanning the cell so it reads at a glance.
|
|
149
|
+
cn(
|
|
150
|
+
"relative flex flex-col items-center justify-center py-2 text-[11px] gap-0.5 transition-colors",
|
|
151
|
+
"before:absolute before:content-[''] before:inset-x-4 before:top-0 before:h-0.5 before:rounded-full before:transition-colors",
|
|
152
|
+
isActive || subActive ? "font-semibold text-[var(--brand)] before:bg-[var(--brand)]" : "text-[var(--text-muted)] before:bg-transparent"
|
|
153
|
+
)
|
|
80
154
|
),
|
|
81
|
-
|
|
82
|
-
/* @__PURE__ */ jsx("
|
|
83
|
-
|
|
84
|
-
]
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ jsx("span", { className: "relative", children: /* @__PURE__ */ jsx(item.icon, { className: "size-5" }) }),
|
|
157
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-full truncate px-0.5", children: item.shortLabel ?? item.label })
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
function MobileSubNav({ nav }) {
|
|
163
|
+
const { pathname } = useLocation();
|
|
164
|
+
const group = nav.find(
|
|
165
|
+
(item) => !!item.items?.length && (matchPath({ path: item.to, end: item.end ?? true }, pathname) || item.items.some((sub) => matchPath({ path: sub.to, end: sub.end ?? true }, pathname)))
|
|
166
|
+
);
|
|
167
|
+
if (!group) return null;
|
|
168
|
+
return /* @__PURE__ */ jsx(
|
|
169
|
+
"nav",
|
|
170
|
+
{
|
|
171
|
+
"aria-label": group.label,
|
|
172
|
+
className: "animate-subnav border-b border-[var(--border)]",
|
|
173
|
+
children: /* @__PURE__ */ jsx(
|
|
174
|
+
"ul",
|
|
175
|
+
{
|
|
176
|
+
className: "flex flex-wrap gap-1.5 px-3 py-2",
|
|
177
|
+
children: group.items.map((sub) => /* @__PURE__ */ jsx("li", { className: "shrink-0", children: /* @__PURE__ */ jsxs(
|
|
178
|
+
NavLink,
|
|
179
|
+
{
|
|
180
|
+
to: sub.to,
|
|
181
|
+
end: sub.end ?? true,
|
|
182
|
+
className: ({ isActive }) => cn(
|
|
183
|
+
"flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs transition-colors",
|
|
184
|
+
isActive ? "border-[var(--brand)] bg-[var(--brand)] font-medium text-[var(--brand-contrast)]" : "border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]"
|
|
185
|
+
),
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsx(sub.icon, { className: "size-3.5 shrink-0", "aria-hidden": true }),
|
|
188
|
+
sub.label
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
) }, sub.to))
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
},
|
|
195
|
+
group.to
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
const navLinkClass = (collapsed, forceActive, trail = false) => ({ isActive }) => `flex items-center gap-3 min-h-9 ${collapsed ? "justify-center px-2" : "px-3"} py-2 rounded-md text-sm transition-colors duration-150 ${isActive || forceActive && !trail ? "bg-[var(--bg-inverse)] text-[var(--text-inverse)]" : forceActive ? "font-medium text-[var(--text-primary)] hover:bg-[var(--bg-hover)]" : "text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]"}`;
|
|
199
|
+
function useSubItemActive(item) {
|
|
200
|
+
const { pathname } = useLocation();
|
|
201
|
+
return !!item.items?.some((sub) => matchPath({ path: sub.to, end: sub.end ?? true }, pathname));
|
|
119
202
|
}
|
|
120
|
-
|
|
121
|
-
|
|
203
|
+
function SidebarNavItem({
|
|
204
|
+
item,
|
|
205
|
+
collapsed,
|
|
206
|
+
inline,
|
|
207
|
+
toggleGroupLabel,
|
|
208
|
+
openGroup,
|
|
209
|
+
setOpenGroup
|
|
210
|
+
}) {
|
|
122
211
|
const hasSub = !!item.items?.length;
|
|
212
|
+
const subActive = useSubItemActive(item);
|
|
213
|
+
if (hasSub && !collapsed) {
|
|
214
|
+
return /* @__PURE__ */ jsx(
|
|
215
|
+
SidebarGroup,
|
|
216
|
+
{
|
|
217
|
+
item,
|
|
218
|
+
subActive,
|
|
219
|
+
inline,
|
|
220
|
+
toggleGroupLabel,
|
|
221
|
+
open: openGroup === item.to,
|
|
222
|
+
setOpenGroup
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
}
|
|
123
226
|
const link = /* @__PURE__ */ jsxs(
|
|
124
227
|
NavLink,
|
|
125
228
|
{
|
|
126
229
|
to: item.to,
|
|
127
230
|
end: item.end ?? true,
|
|
128
231
|
"data-tour": item.dataTour,
|
|
129
|
-
className: navLinkClass(collapsed),
|
|
232
|
+
className: navLinkClass(collapsed, subActive),
|
|
130
233
|
"aria-haspopup": hasSub ? "menu" : void 0,
|
|
131
234
|
children: [
|
|
132
235
|
/* @__PURE__ */ jsx("span", { className: "relative shrink-0", children: /* @__PURE__ */ jsx(item.icon, { className: "size-4" }) }),
|
|
133
|
-
!collapsed && /* @__PURE__ */ jsx("span", { className: "flex-1
|
|
236
|
+
!collapsed && /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 break-words leading-snug", children: item.label }),
|
|
134
237
|
!collapsed && hasSub && /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 shrink-0 opacity-60" })
|
|
135
238
|
]
|
|
136
239
|
}
|
|
@@ -138,6 +241,100 @@ function SidebarNavItem({ item, collapsed }) {
|
|
|
138
241
|
if (hasSub) return /* @__PURE__ */ jsx(SidebarFlyout, { item, children: link });
|
|
139
242
|
return collapsed ? /* @__PURE__ */ jsx(Tooltip, { label: item.label, side: "right", portal: true, className: "block", children: link }) : link;
|
|
140
243
|
}
|
|
244
|
+
function SidebarGroup({
|
|
245
|
+
item,
|
|
246
|
+
subActive,
|
|
247
|
+
inline,
|
|
248
|
+
toggleGroupLabel,
|
|
249
|
+
open,
|
|
250
|
+
setOpenGroup
|
|
251
|
+
}) {
|
|
252
|
+
const listId = useId();
|
|
253
|
+
const { pathname } = useLocation();
|
|
254
|
+
const onOwnPage = !!matchPath({ path: item.to, end: item.end ?? true }, pathname);
|
|
255
|
+
const here = subActive || onOwnPage;
|
|
256
|
+
useEffect(() => {
|
|
257
|
+
if (here) setOpenGroup(item.to);
|
|
258
|
+
}, [here, item.to, setOpenGroup]);
|
|
259
|
+
const expanded = inline && open;
|
|
260
|
+
const link = /* @__PURE__ */ jsxs(
|
|
261
|
+
NavLink,
|
|
262
|
+
{
|
|
263
|
+
to: item.to,
|
|
264
|
+
end: item.end ?? true,
|
|
265
|
+
"data-tour": item.dataTour,
|
|
266
|
+
"aria-haspopup": inline ? void 0 : "menu",
|
|
267
|
+
className: (state) => cn(navLinkClass(false, subActive, inline)(state), "min-w-0 flex-1"),
|
|
268
|
+
children: [
|
|
269
|
+
/* @__PURE__ */ jsx("span", { className: "relative shrink-0", children: /* @__PURE__ */ jsx(item.icon, { className: "size-4" }) }),
|
|
270
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 break-words leading-snug", children: item.label }),
|
|
271
|
+
!inline && /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 shrink-0 opacity-60 rtl:-scale-x-100" })
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
276
|
+
inline ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5", children: [
|
|
277
|
+
link,
|
|
278
|
+
/* @__PURE__ */ jsx(
|
|
279
|
+
"button",
|
|
280
|
+
{
|
|
281
|
+
type: "button",
|
|
282
|
+
"aria-expanded": open,
|
|
283
|
+
"aria-controls": listId,
|
|
284
|
+
"aria-label": toggleGroupLabel(item.label),
|
|
285
|
+
onClick: () => setOpenGroup(open ? null : item.to),
|
|
286
|
+
className: "flex size-9 shrink-0 items-center justify-center rounded-md text-[var(--text-muted)] hover:bg-[var(--bg-hover)] hover:text-[var(--text-secondary)]",
|
|
287
|
+
children: /* @__PURE__ */ jsx(
|
|
288
|
+
ChevronRight,
|
|
289
|
+
{
|
|
290
|
+
"aria-hidden": true,
|
|
291
|
+
className: cn(
|
|
292
|
+
"size-3.5 transition-transform duration-200 ease-out motion-reduce:transition-none rtl:-scale-x-100",
|
|
293
|
+
open && "rotate-90 rtl:rotate-90"
|
|
294
|
+
)
|
|
295
|
+
}
|
|
296
|
+
)
|
|
297
|
+
}
|
|
298
|
+
)
|
|
299
|
+
] }) : /* @__PURE__ */ jsx(SidebarFlyout, { item, children: link }),
|
|
300
|
+
/* @__PURE__ */ jsx(
|
|
301
|
+
"div",
|
|
302
|
+
{
|
|
303
|
+
id: listId,
|
|
304
|
+
inert: !expanded,
|
|
305
|
+
className: "grid transition-[grid-template-rows,visibility] duration-200 ease-out motion-reduce:transition-none",
|
|
306
|
+
style: {
|
|
307
|
+
gridTemplateRows: expanded ? "1fr" : "0fr",
|
|
308
|
+
visibility: expanded ? "visible" : "hidden"
|
|
309
|
+
},
|
|
310
|
+
children: /* @__PURE__ */ jsx(
|
|
311
|
+
"div",
|
|
312
|
+
{
|
|
313
|
+
className: cn(
|
|
314
|
+
"min-h-0 overflow-hidden transition-opacity duration-200 ease-out motion-reduce:transition-none",
|
|
315
|
+
expanded ? "opacity-100" : "opacity-0"
|
|
316
|
+
),
|
|
317
|
+
children: /* @__PURE__ */ jsx("ul", { className: "ms-[1.3rem] mt-0.5 space-y-0.5 border-s border-[var(--border)] ps-2", children: item.items.map((sub) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
318
|
+
NavLink,
|
|
319
|
+
{
|
|
320
|
+
to: sub.to,
|
|
321
|
+
end: sub.end ?? true,
|
|
322
|
+
className: ({ isActive }) => cn(
|
|
323
|
+
"flex min-h-8 items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors",
|
|
324
|
+
isActive ? "bg-[var(--bg-inverse)] text-[var(--text-inverse)]" : "text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]"
|
|
325
|
+
),
|
|
326
|
+
children: [
|
|
327
|
+
/* @__PURE__ */ jsx(sub.icon, { className: "size-4 shrink-0 opacity-70", "aria-hidden": true }),
|
|
328
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 break-words leading-snug", children: sub.label })
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
) }, sub.to)) })
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
}
|
|
335
|
+
)
|
|
336
|
+
] });
|
|
337
|
+
}
|
|
141
338
|
let activeFlyoutClose = null;
|
|
142
339
|
function SidebarFlyout({ item, children }) {
|
|
143
340
|
const wrapperRef = useRef(null);
|
|
@@ -200,9 +397,9 @@ function SidebarFlyout({ item, children }) {
|
|
|
200
397
|
{
|
|
201
398
|
role: "menu",
|
|
202
399
|
"aria-label": item.label,
|
|
203
|
-
className: "min-w-52 overflow-hidden rounded-md border border-
|
|
400
|
+
className: "animate-flyout min-w-52 overflow-hidden rounded-md border border-[var(--border)] bg-[var(--bg-surface)] shadow-lg",
|
|
204
401
|
children: [
|
|
205
|
-
/* @__PURE__ */ jsx("div", { className: "border-b border-
|
|
402
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-[var(--border)] px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-[var(--text-muted)]", children: item.label }),
|
|
206
403
|
/* @__PURE__ */ jsx("ul", { className: "py-1", children: item.items.map((sub) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
207
404
|
NavLink,
|
|
208
405
|
{
|
|
@@ -212,11 +409,11 @@ function SidebarFlyout({ item, children }) {
|
|
|
212
409
|
onClick: () => setOpen(false),
|
|
213
410
|
className: ({ isActive }) => cn(
|
|
214
411
|
"flex items-center gap-2.5 px-3 py-2 text-sm",
|
|
215
|
-
isActive ? "bg-
|
|
412
|
+
isActive ? "bg-[var(--bg-active)] font-medium text-[var(--text-primary)]" : "text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]"
|
|
216
413
|
),
|
|
217
414
|
children: [
|
|
218
|
-
/* @__PURE__ */ jsx(sub.icon, { className: "size-4 shrink-0 text-
|
|
219
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
415
|
+
/* @__PURE__ */ jsx(sub.icon, { className: "size-4 shrink-0 text-[var(--text-placeholder)]" }),
|
|
416
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 break-words leading-snug", children: sub.label })
|
|
220
417
|
]
|
|
221
418
|
}
|
|
222
419
|
) }, sub.to)) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/shell/app-shell.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { NavLink } from \"react-router\";\nimport { ChevronRight, PanelLeftClose, PanelLeftOpen } from \"lucide-react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { readStored, writeStored } from \"../lib/safe-storage\";\nimport { Tooltip } from \"../components/tooltip\";\nimport { useAnchoredRect } from \"../hooks/use-anchored-rect\";\nimport { useEscapeKey } from \"../hooks/use-dismiss\";\nimport { useMediaQuery } from \"../hooks/use-media-query\";\n\nexport interface AppShellSubItem {\n to: string;\n label: string;\n icon: LucideIcon;\n /** Passed to NavLink's `end` (exact match). Defaults to true. */\n end?: boolean;\n}\n\nexport interface AppShellNavItem {\n to: string;\n label: string;\n /** Optional shorter label for the MOBILE BOTTOM BAR only (the sidebar, its\n * tooltips and any palette built on this list keep `label`).\n *\n * The bar divides the viewport into `nav.length` equal cells, so a label's room\n * shrinks with every entry added — at six entries on a 406 px phone that is ~67 px,\n * and \"Import & Export\" wrapped to two lines and pushed the row taller than its\n * neighbours (keksdose feedback live #210). A per-item override is better than\n * shortening the real label, which the sidebar has ample room for and which is the\n * name the rest of the product uses. */\n shortLabel?: string;\n icon: LucideIcon;\n /** Passed to NavLink's `end` (exact match). Defaults to true. */\n end?: boolean;\n /** Optional `data-tour` value rendered on this item's link (both the desktop\n * sidebar and the mobile bottom bar), so a guided tour can spotlight ONE nav\n * entry precisely instead of matching by href (feedback #338). */\n dataTour?: string;\n /** Optional sub-items. When present, hovering (or focusing) the item opens a\n * flyout to the right of the sidebar with a header (this item's label) and the\n * sub-items as icon + title links. Works collapsed or expanded; the mobile\n * bottom bar ignores sub-items and links to `to`. */\n items?: AppShellSubItem[];\n}\n\ninterface AppShellProps {\n /** Navigation entries — shared by the desktop sidebar and mobile bottom bar. */\n nav: AppShellNavItem[];\n /** The composed top bar (e.g. the shared TopBar with app-owned actions). */\n topBar: ReactNode;\n /** Main content — typically the router `<Outlet />`. */\n children: ReactNode;\n /** Desktop-only footer rendered below the content (hidden on mobile). */\n footer?: ReactNode;\n /** Extra sidebar content above the collapse toggle (e.g. a version link).\n * Receives the collapsed state so it can render compact vs. full. */\n sidebarFooter?: (collapsed: boolean) => ReactNode;\n /** localStorage key for the persisted collapse state. */\n collapseStorageKey?: string;\n collapseLabel?: string;\n expandLabel?: string;\n}\n\n/**\n * The bottom nav's own height, published as `--app-nav-h` so anything that has to sit\n * ON it can stop guessing.\n *\n * Keksdose live #314 is what this is for. Its rework — *\"Stick it to the bottom\n * touching the bottom icon bar with budget, accounts, … Currently there is a small gap\n * which confuses\"* — was a receipt footer pinned at `bottom-20`, because `<main>`\n * reserves `pb-20` for this nav and 20 looked like the nav's height. It is not: the\n * padding is generous CLEARANCE, and the nav is content-sized (icon + label + `py-2`,\n * about 56px), so the footer floated ~24px above the bar.\n *\n * Measured rather than named, because the height is not a constant anyone owns: it is\n * an icon, a translated label that can wrap or truncate, and whatever the platform does\n * with the safe-area inset. A hard-coded `bottom-14` would be the same guess one number\n * lower, and it would be wrong again the first time a label needed two lines.\n *\n * `0px` when the nav is not rendered — above `md` it is `display:none`, which observes\n * as a zero box — so a consumer can write `bottom-[var(--app-nav-h,0px)]` once and get\n * the right answer at both widths without a breakpoint of its own.\n */\nfunction useNavHeightVar(ref: React.RefObject<HTMLElement | null>): void {\n // Re-run when the breakpoint flips. A ResizeObserver SKIPS an element that is not\n // being rendered, so the nav going `display:none` above `md` fires no callback and\n // would leave the last phone height published — a desktop footer would then sit 56px\n // off the bottom after a live resize. The query is the one the nav's own `md:hidden`\n // compiles to, so the two cannot disagree about where the boundary is.\n const isMdUp = useMediaQuery(\"(min-width: 768px)\", false);\n useEffect(() => {\n const node = ref.current;\n const root = document.documentElement;\n // `getBoundingClientRect().height`, rounded DOWN — not `offsetHeight`, and not\n // ceil. Measured on the running app at 406x816: the bar is **55.5px** tall, and\n // both `offsetHeight` and `Math.ceil` answer 56. That is why live #314 round four\n // was *\"No change. Still a pixel inbetween\"* — the previous fix was arithmetically\n // a no-op on the very value it was meant to correct.\n //\n // 56 is the wrong side. A sticky element with `bottom: X` puts its bottom edge X\n // above the viewport bottom, and the bar's TOP edge is at its own height: so\n // X = 56 lands the footer at y=760.0 against a bar starting at y=760.5, i.e. half\n // a CSS pixel of page showing through — about 1.4 device pixels on his phone,\n // which is exactly the hairline in the screenshot.\n //\n // The two errors are not symmetric, and I had them backwards the first time.\n // Too SMALL tucks the sticky element under a bar that is opaque and painted above\n // it (`z-30` against `z-10`): invisible. Too LARGE opens the seam. So floor, and\n // consumers subtract a further pixel (see `invoice-line-totals.tsx`) for the case\n // where the height lands on a whole pixel and floor leaves no overlap at all.\n const publish = () =>\n root.style.setProperty(\n \"--app-nav-h\",\n `${node ? Math.floor(node.getBoundingClientRect().height) : 0}px`,\n );\n publish();\n // The observer is the refinement, not the mechanism: `publish()` above is already\n // right for a static nav, and jsdom has no ResizeObserver unless a test stubs one.\n // ONE cleanup for every branch, though — an early `return` on the no-observer path\n // left the variable behind on unmount, which a stale `bottom:` offset on whatever\n // rendered next would have inherited.\n const ro = node && typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(publish) : null;\n if (ro && node) ro.observe(node);\n return () => {\n ro?.disconnect();\n root.style.removeProperty(\"--app-nav-h\");\n };\n }, [ref, isMdUp]);\n}\n\n/**\n * The responsive application shell: a top bar, a collapsible desktop sidebar\n * (icon-only when collapsed, with tooltips), a mobile bottom nav bar, the main\n * content area, and an optional desktop footer. Router-aware via react-router\n * `NavLink`; domain-free — nav items, brand, footer and the top bar's actions\n * are all supplied by the app.\n */\nexport function AppShell({\n nav,\n topBar,\n children,\n footer,\n sidebarFooter,\n collapseStorageKey = \"appLayout.sidebarCollapsed\",\n collapseLabel = \"Collapse sidebar\",\n expandLabel = \"Expand sidebar\",\n}: AppShellProps) {\n // Through the guarded helpers, not `window.localStorage` directly. The read runs\n // inside a `useState` initialiser — i.e. during render of the top-level shell — and\n // `localStorage` THROWS where site data is blocked (Safari private browsing, a\n // partitioned webview). Unguarded, that was not a lost sidebar preference: nothing\n // in the application mounted at all.\n const [collapsed, setCollapsed] = useState(() => readStored(collapseStorageKey) === \"1\");\n // Publishes `--app-nav-h` for anything that has to sit on the bottom bar.\n const navRef = useRef<HTMLElement>(null);\n useNavHeightVar(navRef);\n useEffect(() => {\n writeStored(collapseStorageKey, collapsed ? \"1\" : \"0\");\n }, [collapsed, collapseStorageKey]);\n\n return (\n <div className=\"flex flex-col min-h-screen md:h-dvh md:overflow-hidden\">\n {topBar}\n <div className=\"flex flex-1 min-h-0\">\n <aside\n className={`hidden md:flex md:flex-col md:sticky md:top-12 md:self-start md:h-[calc(100vh-3rem)] border-r border-[var(--border)] bg-[var(--bg-surface)] transition-[width] duration-200 ease-out overflow-hidden ${\n collapsed ? \"md:w-14\" : \"md:w-60\"\n }`}\n >\n {/* The `<nav>` is flex-1 so it fills the sidebar's height (with empty\n space below the items); the data-tour marker goes on the INNER,\n fit-content wrapper so the guided-tour spotlight hugs the actual nav\n items instead of the whole tall column (feedback #322). The marker\n also tags the mobile bottom bar below; the tour targets\n `[data-tour=\"nav\"]` and resolves to whichever is visible (#313). */}\n <nav className=\"flex-1 px-2 py-3 overflow-y-auto overflow-x-hidden\">\n <div data-tour=\"nav\" className=\"space-y-1\">\n {nav.map((item) => (\n <SidebarNavItem key={item.to} item={item} collapsed={collapsed} />\n ))}\n </div>\n </nav>\n {sidebarFooter?.(collapsed)}\n <div className=\"border-t border-[var(--border)] p-2\">\n {collapsed ? (\n <Tooltip label={expandLabel} side=\"right\" portal className=\"block\">\n <button\n type=\"button\"\n onClick={() => setCollapsed(false)}\n aria-label={expandLabel}\n className=\"flex w-full items-center justify-center min-h-9 rounded-md text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-slate-800 dark:hover:text-slate-200\"\n >\n <PanelLeftOpen className=\"size-4 shrink-0\" />\n </button>\n </Tooltip>\n ) : (\n <button\n type=\"button\"\n onClick={() => setCollapsed(true)}\n aria-label={collapseLabel}\n className=\"flex w-full items-center gap-3 min-h-9 px-3 py-2 rounded-md text-sm text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:text-slate-400 dark:hover:bg-slate-800 dark:hover:text-slate-200\"\n >\n <PanelLeftClose className=\"size-4 shrink-0\" />\n <span className=\"truncate\">{collapseLabel}</span>\n </button>\n )}\n </div>\n </aside>\n\n {/* Content column beside the sidebar. main grows to fill so the footer\n sits at the bottom — at the viewport edge when content is short,\n beside the sidebar rather than under it. */}\n <div className=\"flex flex-1 flex-col min-w-0 md:min-h-0\">\n {/* `scrollbar-gutter: stable` reserves the scrollbar's track whether or\n not it is currently needed. Without it this element — the app's only\n scroll container from md up — narrows its own client box by the\n scrollbar width the moment a page's content outgrows it, and widens\n it again when the next page fits. Every centred `mx-auto` container\n inside then jumps sideways by half a scrollbar, and any fluid-width\n content changes width outright. Keksdose feedback #403 caught it as\n \"slight width increase/decrease\" when switching to the notifications\n settings section and back: that section is the only one tall enough\n to scroll. Platform-dependent, which is why it is easy to miss —\n overlay scrollbars (macOS, most Linux builds) take no layout space,\n classic ones (Windows) take ~15px.\n\n `both-edges`, not the bare `stable`: a one-sided reservation keeps the\n width stable but moves the middle. On a page short enough not to\n scroll, nothing is painted into the reserved track, so every centred\n `mx-auto` container sits half a scrollbar left of the optical centre\n and every full-bleed child stops ~15px short on the right. Keksdose\n feedback #491 (/settings#data) and #498 (/budgets) both reported it as\n \"the left boundary looks smaller / cut off compared to the right\" on\n the one element per page whose frame is a saturated colour — the rose\n destructive-action cards. Reserving the track on both edges keeps the\n content centred whether or not the scrollbar is showing. */}\n <main className=\"flex-1 max-w-full overflow-x-clip pb-20 md:pb-0 md:min-h-0 md:overflow-y-auto md:[scrollbar-gutter:stable_both-edges]\">\n {children}\n </main>\n {footer}\n </div>\n </div>\n\n <nav\n ref={navRef}\n data-tour=\"nav\"\n className=\"md:hidden fixed bottom-0 inset-x-0 z-30 bg-[var(--bg-surface)] border-t border-[var(--border)] grid\"\n style={{ gridTemplateColumns: `repeat(${nav.length}, minmax(0, 1fr))` }}\n >\n {nav.map((item) => (\n <NavLink\n key={item.to}\n to={item.to}\n end={item.end ?? true}\n data-tour={item.dataTour}\n className={({ isActive }) =>\n // The active page needs a clear marker, not just a subtle text\n // shade (feedback #327): brand-accent icon + label, bolder weight,\n // and a top accent bar spanning the cell so it reads at a glance.\n cn(\n \"relative flex flex-col items-center justify-center py-2 text-[11px] gap-0.5 transition-colors\",\n \"before:absolute before:content-[''] before:inset-x-4 before:top-0 before:h-0.5 before:rounded-full before:transition-colors\",\n isActive\n ? \"font-semibold text-[var(--brand)] before:bg-[var(--brand)]\"\n : \"text-slate-500 dark:text-slate-400 before:bg-transparent\",\n )\n }\n >\n <span className=\"relative\">\n <item.icon className=\"size-5\" />\n </span>\n {/* One line, always. `truncate` is the backstop for the case a\n `shortLabel` was not supplied (or a translation is longer than its\n author expected): an ellipsis in one cell is a far smaller problem\n than a bar whose rows are different heights. */}\n <span className=\"max-w-full truncate px-0.5\">\n {item.shortLabel ?? item.label}\n </span>\n </NavLink>\n ))}\n </nav>\n </div>\n );\n}\n\nconst navLinkClass = (collapsed: boolean) =>\n ({ isActive }: { isActive: boolean }) =>\n `flex items-center gap-3 min-h-9 ${collapsed ? \"justify-center px-2\" : \"px-3\"} py-2 rounded-md text-sm ${\n isActive\n ? \"bg-slate-900 text-white dark:bg-slate-100 dark:text-slate-900\"\n : \"text-slate-700 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800\"\n }`;\n\n/** A single desktop sidebar entry. Plain link (with a tooltip when collapsed) —\n * unless it has sub-items, in which case hovering/focusing opens a flyout. */\nfunction SidebarNavItem({ item, collapsed }: { item: AppShellNavItem; collapsed: boolean }) {\n const hasSub = !!item.items?.length;\n\n const link = (\n <NavLink\n to={item.to}\n end={item.end ?? true}\n data-tour={item.dataTour}\n className={navLinkClass(collapsed)}\n aria-haspopup={hasSub ? \"menu\" : undefined}\n >\n <span className=\"relative shrink-0\">\n <item.icon className=\"size-4\" />\n </span>\n {!collapsed && <span className=\"flex-1 truncate\">{item.label}</span>}\n {!collapsed && hasSub && <ChevronRight className=\"size-3.5 shrink-0 opacity-60\" />}\n </NavLink>\n );\n\n if (hasSub) return <SidebarFlyout item={item}>{link}</SidebarFlyout>;\n return collapsed ? (\n <Tooltip label={item.label} side=\"right\" portal className=\"block\">\n {link}\n </Tooltip>\n ) : (\n link\n );\n}\n\n// Only ONE sidebar flyout should be on screen at a time. Each open flyout parks its\n// \"close now\" here so the next item to open can dismiss it immediately, instead of\n// leaving the previous panel up for the 140ms travel delay while the cursor moves\n// down the nav list — which showed two panels at once.\nlet activeFlyoutClose: (() => void) | null = null;\n\n/**\n * Wraps a nav item that has sub-items: on hover or keyboard focus it opens a\n * portalled flyout to the right of the sidebar (portalled so the sidebar's\n * `overflow-hidden` can't clip it) with the item's label as a header and each\n * sub-item as an icon + title link. A short close delay lets the cursor travel\n * from the item onto the panel; Escape / outside-move close it.\n */\nfunction SidebarFlyout({ item, children }: { item: AppShellNavItem; children: ReactNode }) {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const [open, setOpen] = useState(false);\n\n // Anchor the flyout to the item's right edge; the hook re-measures on\n // scroll/resize (the nav list can scroll).\n const rect = useAnchoredRect(wrapperRef, open);\n const pos = rect ? { top: rect.top, left: rect.right } : null;\n\n const cancelClose = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current);\n closeTimer.current = null;\n }\n }, []);\n // Stable identity: the coordinator above holds this so a sibling item can close\n // THIS flyout without waiting out its travel delay.\n const closeNow = useCallback(() => {\n cancelClose();\n setOpen(false);\n }, [cancelClose]);\n const openMenu = useCallback(() => {\n cancelClose();\n if (activeFlyoutClose && activeFlyoutClose !== closeNow) activeFlyoutClose();\n activeFlyoutClose = closeNow;\n setOpen(true);\n }, [cancelClose, closeNow]);\n const scheduleClose = useCallback(() => {\n cancelClose();\n closeTimer.current = setTimeout(() => {\n setOpen(false);\n if (activeFlyoutClose === closeNow) activeFlyoutClose = null;\n }, 140);\n }, [cancelClose, closeNow]);\n\n // Close on Escape while open.\n useEscapeKey(() => setOpen(false), open);\n\n useEffect(\n () => () => {\n cancelClose();\n if (activeFlyoutClose === closeNow) activeFlyoutClose = null;\n },\n [cancelClose, closeNow],\n );\n\n return (\n <div\n ref={wrapperRef}\n className=\"relative\"\n onMouseEnter={openMenu}\n onMouseLeave={scheduleClose}\n onFocus={openMenu}\n onBlur={scheduleClose}\n >\n {children}\n {open &&\n pos &&\n createPortal(\n <div\n style={{ position: \"fixed\", top: pos.top, left: pos.left }}\n className=\"z-40 pl-1\"\n onMouseEnter={cancelClose}\n onMouseLeave={scheduleClose}\n >\n <div\n role=\"menu\"\n aria-label={item.label}\n className=\"min-w-52 overflow-hidden rounded-md border border-slate-200 bg-white shadow-lg dark:border-slate-700 dark:bg-slate-900\"\n >\n <div className=\"border-b border-slate-100 px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:border-slate-800 dark:text-slate-400\">\n {item.label}\n </div>\n <ul className=\"py-1\">\n {item.items!.map((sub) => (\n <li key={sub.to}>\n <NavLink\n to={sub.to}\n end={sub.end ?? true}\n role=\"menuitem\"\n onClick={() => setOpen(false)}\n className={({ isActive }) =>\n cn(\n \"flex items-center gap-2.5 px-3 py-2 text-sm\",\n isActive\n ? \"bg-slate-100 font-medium text-slate-900 dark:bg-slate-800 dark:text-slate-100\"\n : \"text-slate-700 hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-slate-800\",\n )\n }\n >\n <sub.icon className=\"size-4 shrink-0 text-slate-400 dark:text-slate-500\" />\n <span className=\"truncate\">{sub.label}</span>\n </NavLink>\n </li>\n ))}\n </ul>\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n}\n"],"mappings":"AAqLgB,cAkBF,YAlBE;AArLhB,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AAEzD,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AACxB,SAAS,cAAc,gBAAgB,qBAAqB;AAE5D,SAAS,UAAU;AACnB,SAAS,YAAY,mBAAmB;AACxC,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC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QACC;AAAA,sBAAC;AAAA;AAAA,wBACC,IAAI,IAAI;AAAA,wBACR,KAAK,IAAI,OAAO;AAAA,wBAChB,MAAK;AAAA,wBACL,SAAS,MAAM,QAAQ,KAAK;AAAA,wBAC5B,WAAW,CAAC,EAAE,SAAS,MACrB;AAAA,0BACE;AAAA,0BACA,WACI,kFACA;AAAA,wBACN;AAAA,wBAGF;AAAA,8CAAC,IAAI,MAAJ,EAAS,WAAU,sDAAqD;AAAA,0BACzE,oBAAC,UAAK,WAAU,YAAY,cAAI,OAAM;AAAA;AAAA;AAAA,oBACxC,KAjBO,IAAI,EAkBb,CACD,GACH;AAAA;AAAA;AAAA,cACF;AAAA;AAAA,UACF;AAAA,UACA,SAAS;AAAA,QACX;AAAA;AAAA;AAAA,EACJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/shell/app-shell.tsx"],"sourcesContent":["import { useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { NavLink, matchPath, useLocation } from \"react-router\";\nimport { ChevronRight, PanelLeftClose, PanelLeftOpen } from \"lucide-react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { readStored, writeStored } from \"../lib/safe-storage\";\nimport { Tooltip } from \"../components/tooltip\";\nimport { useAnchoredRect } from \"../hooks/use-anchored-rect\";\nimport { useEscapeKey } from \"../hooks/use-dismiss\";\nimport { useMediaQuery } from \"../hooks/use-media-query\";\nimport { DEFAULT_APP_SHELL_LABELS, useKitLabels } from \"../i18n/kit-labels\";\n\nexport interface AppShellSubItem {\n to: string;\n label: string;\n icon: LucideIcon;\n /** Passed to NavLink's `end` (exact match). Defaults to true. */\n end?: boolean;\n}\n\nexport interface AppShellNavItem {\n to: string;\n label: string;\n /** Optional shorter label for the MOBILE BOTTOM BAR only (the sidebar, its\n * tooltips and any palette built on this list keep `label`).\n *\n * The bar divides the viewport into `nav.length` equal cells, so a label's room\n * shrinks with every entry added — at six entries on a 406 px phone that is ~67 px,\n * and \"Import & Export\" wrapped to two lines and pushed the row taller than its\n * neighbours (keksdose feedback live #210). A per-item override is better than\n * shortening the real label, which the sidebar has ample room for and which is the\n * name the rest of the product uses. */\n shortLabel?: string;\n icon: LucideIcon;\n /** Passed to NavLink's `end` (exact match). Defaults to true. */\n end?: boolean;\n /** Optional `data-tour` value rendered on this item's link (both the desktop\n * sidebar and the mobile bottom bar), so a guided tour can spotlight ONE nav\n * entry precisely instead of matching by href (feedback #338). */\n dataTour?: string;\n /** Optional sub-items. When present, hovering (or focusing) the item opens a\n * flyout to the right of the sidebar with a header (this item's label) and the\n * sub-items as icon + title links. Works collapsed or expanded; the mobile\n * bottom bar ignores sub-items and links to `to`. */\n items?: AppShellSubItem[];\n}\n\n/**\n * Exported and `<div>`-shaped. This is the outermost element of every consuming app, so\n * there is nothing above it to hang an id, a landmark label or a `data-tour` anchor on —\n * and nothing a consumer can wrap it in either, since the root owns the `h-dvh` and\n * `overflow-hidden` the whole layout is built on (audit §api-design).\n */\nexport interface AppShellProps extends ComponentPropsWithoutRef<\"div\"> {\n /** Navigation entries — shared by the desktop sidebar and mobile bottom bar. */\n nav: AppShellNavItem[];\n /** The composed top bar (e.g. the shared TopBar with app-owned actions). */\n topBar: ReactNode;\n /** Main content — typically the router `<Outlet />`. */\n children: ReactNode;\n /** Desktop-only footer rendered below the content (hidden on mobile). */\n footer?: ReactNode;\n /** Extra sidebar content above the collapse toggle (e.g. a version link).\n * Receives the collapsed state so it can render compact vs. full. */\n sidebarFooter?: (collapsed: boolean) => ReactNode;\n /** localStorage key for the persisted collapse state. */\n collapseStorageKey?: string;\n /** Default: `appShell.collapse` from the {@link UiKitProvider}, else English. */\n collapseLabel?: string;\n /** Default: `appShell.expand` from the {@link UiKitProvider}, else English. */\n expandLabel?: string;\n /** How an entry's `items` are revealed in the EXPANDED desktop sidebar.\n *\n * - `\"flyout\"` (default) — a panel beside the sidebar on hover/focus. Compact: the\n * sidebar stays one row per group however many pages a group holds.\n * - `\"inline\"` — a disclosure under the entry, the pattern of MUI's nested List and\n * most documentation sites. Every page is visible at once, and the group holding\n * the current page opens on its own, so the reader can see where they are without\n * hovering anything.\n *\n * The icon-only (collapsed) sidebar always uses the flyout: an indented list has no\n * room there. The mobile bottom bar ignores `items` in both modes. */\n subNav?: \"flyout\" | \"inline\";\n /** Accessible name of the inline disclosure button, given the group's label.\n * Only used with `subNav=\"inline\"`. Its expanded state is carried by\n * `aria-expanded`, so one wording serves both directions. Default:\n * `appShell.toggleGroup` from the {@link UiKitProvider}, else English. */\n toggleGroupLabel?: (groupLabel: string) => string;\n /** Below `md`: show the current group's `items` as a scrollable row above the\n * bottom bar — the phone's counterpart of the sidebar's second level. Default true;\n * `false` keeps the single bar, where a group entry only links to its own `to`. */\n mobileSubNav?: boolean;\n}\n\n/**\n * The bottom nav's own height, published as `--app-nav-h` so anything that has to sit\n * ON it can stop guessing.\n *\n * Keksdose live #314 is what this is for. Its rework — *\"Stick it to the bottom\n * touching the bottom icon bar with budget, accounts, … Currently there is a small gap\n * which confuses\"* — was a receipt footer pinned at `bottom-20`, because `<main>`\n * reserves `pb-20` for this nav and 20 looked like the nav's height. It is not: the\n * padding is generous CLEARANCE, and the nav is content-sized (icon + label + `py-2`,\n * about 56px), so the footer floated ~24px above the bar.\n *\n * Measured rather than named, because the height is not a constant anyone owns: it is\n * an icon, a translated label that can wrap or truncate, and whatever the platform does\n * with the safe-area inset. A hard-coded `bottom-14` would be the same guess one number\n * lower, and it would be wrong again the first time a label needed two lines.\n *\n * `0px` when the nav is not rendered — above `md` it is `display:none`, which observes\n * as a zero box — so a consumer can write `bottom-[var(--app-nav-h,0px)]` once and get\n * the right answer at both widths without a breakpoint of its own.\n */\nfunction useNavHeightVar(ref: React.RefObject<HTMLElement | null>): void {\n // Re-run when the breakpoint flips. A ResizeObserver SKIPS an element that is not\n // being rendered, so the nav going `display:none` above `md` fires no callback and\n // would leave the last phone height published — a desktop footer would then sit 56px\n // off the bottom after a live resize. The query is the one the nav's own `md:hidden`\n // compiles to, so the two cannot disagree about where the boundary is.\n const isMdUp = useMediaQuery(\"(min-width: 768px)\", false);\n useEffect(() => {\n const node = ref.current;\n const root = document.documentElement;\n // `getBoundingClientRect().height`, rounded DOWN — not `offsetHeight`, and not\n // ceil. Measured on the running app at 406x816: the bar is **55.5px** tall, and\n // both `offsetHeight` and `Math.ceil` answer 56. That is why live #314 round four\n // was *\"No change. Still a pixel inbetween\"* — the previous fix was arithmetically\n // a no-op on the very value it was meant to correct.\n //\n // 56 is the wrong side. A sticky element with `bottom: X` puts its bottom edge X\n // above the viewport bottom, and the bar's TOP edge is at its own height: so\n // X = 56 lands the footer at y=760.0 against a bar starting at y=760.5, i.e. half\n // a CSS pixel of page showing through — about 1.4 device pixels on his phone,\n // which is exactly the hairline in the screenshot.\n //\n // The two errors are not symmetric, and I had them backwards the first time.\n // Too SMALL tucks the sticky element under a bar that is opaque and painted above\n // it (`z-30` against `z-10`): invisible. Too LARGE opens the seam. So floor, and\n // consumers subtract a further pixel (see `invoice-line-totals.tsx`) for the case\n // where the height lands on a whole pixel and floor leaves no overlap at all.\n const publish = () =>\n root.style.setProperty(\n \"--app-nav-h\",\n `${node ? Math.floor(node.getBoundingClientRect().height) : 0}px`,\n );\n publish();\n // The observer is the refinement, not the mechanism: `publish()` above is already\n // right for a static nav, and jsdom has no ResizeObserver unless a test stubs one.\n // ONE cleanup for every branch, though — an early `return` on the no-observer path\n // left the variable behind on unmount, which a stale `bottom:` offset on whatever\n // rendered next would have inherited.\n const ro = node && typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(publish) : null;\n if (ro && node) ro.observe(node);\n return () => {\n ro?.disconnect();\n root.style.removeProperty(\"--app-nav-h\");\n };\n }, [ref, isMdUp]);\n}\n\n/**\n * The responsive application shell: a top bar, a collapsible desktop sidebar\n * (icon-only when collapsed, with tooltips), a mobile bottom nav bar, the main\n * content area, and an optional desktop footer. Router-aware via react-router\n * `NavLink`; domain-free — nav items, brand, footer and the top bar's actions\n * are all supplied by the app.\n */\nexport function AppShell({\n nav,\n topBar,\n children,\n footer,\n sidebarFooter,\n collapseStorageKey = \"appLayout.sidebarCollapsed\",\n collapseLabel,\n expandLabel,\n subNav = \"flyout\",\n mobileSubNav = true,\n toggleGroupLabel,\n className,\n ...rest\n}: AppShellProps) {\n // The three props are per-shell overrides of the provider's `appShell`; one left\n // undefined falls through to the provider rather than to English.\n const labels = useKitLabels(\"appShell\", DEFAULT_APP_SHELL_LABELS, {\n collapse: collapseLabel,\n expand: expandLabel,\n toggleGroup: toggleGroupLabel,\n });\n // Through the guarded helpers, not `window.localStorage` directly. The read runs\n // inside a `useState` initialiser — i.e. during render of the top-level shell — and\n // `localStorage` THROWS where site data is blocked (Safari private browsing, a\n // partitioned webview). Unguarded, that was not a lost sidebar preference: nothing\n // in the application mounted at all.\n const [collapsed, setCollapsed] = useState(() => readStored(collapseStorageKey) === \"1\");\n // The inline sidebar is an ACCORDION: one group open at a time, keyed by its `to`.\n // Held here rather than per group so opening one can close the other — two lists\n // open at once pushed every entry below them off a laptop screen.\n const [openGroup, setOpenGroup] = useState<string | null>(null);\n // Publishes `--app-nav-h` for anything that has to sit on the bottom bar.\n const navRef = useRef<HTMLDivElement>(null);\n useNavHeightVar(navRef);\n useEffect(() => {\n writeStored(collapseStorageKey, collapsed ? \"1\" : \"0\");\n }, [collapsed, collapseStorageKey]);\n\n return (\n // The caller's attributes go on the shell's own root, never on the `data-tour=\"nav\"`\n // wrappers below — those are the kit's anchors for its own guided tour (#313/#322),\n // and a second element answering to the same selector is a tour that highlights the\n // wrong thing or nothing at all.\n <div {...rest} className={cn(\"relative flex flex-col min-h-screen md:h-dvh md:overflow-hidden\", className)}>\n {topBar}\n <div className=\"flex flex-1 min-h-0\">\n <aside\n className={`hidden md:flex md:flex-col md:sticky md:top-12 md:self-start md:h-[calc(100vh-3rem)] border-r border-[var(--border)] bg-[var(--bg-surface)] transition-[width] duration-200 ease-out overflow-hidden ${\n collapsed ? \"md:w-14\" : \"md:w-60\"\n }`}\n >\n {/* The `<nav>` is flex-1 so it fills the sidebar's height (with empty\n space below the items); the data-tour marker goes on the INNER,\n fit-content wrapper so the guided-tour spotlight hugs the actual nav\n items instead of the whole tall column (feedback #322). The marker\n also tags the mobile bottom bar below; the tour targets\n `[data-tour=\"nav\"]` and resolves to whichever is visible (#313). */}\n <nav className=\"flex-1 px-2 py-3 overflow-y-auto overflow-x-hidden\">\n <div data-tour=\"nav\" className=\"space-y-1\">\n {nav.map((item) => (\n <SidebarNavItem\n key={item.to}\n item={item}\n collapsed={collapsed}\n inline={subNav === \"inline\"}\n toggleGroupLabel={labels.toggleGroup}\n openGroup={openGroup}\n setOpenGroup={setOpenGroup}\n />\n ))}\n </div>\n </nav>\n {sidebarFooter?.(collapsed)}\n <div className=\"border-t border-[var(--border)] p-2\">\n {collapsed ? (\n <Tooltip label={labels.expand} side=\"right\" portal className=\"block\">\n <button\n type=\"button\"\n onClick={() => setCollapsed(false)}\n aria-label={labels.expand}\n className=\"flex w-full items-center justify-center min-h-9 rounded-md text-[var(--text-muted)] hover:bg-[var(--bg-hover)] hover:text-[var(--text-secondary)]\"\n >\n <PanelLeftOpen className=\"size-4 shrink-0\" />\n </button>\n </Tooltip>\n ) : (\n <button\n type=\"button\"\n onClick={() => setCollapsed(true)}\n aria-label={labels.collapse}\n className=\"flex w-full items-center gap-3 min-h-9 px-3 py-2 rounded-md text-sm text-[var(--text-muted)] hover:bg-[var(--bg-hover)] hover:text-[var(--text-secondary)]\"\n >\n <PanelLeftClose className=\"size-4 shrink-0\" />\n <span className=\"truncate\">{labels.collapse}</span>\n </button>\n )}\n </div>\n </aside>\n\n {/* Content column beside the sidebar. main grows to fill so the footer\n sits at the bottom — at the viewport edge when content is short,\n beside the sidebar rather than under it. */}\n <div className=\"flex flex-1 flex-col min-w-0 md:min-h-0\">\n {/* `scrollbar-gutter: stable` reserves the scrollbar's track whether or\n not it is currently needed. Without it this element — the app's only\n scroll container from md up — narrows its own client box by the\n scrollbar width the moment a page's content outgrows it, and widens\n it again when the next page fits. Every centred `mx-auto` container\n inside then jumps sideways by half a scrollbar, and any fluid-width\n content changes width outright. Keksdose feedback #403 caught it as\n \"slight width increase/decrease\" when switching to the notifications\n settings section and back: that section is the only one tall enough\n to scroll. Platform-dependent, which is why it is easy to miss —\n overlay scrollbars (macOS, most Linux builds) take no layout space,\n classic ones (Windows) take ~15px.\n\n `both-edges`, not the bare `stable`: a one-sided reservation keeps the\n width stable but moves the middle. On a page short enough not to\n scroll, nothing is painted into the reserved track, so every centred\n `mx-auto` container sits half a scrollbar left of the optical centre\n and every full-bleed child stops ~15px short on the right. Keksdose\n feedback #491 (/settings#data) and #498 (/budgets) both reported it as\n \"the left boundary looks smaller / cut off compared to the right\" on\n the one element per page whose frame is a saturated colour — the rose\n destructive-action cards. Reserving the track on both edges keeps the\n content centred whether or not the scrollbar is showing. */}\n {/* `relative` makes <main> the containing block for everything absolutely\n positioned inside it. Tailwind's `sr-only` is `position:absolute`; with no\n positioned ancestor it resolves against the INITIAL containing block, is\n laid out at its offset from the top of the DOCUMENT, and grows\n `<html>`'s scroll height past the viewport — a second scrollbar beside this\n one that scrolls into empty space. Guarding it per component (see\n sr-only-containment.test) could never be complete: any page's own\n `sr-only` span re-opened it. Here it is closed for every child at once. */}\n <main className=\"relative flex-1 max-w-full overflow-x-clip pb-[calc(var(--app-nav-h,4rem)+1.5rem)] md:pb-0 md:min-h-0 md:overflow-y-auto md:[scrollbar-gutter:stable_both-edges]\">\n {children}\n </main>\n {footer}\n </div>\n </div>\n\n {/* The phone navigation: the group bar, and above it — when the current page\n belongs to a group with pages of its own — the row of those pages. The pair\n is the phone's version of the sidebar's two levels; without the upper row a\n group's `items` were simply unreachable below `md`. ONE measured box, so\n `--app-nav-h` covers both rows and whatever docks on the bar sits on the\n whole of it. */}\n <div\n ref={navRef}\n className=\"md:hidden fixed bottom-0 inset-x-0 z-30 border-t border-[var(--border)] bg-[var(--bg-surface)]\"\n >\n {mobileSubNav && <MobileSubNav nav={nav} />}\n <nav\n data-tour=\"nav\"\n className=\"grid\"\n style={{ gridTemplateColumns: `repeat(${nav.length}, minmax(0, 1fr))` }}\n >\n {nav.map((item) => (\n <MobileNavItem key={item.to} item={item} />\n ))}\n </nav>\n </div>\n </div>\n );\n}\n\n/** One cell of the phone's group bar. Marked while the group's own page OR any of its\n * pages is current — NavLink alone only knows its own `to`, which left the bar with\n * nothing marked on every sub-page (the same defect the sidebar had). */\nfunction MobileNavItem({ item }: { item: AppShellNavItem }) {\n const subActive = useSubItemActive(item);\n return (\n <NavLink\n to={item.to}\n end={item.end ?? true}\n data-tour={item.dataTour}\n className={({ isActive }) =>\n // The active page needs a clear marker, not just a subtle text\n // shade (feedback #327): brand-accent icon + label, bolder weight,\n // and a top accent bar spanning the cell so it reads at a glance.\n cn(\n \"relative flex flex-col items-center justify-center py-2 text-[11px] gap-0.5 transition-colors\",\n \"before:absolute before:content-[''] before:inset-x-4 before:top-0 before:h-0.5 before:rounded-full before:transition-colors\",\n isActive || subActive\n ? \"font-semibold text-[var(--brand)] before:bg-[var(--brand)]\"\n : \"text-[var(--text-muted)] before:bg-transparent\",\n )\n }\n >\n <span className=\"relative\">\n <item.icon className=\"size-5\" />\n </span>\n {/* One line, always. `truncate` is the backstop for the case a\n `shortLabel` was not supplied (or a translation is longer than its\n author expected): an ellipsis in one cell is a far smaller problem\n than a bar whose rows are different heights. */}\n <span className=\"max-w-full truncate px-0.5\">{item.shortLabel ?? item.label}</span>\n </NavLink>\n );\n}\n\n/**\n * The upper row of the phone navigation: the pages of the group the reader is in, as\n * a sideways-scrolling row of pills. Rendered only while such a group is current —\n * on a page outside every group the bar stays one row, rather than showing an empty\n * shelf or guessing a group.\n *\n * It slides in over 200ms (fade only under reduced motion) and wraps onto more rows\n * rather than scrolling, so every page of the group is in view at once.\n */\nfunction MobileSubNav({ nav }: { nav: AppShellNavItem[] }) {\n const { pathname } = useLocation();\n const group = nav.find(\n (item) =>\n !!item.items?.length &&\n (matchPath({ path: item.to, end: item.end ?? true }, pathname) ||\n item.items.some((sub) => matchPath({ path: sub.to, end: sub.end ?? true }, pathname))),\n );\n\n if (!group) return null;\n return (\n <nav\n aria-label={group.label}\n // Keyed by group so switching groups replays the entrance.\n key={group.to}\n className=\"animate-subnav border-b border-[var(--border)]\"\n >\n <ul\n // Wraps onto as many rows as the group needs rather than scrolling sideways: a\n // sideways row hides pages past the edge, and every page of the group in view\n // is the point of the row. The bar grows with it — `--app-nav-h` measures it.\n className=\"flex flex-wrap gap-1.5 px-3 py-2\"\n >\n {group.items!.map((sub) => (\n <li key={sub.to} className=\"shrink-0\">\n <NavLink\n to={sub.to}\n end={sub.end ?? true}\n className={({ isActive }) =>\n cn(\n \"flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs transition-colors\",\n isActive\n ? \"border-[var(--brand)] bg-[var(--brand)] font-medium text-[var(--brand-contrast)]\"\n : \"border-[var(--border)] text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]\",\n )\n }\n >\n <sub.icon className=\"size-3.5 shrink-0\" aria-hidden />\n {sub.label}\n </NavLink>\n </li>\n ))}\n </ul>\n </nav>\n );\n}\n\n/** `strong` is the current page; `trail` is the group that CONTAINS the current page\n * while the page itself is shown elsewhere (the inline list below it). */\nconst navLinkClass = (collapsed: boolean, forceActive: boolean, trail = false) =>\n ({ isActive }: { isActive: boolean }) =>\n `flex items-center gap-3 min-h-9 ${collapsed ? \"justify-center px-2\" : \"px-3\"} py-2 rounded-md text-sm transition-colors duration-150 ${\n isActive || (forceActive && !trail)\n ? \"bg-[var(--bg-inverse)] text-[var(--text-inverse)]\"\n : forceActive\n ? \"font-medium text-[var(--text-primary)] hover:bg-[var(--bg-hover)]\"\n : \"text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]\"\n }`;\n\n/** Whether any of an entry's sub-items is the current route. NavLink only knows about\n * its OWN `to`, so without this a group whose pages live at sibling paths\n * (`/fields`, `/numbers`, …) lost its highlight the moment the reader left the one\n * page the group linked to — the sidebar then marked nothing at all, and the only\n * \"you are here\" left was inside a flyout that is closed unless hovered. */\nfunction useSubItemActive(item: AppShellNavItem): boolean {\n const { pathname } = useLocation();\n return !!item.items?.some((sub) => matchPath({ path: sub.to, end: sub.end ?? true }, pathname));\n}\n\n/** A single desktop sidebar entry. Plain link (with a tooltip when collapsed) —\n * unless it has sub-items, in which case hovering/focusing opens a flyout, or (with\n * `inline`) a disclosure lists them underneath. */\nfunction SidebarNavItem({\n item,\n collapsed,\n inline,\n toggleGroupLabel,\n openGroup,\n setOpenGroup,\n}: {\n item: AppShellNavItem;\n collapsed: boolean;\n inline: boolean;\n toggleGroupLabel: (groupLabel: string) => string;\n openGroup: string | null;\n setOpenGroup: (to: string | null) => void;\n}) {\n const hasSub = !!item.items?.length;\n const subActive = useSubItemActive(item);\n\n // In the EXPANDED sidebar a group is one component in both styles, so switching\n // between them is a transition of the same element (the page list folding away or\n // unfolding) rather than one tree replaced by another. The icon-only sidebar keeps\n // the plain flyout below: an indented list has no room there.\n if (hasSub && !collapsed) {\n return (\n <SidebarGroup\n item={item}\n subActive={subActive}\n inline={inline}\n toggleGroupLabel={toggleGroupLabel}\n open={openGroup === item.to}\n setOpenGroup={setOpenGroup}\n />\n );\n }\n\n const link = (\n <NavLink\n to={item.to}\n end={item.end ?? true}\n data-tour={item.dataTour}\n className={navLinkClass(collapsed, subActive)}\n aria-haspopup={hasSub ? \"menu\" : undefined}\n >\n <span className=\"relative shrink-0\">\n <item.icon className=\"size-4\" />\n </span>\n {/* Wraps rather than truncates: in the sidebar a label cut to \"Checkbox, switch\n & sl…\" hides the one word that tells two pages apart, and there is height\n to spare. (The phone bar keeps `truncate` — its cells must stay one row.) */}\n {!collapsed && <span className=\"min-w-0 flex-1 break-words leading-snug\">{item.label}</span>}\n {!collapsed && hasSub && <ChevronRight className=\"size-3.5 shrink-0 opacity-60\" />}\n </NavLink>\n );\n\n if (hasSub) return <SidebarFlyout item={item}>{link}</SidebarFlyout>;\n return collapsed ? (\n <Tooltip label={item.label} side=\"right\" portal className=\"block\">\n {link}\n </Tooltip>\n ) : (\n link\n );\n}\n\n/**\n * An entry with sub-items in the expanded sidebar.\n *\n * - `inline`: the entry's own link (its overview page) plus a chevron button that\n * shows or hides the sub-items indented beneath it. Two controls rather than one\n * because they do two different things — a row that both navigated AND toggled\n * would make \"open the overview\" and \"peek at the pages\" the same click.\n * - flyout: the link alone, with the sub-items in a panel beside the sidebar on\n * hover/focus. The inline list is still rendered, folded shut, so that switching\n * styles animates it rather than swapping it.\n *\n * THE FOLD is a `grid-template-rows` transition from `0fr` to `1fr` — the one way to\n * animate to a content-sized height without measuring it, so a translated label that\n * wraps to two lines unfolds exactly as far as it needs. `visibility` rides the same\n * transition so a shut list drops out of the accessibility tree only once it has\n * finished closing, and `inert` takes its links out of the tab order immediately.\n */\nfunction SidebarGroup({\n item,\n subActive,\n inline,\n toggleGroupLabel,\n open,\n setOpenGroup,\n}: {\n item: AppShellNavItem;\n subActive: boolean;\n inline: boolean;\n toggleGroupLabel: (groupLabel: string) => string;\n /** Whether this is the sidebar's one open group (see AppShell's `openGroup`). */\n open: boolean;\n setOpenGroup: (to: string | null) => void;\n}) {\n const listId = useId();\n const { pathname } = useLocation();\n const onOwnPage = !!matchPath({ path: item.to, end: item.end ?? true }, pathname);\n // Opening follows the reader: arriving on this group's overview or one of its pages\n // (by link, by the pager, by Back) opens it — and, the sidebar holding ONE open\n // group, closes whichever was open before. Both folds run at once, so the eye sees\n // one list hand over to the other. Run in an effect after mount, so the current\n // group UNFOLDS into view on load rather than appearing already open.\n const here = subActive || onOwnPage;\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- follows the route, see above\n if (here) setOpenGroup(item.to);\n }, [here, item.to, setOpenGroup]);\n const expanded = inline && open;\n\n const link = (\n <NavLink\n to={item.to}\n end={item.end ?? true}\n data-tour={item.dataTour}\n aria-haspopup={inline ? undefined : \"menu\"}\n // `trail` (inline only): while a page of the group is current, the group row is\n // the breadcrumb, not the destination — the page's own row below carries the\n // strong marker, and two inverse rows would say \"you are here\" twice. In the\n // flyout style the pages are out of sight, so the group row IS the marker.\n className={(state) => cn(navLinkClass(false, subActive, inline)(state), \"min-w-0 flex-1\")}\n >\n <span className=\"relative shrink-0\">\n <item.icon className=\"size-4\" />\n </span>\n <span className=\"min-w-0 flex-1 break-words leading-snug\">{item.label}</span>\n {!inline && <ChevronRight className=\"size-3.5 shrink-0 opacity-60 rtl:-scale-x-100\" />}\n </NavLink>\n );\n\n return (\n <div>\n {inline ? (\n <div className=\"flex items-center gap-0.5\">\n {link}\n <button\n type=\"button\"\n aria-expanded={open}\n aria-controls={listId}\n aria-label={toggleGroupLabel(item.label)}\n onClick={() => setOpenGroup(open ? null : item.to)}\n className=\"flex size-9 shrink-0 items-center justify-center rounded-md text-[var(--text-muted)] hover:bg-[var(--bg-hover)] hover:text-[var(--text-secondary)]\"\n >\n <ChevronRight\n aria-hidden\n className={cn(\n \"size-3.5 transition-transform duration-200 ease-out motion-reduce:transition-none rtl:-scale-x-100\",\n open && \"rotate-90 rtl:rotate-90\",\n )}\n />\n </button>\n </div>\n ) : (\n <SidebarFlyout item={item}>{link}</SidebarFlyout>\n )}\n <div\n id={listId}\n inert={!expanded}\n className=\"grid transition-[grid-template-rows,visibility] duration-200 ease-out motion-reduce:transition-none\"\n style={{\n gridTemplateRows: expanded ? \"1fr\" : \"0fr\",\n visibility: expanded ? \"visible\" : \"hidden\",\n }}\n >\n <div\n className={cn(\n \"min-h-0 overflow-hidden transition-opacity duration-200 ease-out motion-reduce:transition-none\",\n expanded ? \"opacity-100\" : \"opacity-0\",\n )}\n >\n {/* The rule and indent live on the list INSIDE the clipping box: margin or\n padding on the element whose row is collapsing to 0fr would hold it open\n by that much. */}\n <ul className=\"ms-[1.3rem] mt-0.5 space-y-0.5 border-s border-[var(--border)] ps-2\">\n {item.items!.map((sub) => (\n <li key={sub.to}>\n <NavLink\n to={sub.to}\n end={sub.end ?? true}\n className={({ isActive }) =>\n cn(\n \"flex min-h-8 items-center gap-2.5 rounded-md px-2.5 py-1.5 text-sm transition-colors\",\n isActive\n ? \"bg-[var(--bg-inverse)] text-[var(--text-inverse)]\"\n : \"text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]\",\n )\n }\n >\n <sub.icon className=\"size-4 shrink-0 opacity-70\" aria-hidden />\n <span className=\"min-w-0 break-words leading-snug\">{sub.label}</span>\n </NavLink>\n </li>\n ))}\n </ul>\n </div>\n </div>\n </div>\n );\n}\n\n// Only ONE sidebar flyout should be on screen at a time. Each open flyout parks its\n// \"close now\" here so the next item to open can dismiss it immediately, instead of\n// leaving the previous panel up for the 140ms travel delay while the cursor moves\n// down the nav list — which showed two panels at once.\nlet activeFlyoutClose: (() => void) | null = null;\n\n/**\n * Wraps a nav item that has sub-items: on hover or keyboard focus it opens a\n * portalled flyout to the right of the sidebar (portalled so the sidebar's\n * `overflow-hidden` can't clip it) with the item's label as a header and each\n * sub-item as an icon + title link. A short close delay lets the cursor travel\n * from the item onto the panel; Escape / outside-move close it.\n */\nfunction SidebarFlyout({ item, children }: { item: AppShellNavItem; children: ReactNode }) {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const [open, setOpen] = useState(false);\n\n // Anchor the flyout to the item's right edge; the hook re-measures on\n // scroll/resize (the nav list can scroll).\n const rect = useAnchoredRect(wrapperRef, open);\n const pos = rect ? { top: rect.top, left: rect.right } : null;\n\n const cancelClose = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current);\n closeTimer.current = null;\n }\n }, []);\n // Stable identity: the coordinator above holds this so a sibling item can close\n // THIS flyout without waiting out its travel delay.\n const closeNow = useCallback(() => {\n cancelClose();\n setOpen(false);\n }, [cancelClose]);\n const openMenu = useCallback(() => {\n cancelClose();\n if (activeFlyoutClose && activeFlyoutClose !== closeNow) activeFlyoutClose();\n activeFlyoutClose = closeNow;\n setOpen(true);\n }, [cancelClose, closeNow]);\n const scheduleClose = useCallback(() => {\n cancelClose();\n closeTimer.current = setTimeout(() => {\n setOpen(false);\n if (activeFlyoutClose === closeNow) activeFlyoutClose = null;\n }, 140);\n }, [cancelClose, closeNow]);\n\n // Close on Escape while open.\n useEscapeKey(() => setOpen(false), open);\n\n useEffect(\n () => () => {\n cancelClose();\n if (activeFlyoutClose === closeNow) activeFlyoutClose = null;\n },\n [cancelClose, closeNow],\n );\n\n return (\n <div\n ref={wrapperRef}\n className=\"relative\"\n onMouseEnter={openMenu}\n onMouseLeave={scheduleClose}\n onFocus={openMenu}\n onBlur={scheduleClose}\n >\n {children}\n {open &&\n pos &&\n createPortal(\n <div\n style={{ position: \"fixed\", top: pos.top, left: pos.left }}\n className=\"z-40 pl-1\"\n onMouseEnter={cancelClose}\n onMouseLeave={scheduleClose}\n >\n <div\n role=\"menu\"\n aria-label={item.label}\n className=\"animate-flyout min-w-52 overflow-hidden rounded-md border border-[var(--border)] bg-[var(--bg-surface)] shadow-lg\"\n >\n <div className=\"border-b border-[var(--border)] px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-[var(--text-muted)]\">\n {item.label}\n </div>\n <ul className=\"py-1\">\n {item.items!.map((sub) => (\n <li key={sub.to}>\n <NavLink\n to={sub.to}\n end={sub.end ?? true}\n role=\"menuitem\"\n onClick={() => setOpen(false)}\n className={({ isActive }) =>\n cn(\n \"flex items-center gap-2.5 px-3 py-2 text-sm\",\n isActive\n ? \"bg-[var(--bg-active)] font-medium text-[var(--text-primary)]\"\n : \"text-[var(--text-secondary)] hover:bg-[var(--bg-hover)]\",\n )\n }\n >\n <sub.icon className=\"size-4 shrink-0 text-[var(--text-placeholder)]\" />\n <span className=\"min-w-0 break-words leading-snug\">{sub.label}</span>\n </NavLink>\n </li>\n ))}\n </ul>\n </div>\n </div>,\n document.body,\n )}\n </div>\n );\n}\n"],"mappings":";AAuOgB,cA0BF,YA1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|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { Check } from "lucide-react";
|
|
3
4
|
import { HoverMenu } from "../components/hover-menu.js";
|
|
@@ -18,7 +19,7 @@ function OptionSwitcherMenu({
|
|
|
18
19
|
ariaLabel,
|
|
19
20
|
trigger: ({ toggle }) => /* @__PURE__ */ jsx(Tooltip, { label: title, portal: true, children: /* @__PURE__ */ jsx("button", { type: "button", onClick: toggle, "aria-label": ariaLabel, className: TOPBAR_TRIGGER_CLASS, children: icon }) }),
|
|
20
21
|
children: (close) => /* @__PURE__ */ jsxs("ul", { className: "py-1", children: [
|
|
21
|
-
heading && /* @__PURE__ */ jsx("li", { className: "px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-
|
|
22
|
+
heading && /* @__PURE__ */ jsx("li", { className: "px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-[var(--text-placeholder)]", children: heading }),
|
|
22
23
|
options.map((opt) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
23
24
|
"button",
|
|
24
25
|
{
|
|
@@ -30,7 +31,7 @@ function OptionSwitcherMenu({
|
|
|
30
31
|
className: TOPBAR_MENU_ITEM_CLASS,
|
|
31
32
|
children: [
|
|
32
33
|
/* @__PURE__ */ jsx("span", { children: opt.label }),
|
|
33
|
-
value === opt.value && /* @__PURE__ */ jsx(Check, { className: "size-4 text-
|
|
34
|
+
value === opt.value && /* @__PURE__ */ jsx(Check, { className: "size-4 text-[var(--text-secondary)]" })
|
|
34
35
|
]
|
|
35
36
|
}
|
|
36
37
|
) }, opt.value))
|