@flamingo-stack/openframe-frontend-core 0.0.825 → 0.0.826
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/dist/build/export-map.json +1 -1
- package/dist/{case-study-card-IZBMHA6R.cjs → case-study-card-O4IQCJAX.cjs} +5 -5
- package/dist/{chunk-QOAA7ZHB.cjs → chunk-2HQNXX2K.cjs} +2 -2
- package/dist/{chunk-2U7GXE3T.cjs → chunk-2TQJSB62.cjs} +2157 -811
- package/dist/{chunk-NONMZ5WJ.cjs → chunk-2VLPXUQK.cjs} +14 -83
- package/dist/{chunk-7DJWIVQC.cjs → chunk-37OYBX7W.cjs} +36 -36
- package/dist/{chunk-OBQ5WUNG.cjs → chunk-3B6ZE4EZ.cjs} +29 -29
- package/dist/{chunk-AO6YVNAH.cjs → chunk-5AQKXEMI.cjs} +979 -1357
- package/dist/{chunk-25HBH4J6.cjs → chunk-5BM7X4GA.cjs} +2 -2
- package/dist/{chunk-47SHKOCY.cjs → chunk-63T2KKDZ.cjs} +86 -86
- package/dist/{chunk-MHR4C465.cjs → chunk-6G4WRMEM.cjs} +3 -3
- package/dist/{chunk-AUBR3FGY.cjs → chunk-74GWFGH2.cjs} +28 -28
- package/dist/{chunk-467T3LCG.cjs → chunk-7PZQ7SHB.cjs} +49 -32
- package/dist/{chunk-6LVJKPR3.cjs → chunk-AJM4YZTW.cjs} +8 -8
- package/dist/{chunk-2XLPRW7V.cjs → chunk-BIG3O33P.cjs} +6 -2
- package/dist/chunk-BMQLM2NU.cjs +40 -0
- package/dist/{chunk-DVHSYPDB.cjs → chunk-DAKGX2WF.cjs} +2 -2
- package/dist/{chunk-2IWAHBCC.cjs → chunk-DRSFR5AC.cjs} +159 -159
- package/dist/{chunk-IJCSQFLD.cjs → chunk-DU6AF77X.cjs} +83 -121
- package/dist/{chunk-NL34HKLS.cjs → chunk-EJNDTSKY.cjs} +91 -91
- package/dist/{chunk-SBFBNOKU.cjs → chunk-ENMPSEEQ.cjs} +4 -4
- package/dist/{chunk-ZECG6GU5.cjs → chunk-F2J5WN6U.cjs} +2 -2
- package/dist/{chunk-BOS7OIC4.cjs → chunk-GRHF5SWL.cjs} +5 -2
- package/dist/{chunk-Z7BLMJEI.cjs → chunk-GZAPOCKS.cjs} +54 -54
- package/dist/{chunk-5S2GW6YG.cjs → chunk-HJAPXKWK.cjs} +17 -17
- package/dist/{chunk-P25RVNGX.cjs → chunk-HQ4FKHOO.cjs} +249 -108
- package/dist/{chunk-ZRDVFADQ.cjs → chunk-IBD2FPSX.cjs} +75 -9
- package/dist/{chunk-T266OITJ.cjs → chunk-IKWQW3YJ.cjs} +45 -45
- package/dist/{chunk-B7NSH7IK.cjs → chunk-IWQ2LJGW.cjs} +5 -5
- package/dist/{chunk-MALCUN2G.cjs → chunk-JDR72QFU.cjs} +12 -14
- package/dist/{chunk-EHANO6UE.cjs → chunk-K34TTZAE.cjs} +9 -129
- package/dist/{chunk-QDDBOCG3.cjs → chunk-KPGKTEEB.cjs} +2 -2
- package/dist/{chunk-4IY5FKYL.cjs → chunk-MDEOCOIE.cjs} +23 -23
- package/dist/chunk-OEP5KAT6.cjs +56 -0
- package/dist/chunk-OT6P57ZS.cjs +94 -0
- package/dist/{chunk-QQT23JJ7.cjs → chunk-PBHP3FHO.cjs} +4 -4
- package/dist/{chunk-IMMTH3F3.cjs → chunk-PJY3SYCS.cjs} +29 -27
- package/dist/{chunk-N7IDLF2G.cjs → chunk-PWAKRRRO.cjs} +1283 -268
- package/dist/{chunk-UEULXVW2.cjs → chunk-QS6AKUUL.cjs} +22 -22
- package/dist/{chunk-BN7QENV7.cjs → chunk-QYJZDEG7.cjs} +6 -6
- package/dist/{chunk-NPNZAAOB.cjs → chunk-S6UJEW4G.cjs} +2 -2
- package/dist/{chunk-XJMLZ63Y.cjs → chunk-TJG2BJ5J.cjs} +4 -4
- package/dist/{chunk-QOOMUGF2.cjs → chunk-TYJ73DHW.cjs} +15 -15
- package/dist/{chunk-A34UNP5V.cjs → chunk-W4VEDSAX.cjs} +80 -11
- package/dist/{chunk-DNZCSPMU.cjs → chunk-WGMU45NV.cjs} +20 -20
- package/dist/{chunk-APTFXX2C.cjs → chunk-XDHQC4XH.cjs} +46 -46
- package/dist/{cloud-tenants-M4VFFN33.cjs → cloud-tenants-F67KQ5GC.cjs} +108 -106
- package/dist/components/case-studies/index.cjs +124 -122
- package/dist/components/chat/approval-batch-message.d.ts.map +1 -1
- package/dist/components/chat/approval-batch-message.js +2 -2
- package/dist/components/chat/chat-archive-page.d.ts +7 -0
- package/dist/components/chat/chat-archive-page.d.ts.map +1 -1
- package/dist/components/chat/chat-archive-page.js +9 -0
- package/dist/components/chat/chat-composer.d.ts +24 -4
- package/dist/components/chat/chat-composer.d.ts.map +1 -1
- package/dist/components/chat/chat-composer.js +90 -48
- package/dist/components/chat/chat-context-memory-bar.d.ts +4 -1
- package/dist/components/chat/chat-context-memory-bar.d.ts.map +1 -1
- package/dist/components/chat/chat-context-memory-bar.js +8 -5
- package/dist/components/chat/chat-context-picker.d.ts +8 -1
- package/dist/components/chat/chat-context-picker.d.ts.map +1 -1
- package/dist/components/chat/chat-context-picker.js +32 -9
- package/dist/components/chat/chat-header-rename-field.d.ts +18 -0
- package/dist/components/chat/chat-header-rename-field.d.ts.map +1 -0
- package/dist/components/chat/chat-header-rename-field.js +49 -0
- package/dist/components/chat/chat-input.d.ts.map +1 -1
- package/dist/components/chat/chat-input.js +5 -0
- package/dist/components/chat/composer-sheet.d.ts +44 -0
- package/dist/components/chat/composer-sheet.d.ts.map +1 -0
- package/dist/components/chat/composer-sheet.js +140 -0
- package/dist/components/chat/embeddable-chat.d.ts +114 -1
- package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
- package/dist/components/chat/embeddable-chat.js +328 -215
- package/dist/components/chat/index.cjs +118 -103
- package/dist/components/chat/index.d.ts +6 -0
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +9 -0
- package/dist/components/chat/mingo-chat-day-groups.d.ts +18 -0
- package/dist/components/chat/mingo-chat-day-groups.d.ts.map +1 -0
- package/dist/components/chat/mingo-chat-day-groups.js +45 -0
- package/dist/components/chat/mingo-chat-header.d.ts +34 -6
- package/dist/components/chat/mingo-chat-header.d.ts.map +1 -1
- package/dist/components/chat/mingo-chat-header.js +44 -7
- package/dist/components/chat/mingo-chat-history-section.d.ts +30 -0
- package/dist/components/chat/mingo-chat-history-section.d.ts.map +1 -0
- package/dist/components/chat/mingo-chat-history-section.js +500 -0
- package/dist/components/chat/mingo-chat-history.d.ts +5 -2
- package/dist/components/chat/mingo-chat-history.d.ts.map +1 -1
- package/dist/components/chat/mingo-chat-history.js +26 -30
- package/dist/components/chat/mingo-chat-list-shared.d.ts +136 -0
- package/dist/components/chat/mingo-chat-list-shared.d.ts.map +1 -0
- package/dist/components/chat/mingo-chat-list-shared.js +76 -0
- package/dist/components/chat/mingo-chat-rail.d.ts +19 -51
- package/dist/components/chat/mingo-chat-rail.d.ts.map +1 -1
- package/dist/components/chat/mingo-chat-rail.js +23 -45
- package/dist/components/chat/mingo-edge-light.d.ts +13 -0
- package/dist/components/chat/mingo-edge-light.d.ts.map +1 -0
- package/dist/components/chat/mingo-edge-light.js +17 -0
- package/dist/components/chat/mingo-history-rail.d.ts +5 -4
- package/dist/components/chat/mingo-history-rail.d.ts.map +1 -1
- package/dist/components/chat/mingo-history-rail.js +5 -10
- package/dist/components/chat/mingo-quick-action-wall.d.ts +27 -0
- package/dist/components/chat/mingo-quick-action-wall.d.ts.map +1 -0
- package/dist/components/chat/mingo-quick-action-wall.js +41 -0
- package/dist/components/chat/mingo-welcome.d.ts.map +1 -1
- package/dist/components/chat/mingo-welcome.js +6 -20
- package/dist/components/chat/model-display.d.ts.map +1 -1
- package/dist/components/chat/model-display.js +38 -9
- package/dist/components/chat/tool-execution-display.d.ts.map +1 -1
- package/dist/components/chat/tool-execution-display.js +15 -1
- package/dist/components/chat/types/component.types.d.ts +13 -1
- package/dist/components/chat/types/component.types.d.ts.map +1 -1
- package/dist/components/chat/utils/chat-day-label.d.ts +8 -0
- package/dist/components/chat/utils/chat-day-label.d.ts.map +1 -0
- package/dist/components/chat/utils/chat-day-label.js +21 -0
- package/dist/components/contact/index.cjs +109 -107
- package/dist/components/docs/index.cjs +112 -110
- package/dist/components/embeds/index.cjs +109 -107
- package/dist/components/faq/index.cjs +110 -108
- package/dist/components/features/board/board-column.d.ts +3 -1
- package/dist/components/features/board/board-column.d.ts.map +1 -1
- package/dist/components/features/board/board-column.js +6 -2
- package/dist/components/features/board/board.d.ts +6 -0
- package/dist/components/features/board/board.d.ts.map +1 -1
- package/dist/components/features/board/board.js +14 -3
- package/dist/components/features/board/touch-board.d.ts +1 -1
- package/dist/components/features/board/touch-board.d.ts.map +1 -1
- package/dist/components/features/board/touch-board.js +3 -1
- package/dist/components/features/index.cjs +108 -106
- package/dist/components/features/notifications/approval-request-notification-tile.d.ts +7 -1
- package/dist/components/features/notifications/approval-request-notification-tile.d.ts.map +1 -1
- package/dist/components/features/notifications/approval-request-notification-tile.js +1 -1
- package/dist/components/features/notifications/notification-drawer.d.ts +6 -1
- package/dist/components/features/notifications/notification-drawer.d.ts.map +1 -1
- package/dist/components/features/notifications/notification-drawer.js +3 -2
- package/dist/components/features/notifications/notification-tile.d.ts +4 -1
- package/dist/components/features/notifications/notification-tile.d.ts.map +1 -1
- package/dist/components/features/notifications/notification-tile.js +9 -7
- package/dist/components/features/time-tracker/time-tracker-header-button.d.ts +18 -1
- package/dist/components/features/time-tracker/time-tracker-header-button.d.ts.map +1 -1
- package/dist/components/features/time-tracker/time-tracker-header-button.js +31 -7
- package/dist/components/help-center-pages/index.cjs +217 -215
- package/dist/components/icons-v2-generated/icon-loaders.d.ts.map +1 -1
- package/dist/components/icons-v2-generated/icon-loaders.js +1 -0
- package/dist/components/icons-v2-generated/icon-names.js +1 -1
- package/dist/components/icons-v2-generated/index.cjs +90 -86
- package/dist/components/icons-v2-generated/loaders/dots-loader-icon.d.ts.map +1 -1
- package/dist/components/icons-v2-generated/loaders/dots-loader-icon.js +21 -24
- package/dist/components/icons-v2-generated/logos/index.d.ts +1 -0
- package/dist/components/icons-v2-generated/logos/index.d.ts.map +1 -1
- package/dist/components/icons-v2-generated/logos/index.js +2 -0
- package/dist/components/icons-v2-generated/logos/mingo-logo-icon.d.ts +9 -0
- package/dist/components/icons-v2-generated/logos/mingo-logo-icon.d.ts.map +1 -0
- package/dist/components/icons-v2-generated/logos/mingo-logo-icon.js +36 -0
- package/dist/components/index.cjs +215 -182
- package/dist/components/meeting-scheduler/index.cjs +182 -180
- package/dist/components/navigation/account-popover.d.ts +62 -0
- package/dist/components/navigation/account-popover.d.ts.map +1 -0
- package/dist/components/navigation/account-popover.js +138 -0
- package/dist/components/navigation/app-header.d.ts +36 -2
- package/dist/components/navigation/app-header.d.ts.map +1 -1
- package/dist/components/navigation/app-header.js +28 -24
- package/dist/components/navigation/app-layout-context.d.ts +17 -0
- package/dist/components/navigation/app-layout-context.d.ts.map +1 -1
- package/dist/components/navigation/app-layout-context.js +9 -1
- package/dist/components/navigation/app-layout.d.ts +93 -1
- package/dist/components/navigation/app-layout.d.ts.map +1 -1
- package/dist/components/navigation/app-layout.js +149 -30
- package/dist/components/navigation/header-button.d.ts +11 -1
- package/dist/components/navigation/header-button.d.ts.map +1 -1
- package/dist/components/navigation/header-button.js +16 -5
- package/dist/components/navigation/header-mingo-button.d.ts.map +1 -1
- package/dist/components/navigation/header-mingo-button.js +6 -5
- package/dist/components/navigation/index.cjs +120 -109
- package/dist/components/navigation/index.d.ts +10 -1
- package/dist/components/navigation/index.d.ts.map +1 -1
- package/dist/components/navigation/index.js +8 -0
- package/dist/components/navigation/mingo-ai-button.d.ts.map +1 -1
- package/dist/components/navigation/mingo-ai-button.js +2 -1
- package/dist/components/navigation/mobile-burger-menu.d.ts.map +1 -1
- package/dist/components/navigation/mobile-burger-menu.js +155 -39
- package/dist/components/navigation/navigation-sidebar-grouped.d.ts +57 -0
- package/dist/components/navigation/navigation-sidebar-grouped.d.ts.map +1 -0
- package/dist/components/navigation/navigation-sidebar-grouped.js +365 -0
- package/dist/components/navigation/navigation-sidebar-match.d.ts +37 -0
- package/dist/components/navigation/navigation-sidebar-match.d.ts.map +1 -0
- package/dist/components/navigation/navigation-sidebar-match.js +85 -0
- package/dist/components/navigation/navigation-sidebar-slot.d.ts +7 -0
- package/dist/components/navigation/navigation-sidebar-slot.d.ts.map +1 -0
- package/dist/components/navigation/navigation-sidebar-slot.js +11 -0
- package/dist/components/navigation/navigation-sidebar-toggle.d.ts +7 -1
- package/dist/components/navigation/navigation-sidebar-toggle.d.ts.map +1 -1
- package/dist/components/navigation/navigation-sidebar-toggle.js +52 -23
- package/dist/components/navigation/navigation-sidebar.d.ts +13 -1
- package/dist/components/navigation/navigation-sidebar.d.ts.map +1 -1
- package/dist/components/navigation/navigation-sidebar.js +188 -52
- package/dist/components/navigation/notifications-bell-button.d.ts +28 -0
- package/dist/components/navigation/notifications-bell-button.d.ts.map +1 -0
- package/dist/components/navigation/notifications-bell-button.js +44 -0
- package/dist/components/navigation/ticket-alerts-button.d.ts +7 -1
- package/dist/components/navigation/ticket-alerts-button.d.ts.map +1 -1
- package/dist/components/navigation/ticket-alerts-button.js +3 -2
- package/dist/components/onboarding-guides/index.cjs +111 -109
- package/dist/components/product-demo/index.cjs +119 -117
- package/dist/components/related-content/index.cjs +13 -13
- package/dist/components/tickets/index.cjs +115 -113
- package/dist/components/ui/actions-menu.d.ts +6 -1
- package/dist/components/ui/actions-menu.d.ts.map +1 -1
- package/dist/components/ui/actions-menu.js +6 -2
- package/dist/components/ui/fade-preview.d.ts +8 -0
- package/dist/components/ui/fade-preview.d.ts.map +1 -1
- package/dist/components/ui/fade-preview.js +7 -5
- package/dist/components/ui/index.cjs +136 -111
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/mobile-action-bar.d.ts +14 -0
- package/dist/components/ui/mobile-action-bar.d.ts.map +1 -0
- package/dist/components/ui/mobile-action-bar.js +68 -0
- package/dist/components/ui/no-data/no-data-styles.d.ts +1 -1
- package/dist/components/ui/no-data/no-data-styles.d.ts.map +1 -1
- package/dist/components/ui/no-data/no-data-styles.js +1 -1
- package/dist/components/ui/page-actions.d.ts.map +1 -1
- package/dist/components/ui/page-actions.js +24 -8
- package/dist/components/ui/panel-resize-handle.d.ts +6 -2
- package/dist/components/ui/panel-resize-handle.d.ts.map +1 -1
- package/dist/components/ui/panel-resize-handle.js +6 -3
- package/dist/components/ui/square-avatar.d.ts.map +1 -1
- package/dist/components/ui/square-avatar.js +5 -2
- package/dist/{devices-DW5NDXMD.cjs → devices-SJORCARH.cjs} +109 -107
- package/dist/dots-loader-icon-5JXWD6FB.cjs +7 -0
- package/dist/{embeddable-chat-NBJMXEXB.cjs → embeddable-chat-7Z4CEZJL.cjs} +513 -398
- package/dist/hooks/index.cjs +15 -16
- package/dist/hooks/ui/use-content-breakpoint.d.ts +4 -2
- package/dist/hooks/ui/use-content-breakpoint.d.ts.map +1 -1
- package/dist/{icon-loaders-OLGJZGRP.cjs → icon-loaders-SUPEKMBJ.cjs} +2 -1
- package/dist/index.cjs +154 -121
- package/dist/{knowledge-EYJG2TNW.cjs → knowledge-QXILUVEM.cjs} +109 -107
- package/dist/{logs-2LV7DTSL.cjs → logs-E3KQQQD6.cjs} +118 -115
- package/dist/mingo-logo-icon-WGPBSDTF.cjs +7 -0
- package/dist/{policies-HSDYIQBX.cjs → policies-IOYQY6TF.cjs} +112 -110
- package/dist/{remote-session-BQMTIQTU.cjs → remote-session-QGFG5WAL.cjs} +99 -97
- package/dist/{scripts-UI6V7ANQ.cjs → scripts-E5TWWUNP.cjs} +115 -113
- package/dist/{software-update-WMLY7VHH.cjs → software-update-QZGYG4TD.cjs} +112 -110
- package/dist/{tickets-board-TRXOX77R.cjs → tickets-board-KCH6ITUV.cjs} +95 -94
- package/dist/types/navigation.d.ts +131 -0
- package/dist/types/navigation.d.ts.map +1 -1
- package/dist/utils/index.cjs +65 -25
- package/package.json +1 -1
- package/src/components/chat/approval-batch-message.tsx +3 -2
- package/src/components/chat/chat-archive-page.tsx +16 -0
- package/src/components/chat/chat-composer.tsx +131 -61
- package/src/components/chat/chat-context-memory-bar.tsx +27 -17
- package/src/components/chat/chat-context-picker.tsx +45 -11
- package/src/components/chat/chat-header-rename-field.tsx +68 -0
- package/src/components/chat/chat-input.tsx +9 -1
- package/src/components/chat/composer-sheet.tsx +196 -0
- package/src/components/chat/embeddable-chat.tsx +636 -319
- package/src/components/chat/index.ts +6 -0
- package/src/components/chat/mingo-chat-day-groups.ts +62 -0
- package/src/components/chat/mingo-chat-header.tsx +99 -23
- package/src/components/chat/mingo-chat-history-section.tsx +670 -0
- package/src/components/chat/mingo-chat-history.tsx +31 -45
- package/src/components/chat/mingo-chat-list-shared.tsx +244 -0
- package/src/components/chat/mingo-chat-rail.tsx +45 -97
- package/src/components/chat/mingo-edge-light.tsx +25 -0
- package/src/components/chat/mingo-history-rail.tsx +7 -17
- package/src/components/chat/mingo-quick-action-wall.tsx +64 -0
- package/src/components/chat/mingo-welcome.tsx +5 -19
- package/src/components/chat/model-display.tsx +66 -14
- package/src/components/chat/tool-execution-display.tsx +9 -1
- package/src/components/chat/types/component.types.ts +13 -1
- package/src/components/chat/utils/chat-day-label.ts +24 -0
- package/src/components/features/board/board-column.tsx +8 -0
- package/src/components/features/board/board.tsx +16 -2
- package/src/components/features/board/touch-board.tsx +2 -0
- package/src/components/features/notifications/approval-request-notification-tile.tsx +8 -2
- package/src/components/features/notifications/notification-drawer.tsx +7 -1
- package/src/components/features/notifications/notification-tile.tsx +17 -9
- package/src/components/features/time-tracker/time-tracker-header-button.tsx +53 -6
- package/src/components/icons-v2/icon-colors.json +4 -0
- package/src/components/icons-v2-generated/icon-loaders.ts +1 -0
- package/src/components/icons-v2-generated/icon-names.ts +1 -1
- package/src/components/icons-v2-generated/loaders/dots-loader-icon.tsx +18 -27
- package/src/components/icons-v2-generated/logos/index.ts +1 -0
- package/src/components/icons-v2-generated/logos/mingo-logo-icon.tsx +35 -0
- package/src/components/navigation/account-popover.tsx +198 -0
- package/src/components/navigation/app-header.tsx +74 -33
- package/src/components/navigation/app-layout-context.ts +22 -0
- package/src/components/navigation/app-layout.tsx +290 -24
- package/src/components/navigation/header-button.tsx +27 -5
- package/src/components/navigation/header-mingo-button.tsx +6 -5
- package/src/components/navigation/index.ts +19 -0
- package/src/components/navigation/mingo-ai-button.tsx +2 -3
- package/src/components/navigation/mobile-burger-menu.tsx +219 -53
- package/src/components/navigation/navigation-sidebar-grouped.tsx +554 -0
- package/src/components/navigation/navigation-sidebar-match.ts +152 -0
- package/src/components/navigation/navigation-sidebar-slot.ts +12 -0
- package/src/components/navigation/navigation-sidebar-toggle.tsx +39 -6
- package/src/components/navigation/navigation-sidebar.tsx +278 -61
- package/src/components/navigation/notifications-bell-button.tsx +70 -0
- package/src/components/navigation/ticket-alerts-button.tsx +9 -2
- package/src/components/ui/actions-menu.tsx +19 -3
- package/src/components/ui/fade-preview.tsx +13 -6
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/mobile-action-bar.ts +87 -0
- package/src/components/ui/no-data/no-data-styles.ts +5 -2
- package/src/components/ui/page-actions.tsx +38 -11
- package/src/components/ui/panel-resize-handle.tsx +14 -5
- package/src/components/ui/square-avatar.tsx +5 -2
- package/src/hooks/ui/use-content-breakpoint.ts +4 -2
- package/src/styles/ods-interaction-states.css +68 -0
- package/src/types/navigation.ts +140 -0
- package/dist/chunk-C7GIHB3V.cjs +0 -59
- package/dist/dots-loader-icon-RBLX46X7.cjs +0 -7
- package/dist/{chunk-ZOZR3QI2.cjs → chunk-46547WQW.cjs} +0 -0
- package/dist/{video-file-player-IAMWBKEQ.cjs → video-file-player-IHO66P2Q.cjs} +1 -1
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import type { MouseEvent } from 'react';
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import type { CSSProperties, MouseEvent, ReactNode } from 'react';
|
|
5
5
|
import { useIsHydrated } from '../../hooks/ui/use-is-hydrated';
|
|
6
6
|
import { useIsomorphicLayoutEffect } from '../../hooks/ui/use-isomorphic-layout-effect';
|
|
7
7
|
import { useLocalStorage } from '../../hooks/ui/use-local-storage';
|
|
8
8
|
import { useLgUp, useMdUp } from '../../hooks/ui/use-media-query';
|
|
9
9
|
import type { NavigationSidebarConfig, NavigationSidebarItem } from '../../types/navigation';
|
|
10
10
|
import { cn } from '../../utils';
|
|
11
|
+
import { NAVIGATION_SIDEBAR_ATTRIBUTE } from './app-layout-context';
|
|
12
|
+
import {
|
|
13
|
+
NavigationSidebarGroupedEntries,
|
|
14
|
+
NavigationSidebarGroupedSkeleton,
|
|
15
|
+
useOpenNavigationGroup,
|
|
16
|
+
} from './navigation-sidebar-grouped';
|
|
11
17
|
import { NavigationSidebarHeader } from './navigation-sidebar-header';
|
|
12
18
|
import { NavigationSidebarItemButton } from './navigation-sidebar-item';
|
|
19
|
+
import { resolveNavigationActive } from './navigation-sidebar-match';
|
|
20
|
+
import { hasNavigationSidebarSlot, renderNavigationSidebarSlot } from './navigation-sidebar-slot';
|
|
13
21
|
import { NavigationSidebarToggle } from './navigation-sidebar-toggle';
|
|
14
22
|
|
|
15
23
|
const MINIMIZED_WIDTH = 56; // 3.5rem = 56px
|
|
16
|
-
const EXPANDED_WIDTH = 224; // 14rem = 224px
|
|
24
|
+
const EXPANDED_WIDTH = 224; // 14rem = 224px — the default; a grouped config may set its own
|
|
25
|
+
/** The narrowest custom `expandedWidth`: the rows read 140px and up as expanded. */
|
|
26
|
+
const MIN_CUSTOM_EXPANDED_WIDTH = 141;
|
|
17
27
|
const STORAGE_KEY = 'of.navigationSidebar.minimized';
|
|
18
28
|
|
|
19
29
|
/**
|
|
@@ -35,6 +45,16 @@ const STORAGE_KEY = 'of.navigationSidebar.minimized';
|
|
|
35
45
|
*/
|
|
36
46
|
export const NAVIGATION_SIDEBAR_WIDTH_VAR = '--of-navigation-sidebar-width';
|
|
37
47
|
|
|
48
|
+
/**
|
|
49
|
+
* A grouped config's own `expandedWidth`, as an inline custom property on the
|
|
50
|
+
* sidebar and its tablet push slot. Unlike the width above it is a prop, the
|
|
51
|
+
* same on the server and the client, so it can sit in the markup: the tablet
|
|
52
|
+
* overlay, the push slot and the desktop fallback read it on the first paint.
|
|
53
|
+
* Set only when the config gives a width, so a config without one renders the
|
|
54
|
+
* literal classes it always did.
|
|
55
|
+
*/
|
|
56
|
+
const EXPANDED_WIDTH_VAR = '--of-navigation-sidebar-expanded-width';
|
|
57
|
+
|
|
38
58
|
/**
|
|
39
59
|
* The rail as a query container, so the parts of the sidebar that follow its
|
|
40
60
|
* collapsed state can read that state off the rail's own width — currently the
|
|
@@ -51,7 +71,8 @@ export const NAVIGATION_SIDEBAR_WIDTH_VAR = '--of-navigation-sidebar-width';
|
|
|
51
71
|
* backwards under it.
|
|
52
72
|
*
|
|
53
73
|
* Queried as `@[140px]/of-nav-sidebar:` — 140px is the midpoint between the 56px
|
|
54
|
-
* rail and the 224px expanded sidebar, so the width only crosses it mid-toggle
|
|
74
|
+
* rail and the 224px expanded sidebar, so the width only crosses it mid-toggle
|
|
75
|
+
* (a custom `expandedWidth` is kept above it).
|
|
55
76
|
* Container queries are min-width, so a follower styles its COLLAPSED look as the
|
|
56
77
|
* default and lets the query take it back. Written out literally at each use
|
|
57
78
|
* rather than interpolated from a constant: Tailwind scans source text, and a
|
|
@@ -84,17 +105,26 @@ const SIDEBAR_CONTAINER = '@container/of-nav-sidebar';
|
|
|
84
105
|
* `EXPANDED_WIDTH`, as is the `14rem` fallback below. Keep them in step; a class
|
|
85
106
|
* string cannot interpolate a constant.
|
|
86
107
|
*/
|
|
87
|
-
const
|
|
108
|
+
const SIDEBAR_POSITION_CLASSES = [
|
|
88
109
|
// Tablet: float over the content, anchored to the layout row (`absolute`
|
|
89
110
|
// within AppLayout's `relative` row) — NOT the viewport — so an optional
|
|
90
111
|
// `topBar` above the row is not overlapped. With no topBar the row spans the
|
|
91
112
|
// full viewport, so this is visually identical to a viewport-fixed sidebar.
|
|
92
113
|
'md:absolute md:inset-y-0 md:left-0 md:z-[45]',
|
|
93
|
-
// Desktop: back in the flex flow, width from the persisted preference.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
114
|
+
// Desktop: back in the flex flow, width from the persisted preference.
|
|
115
|
+
'lg:relative lg:inset-auto lg:z-auto lg:h-full',
|
|
116
|
+
];
|
|
117
|
+
const SIDEBAR_GEOMETRY_CLASSES = {
|
|
118
|
+
// The fallback IS the default, so the property needs no global declaration
|
|
119
|
+
// and an unseeded consumer gets the full sidebar rather than a rail with no
|
|
120
|
+
// labels.
|
|
121
|
+
default: [...SIDEBAR_POSITION_CLASSES, 'lg:w-[var(--of-navigation-sidebar-width,14rem)]'].join(' '),
|
|
122
|
+
// With a config width the fallback is that width (`EXPANDED_WIDTH_VAR`).
|
|
123
|
+
custom: [
|
|
124
|
+
...SIDEBAR_POSITION_CLASSES,
|
|
125
|
+
'lg:w-[var(--of-navigation-sidebar-width,var(--of-navigation-sidebar-expanded-width))]',
|
|
126
|
+
].join(' '),
|
|
127
|
+
} as const;
|
|
98
128
|
|
|
99
129
|
/**
|
|
100
130
|
* The tablet width, as ONE `md:` class rather than a rail plus an override.
|
|
@@ -110,10 +140,14 @@ const SIDEBAR_GEOMETRY_CLASSES = [
|
|
|
110
140
|
* `lg:` still governs desktop either way: it is emitted after `md:`, so an
|
|
111
141
|
* overlay left open while the window widens does not leak into the desktop width.
|
|
112
142
|
*/
|
|
113
|
-
const SIDEBAR_TABLET_WIDTH = {
|
|
143
|
+
const SIDEBAR_TABLET_WIDTH = {
|
|
144
|
+
rail: 'md:w-14',
|
|
145
|
+
overlay: 'md:w-56',
|
|
146
|
+
customOverlay: 'md:w-[var(--of-navigation-sidebar-expanded-width)]',
|
|
147
|
+
} as const;
|
|
114
148
|
|
|
115
149
|
/** A click the browser will resolve itself — new tab, new window, middle button. */
|
|
116
|
-
const isModifiedClick = (event?: MouseEvent): boolean =>
|
|
150
|
+
export const isModifiedClick = (event?: MouseEvent): boolean =>
|
|
117
151
|
!!event && (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0);
|
|
118
152
|
|
|
119
153
|
export interface NavigationSidebarProps {
|
|
@@ -130,9 +164,23 @@ export interface NavigationSidebarProps {
|
|
|
130
164
|
* false (overlay).
|
|
131
165
|
*/
|
|
132
166
|
pushOnTablet?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Animate the width where it moves the content (the desktop rail, the tablet
|
|
169
|
+
* slot with `pushOnTablet`). Default true. `AppLayout` turns it off while the
|
|
170
|
+
* page column is a size container (a side panel or a composer dock): each frame
|
|
171
|
+
* of the transition then re-evaluated the page's `content-*` container queries,
|
|
172
|
+
* ~25 ms of layout per frame on a large page in WebKit, so there the width snaps.
|
|
173
|
+
* The tablet overlay still slides: it floats over the content.
|
|
174
|
+
*/
|
|
175
|
+
animateWidth?: boolean;
|
|
133
176
|
}
|
|
134
177
|
|
|
135
|
-
export function NavigationSidebar({
|
|
178
|
+
export function NavigationSidebar({
|
|
179
|
+
config,
|
|
180
|
+
disabled = false,
|
|
181
|
+
pushOnTablet = false,
|
|
182
|
+
animateWidth = true,
|
|
183
|
+
}: NavigationSidebarProps) {
|
|
136
184
|
const isMdUp = useMdUp() ?? false;
|
|
137
185
|
const isLgUp = useLgUp() ?? false;
|
|
138
186
|
|
|
@@ -143,9 +191,36 @@ export function NavigationSidebar({ config, disabled = false, pushOnTablet = fal
|
|
|
143
191
|
// Desktop preference persists across sessions. Tablet state is in-memory
|
|
144
192
|
// only so entering tablet always starts minimized without clobbering the
|
|
145
193
|
// user's desktop choice.
|
|
146
|
-
const [
|
|
194
|
+
const [storedMinimized, setStoredMinimized] = useLocalStorage<boolean>(STORAGE_KEY, config.minimized ?? false);
|
|
147
195
|
const [tabletMinimized, setTabletMinimized] = useState(true);
|
|
148
196
|
|
|
197
|
+
// Controlled collapse (`config.collapsed`) replaces the persisted desktop
|
|
198
|
+
// preference — the store is still read (hooks run unconditionally) but never
|
|
199
|
+
// consulted or written. The tablet overlay stays this component's own.
|
|
200
|
+
const isControlled = config.collapsed !== undefined;
|
|
201
|
+
const desktopMinimized = isControlled ? (config.collapsed ?? false) : storedMinimized;
|
|
202
|
+
|
|
203
|
+
// A CHANGE of the controlled value is also a command for the tablet overlay:
|
|
204
|
+
// `false` opens it, `true` closes it — so a host can reveal the sidebar from
|
|
205
|
+
// anywhere (⌘K) at every width without the overlay ever writing back into the
|
|
206
|
+
// host's desktop preference. Adjusted while rendering, like the reset below.
|
|
207
|
+
const [collapsedSeen, setCollapsedSeen] = useState(config.collapsed);
|
|
208
|
+
if (collapsedSeen !== config.collapsed) {
|
|
209
|
+
setCollapsedSeen(config.collapsed);
|
|
210
|
+
if (isTablet && config.collapsed !== undefined) setTabletMinimized(config.collapsed);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// `revealSignal`: each change shows the expanded sidebar. The tablet overlay
|
|
214
|
+
// is this component's own state, so it opens while rendering, like the
|
|
215
|
+
// `collapsed` command above — and unlike it, also when `collapsed` is already
|
|
216
|
+
// `false`. Desktop is the host's preference (or the stored one): that is
|
|
217
|
+
// written from the effect below, never during render.
|
|
218
|
+
const [revealSeen, setRevealSeen] = useState(config.revealSignal);
|
|
219
|
+
if (revealSeen !== config.revealSignal) {
|
|
220
|
+
setRevealSeen(config.revealSignal);
|
|
221
|
+
if (isTablet && config.revealSignal !== undefined) setTabletMinimized(false);
|
|
222
|
+
}
|
|
223
|
+
|
|
149
224
|
// Entering tablet always starts minimized. Adjusted while rendering — React's
|
|
150
225
|
// documented pattern for a reset driven by a value the render already has —
|
|
151
226
|
// rather than from an effect, which committed the crossover frame with the
|
|
@@ -170,11 +245,34 @@ export function NavigationSidebar({ config, disabled = false, pushOnTablet = fal
|
|
|
170
245
|
// were never visible.
|
|
171
246
|
const hydrated = useIsHydrated();
|
|
172
247
|
|
|
173
|
-
|
|
248
|
+
// A controlled value is the host's, identical on both sides of hydration, so it
|
|
249
|
+
// needs no gate; the persisted one does.
|
|
250
|
+
const serverMinimized = isControlled ? desktopMinimized : (config.minimized ?? false);
|
|
251
|
+
const minimized = hydrated ? (isTablet ? tabletMinimized : desktopMinimized) : serverMinimized;
|
|
174
252
|
|
|
175
253
|
// Enable transitions only after the correct width is painted
|
|
176
254
|
const [transitionsEnabled, setTransitionsEnabled] = useState(false);
|
|
177
255
|
|
|
256
|
+
// A grouped config's own expanded width (`expandedWidth`); `null` = the
|
|
257
|
+
// default 224px through the literal classes, exactly as before.
|
|
258
|
+
const customExpandedWidth =
|
|
259
|
+
config.variant === 'grouped' && config.expandedWidth !== undefined
|
|
260
|
+
? Math.max(config.expandedWidth, MIN_CUSTOM_EXPANDED_WIDTH)
|
|
261
|
+
: null;
|
|
262
|
+
const expandedWidth = customExpandedWidth ?? EXPANDED_WIDTH;
|
|
263
|
+
const expandedWidthStyle =
|
|
264
|
+
customExpandedWidth === null ? undefined : ({ [EXPANDED_WIDTH_VAR]: `${customExpandedWidth}px` } as CSSProperties);
|
|
265
|
+
|
|
266
|
+
// A new expanded width (the host swapped configs — e.g. a placeholder for
|
|
267
|
+
// the grouped tree) is a different sidebar, not a toggle: it snaps instead of
|
|
268
|
+
// animating. The transition is dropped in the same commit that moves the
|
|
269
|
+
// width and comes back a frame later (the effect below).
|
|
270
|
+
const [widthFor, setWidthFor] = useState(expandedWidth);
|
|
271
|
+
if (widthFor !== expandedWidth) {
|
|
272
|
+
setWidthFor(expandedWidth);
|
|
273
|
+
setTransitionsEnabled(false);
|
|
274
|
+
}
|
|
275
|
+
|
|
178
276
|
const isOverlayOpen = isTablet && !minimized;
|
|
179
277
|
|
|
180
278
|
const showLabel = !minimized;
|
|
@@ -183,15 +281,29 @@ export function NavigationSidebar({ config, disabled = false, pushOnTablet = fal
|
|
|
183
281
|
if (isTablet) {
|
|
184
282
|
setTabletMinimized(prev => !prev);
|
|
185
283
|
} else {
|
|
186
|
-
|
|
284
|
+
if (!isControlled) setStoredMinimized(prev => !prev);
|
|
285
|
+
config.onCollapsedChange?.(!desktopMinimized);
|
|
187
286
|
}
|
|
188
287
|
config.onToggleMinimized?.();
|
|
189
|
-
}, [isTablet,
|
|
288
|
+
}, [isTablet, isControlled, setStoredMinimized, desktopMinimized, config]);
|
|
190
289
|
|
|
191
290
|
const closeOverlay = useCallback(() => {
|
|
192
291
|
setTabletMinimized(true);
|
|
193
292
|
}, []);
|
|
194
293
|
|
|
294
|
+
// The desktop half of `revealSignal`: expand a collapsed sidebar — through
|
|
295
|
+
// the host when it owns the value, through the stored preference otherwise.
|
|
296
|
+
// Only a CHANGE counts; the value the sidebar mounted with is no command.
|
|
297
|
+
const revealHandledRef = useRef(config.revealSignal);
|
|
298
|
+
const { revealSignal, onCollapsedChange } = config;
|
|
299
|
+
useEffect(() => {
|
|
300
|
+
if (revealHandledRef.current === revealSignal) return;
|
|
301
|
+
revealHandledRef.current = revealSignal;
|
|
302
|
+
if (revealSignal === undefined || !isLgUp || !desktopMinimized) return;
|
|
303
|
+
if (!isControlled) setStoredMinimized(false);
|
|
304
|
+
onCollapsedChange?.(false);
|
|
305
|
+
}, [revealSignal, isLgUp, desktopMinimized, isControlled, setStoredMinimized, onCollapsedChange]);
|
|
306
|
+
|
|
195
307
|
// Dismiss the tablet overlay with Escape so it behaves like a transient panel
|
|
196
308
|
useEffect(() => {
|
|
197
309
|
if (!isOverlayOpen) return undefined;
|
|
@@ -213,7 +325,16 @@ export function NavigationSidebar({ config, disabled = false, pushOnTablet = fal
|
|
|
213
325
|
// a section still loading and announce it as the current page to a screen
|
|
214
326
|
// reader — a statement that is simply false until the router says otherwise.
|
|
215
327
|
const [pendingItemId, setPendingItemId] = useState<string | null>(null);
|
|
216
|
-
const
|
|
328
|
+
const grouped = config.variant === 'grouped';
|
|
329
|
+
// ONE active entry for the whole tree. Flat: `items.find(isActive)`, exactly
|
|
330
|
+
// as before, unless the host also hands over `currentPath` for entries that
|
|
331
|
+
// leave `isActive` out. Grouped: resolved through the children too, so the
|
|
332
|
+
// committed id — and the pending hint cleared by it — can be a child's.
|
|
333
|
+
const { activeId: committedActiveId, groupId: activeGroupId } = useMemo(
|
|
334
|
+
() => resolveNavigationActive(config.items, { currentPath: config.currentPath, includeChildren: grouped }),
|
|
335
|
+
[config.items, config.currentPath, grouped],
|
|
336
|
+
);
|
|
337
|
+
const [openGroupId, setOpenGroupId] = useOpenNavigationGroup(activeGroupId);
|
|
217
338
|
|
|
218
339
|
// Any committed change clears it — including one that landed somewhere else
|
|
219
340
|
// entirely (a redirect, a link elsewhere on the page). A navigation that never
|
|
@@ -270,6 +391,13 @@ export function NavigationSidebar({ config, disabled = false, pushOnTablet = fal
|
|
|
270
391
|
[config, isTablet, committedActiveId],
|
|
271
392
|
);
|
|
272
393
|
|
|
394
|
+
// A group parent (grouped variant) only opens and folds; it goes nowhere. The
|
|
395
|
+
// one-open rule closes whichever group was open.
|
|
396
|
+
const handleGroupClick = useCallback(
|
|
397
|
+
(item: NavigationSidebarItem) => setOpenGroupId(current => (current === item.id ? null : item.id)),
|
|
398
|
+
[setOpenGroupId],
|
|
399
|
+
);
|
|
400
|
+
|
|
273
401
|
const { primaryItems, secondaryItems } = useMemo(
|
|
274
402
|
() => ({
|
|
275
403
|
primaryItems: config.items.filter(item => item.section !== 'secondary'),
|
|
@@ -293,15 +421,35 @@ export function NavigationSidebar({ config, disabled = false, pushOnTablet = fal
|
|
|
293
421
|
};
|
|
294
422
|
}, [config.loading, config.loadingRows?.primary, config.loadingRows?.secondary]);
|
|
295
423
|
|
|
296
|
-
|
|
424
|
+
// The grouped rows glide and fade with the width, on the same curve.
|
|
425
|
+
const widthTransition = cn(
|
|
426
|
+
'transition-[width] duration-300',
|
|
427
|
+
grouped && '[transition-timing-function:cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none',
|
|
428
|
+
);
|
|
429
|
+
|
|
430
|
+
const sidebarWidth = useMemo(
|
|
431
|
+
() => (minimized ? `${MINIMIZED_WIDTH}px` : `${expandedWidth}px`),
|
|
432
|
+
[minimized, expandedWidth],
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
// Shown from 140px, fading in as it arrives (the rows' labels fade the same
|
|
436
|
+
// way, and a node section has no width to fade in below that).
|
|
437
|
+
const sectionRailHidden =
|
|
438
|
+
typeof config.sectionSlot !== 'function' &&
|
|
439
|
+
'hidden @[140px]/of-nav-sidebar:flex animate-in fade-in duration-300 motion-reduce:animate-none';
|
|
297
440
|
|
|
298
441
|
// Published to CSS from an EFFECT, never from render. Before hydration the
|
|
299
442
|
// width belongs to whatever seeded `NAVIGATION_SIDEBAR_WIDTH_VAR` in `<head>`
|
|
300
443
|
// — put it in the markup instead and it becomes part of what React hydrates,
|
|
301
444
|
// which is precisely what cannot agree across the server boundary. Afterwards
|
|
302
445
|
// this is what a toggle moves.
|
|
446
|
+
//
|
|
447
|
+
// On the rail, not on `<html>` where the seed sits: the rail is its only reader,
|
|
448
|
+
// and an inherited custom property on the root made WebKit restyle the whole
|
|
449
|
+
// document on every toggle. Its own value overrides the inherited seed.
|
|
450
|
+
const asideRef = useRef<HTMLElement>(null);
|
|
303
451
|
useIsomorphicLayoutEffect(() => {
|
|
304
|
-
|
|
452
|
+
asideRef.current?.style.setProperty(NAVIGATION_SIDEBAR_WIDTH_VAR, sidebarWidth);
|
|
305
453
|
}, [sidebarWidth]);
|
|
306
454
|
|
|
307
455
|
// There used to be an `isHydrated` gate here — `isMdUp !== undefined && ...`
|
|
@@ -319,6 +467,45 @@ export function NavigationSidebar({ config, disabled = false, pushOnTablet = fal
|
|
|
319
467
|
return () => cancelAnimationFrame(id);
|
|
320
468
|
}, [transitionsEnabled]);
|
|
321
469
|
|
|
470
|
+
// One `<nav>` block's rows: placeholders while loading, else the entries in
|
|
471
|
+
// the variant's geometry.
|
|
472
|
+
const renderEntries = (placeholders: string[] | null, items: NavigationSidebarItem[]): ReactNode => {
|
|
473
|
+
if (placeholders) {
|
|
474
|
+
return placeholders.map(key =>
|
|
475
|
+
grouped ? (
|
|
476
|
+
<NavigationSidebarGroupedSkeleton key={key} />
|
|
477
|
+
) : (
|
|
478
|
+
<NavigationSidebarItemButton key={key} loading showLabel={showLabel} />
|
|
479
|
+
),
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
if (grouped) {
|
|
483
|
+
return (
|
|
484
|
+
<NavigationSidebarGroupedEntries
|
|
485
|
+
items={items}
|
|
486
|
+
activeId={committedActiveId}
|
|
487
|
+
pendingId={pendingItemId}
|
|
488
|
+
openGroupId={openGroupId}
|
|
489
|
+
showLabel={showLabel}
|
|
490
|
+
disabled={disabled}
|
|
491
|
+
onItemClick={handleItemClick}
|
|
492
|
+
onGroupClick={handleGroupClick}
|
|
493
|
+
/>
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
return items.map(item => (
|
|
497
|
+
<NavigationSidebarItemButton
|
|
498
|
+
key={item.id}
|
|
499
|
+
item={item}
|
|
500
|
+
isActive={item.id === committedActiveId}
|
|
501
|
+
isPending={item.id === pendingItemId}
|
|
502
|
+
showLabel={showLabel}
|
|
503
|
+
disabled={disabled}
|
|
504
|
+
onClick={handleItemClick}
|
|
505
|
+
/>
|
|
506
|
+
));
|
|
507
|
+
};
|
|
508
|
+
|
|
322
509
|
return (
|
|
323
510
|
<>
|
|
324
511
|
{/* Backdrop scrim — only visible on tablet while the overlay is open */}
|
|
@@ -342,9 +529,14 @@ export function NavigationSidebar({ config, disabled = false, pushOnTablet = fal
|
|
|
342
529
|
<div
|
|
343
530
|
className={cn(
|
|
344
531
|
'hidden h-full flex-shrink-0 md:block lg:hidden',
|
|
345
|
-
isOverlayOpen && pushOnTablet
|
|
346
|
-
|
|
532
|
+
isOverlayOpen && pushOnTablet
|
|
533
|
+
? customExpandedWidth === null
|
|
534
|
+
? 'w-56'
|
|
535
|
+
: 'w-[var(--of-navigation-sidebar-expanded-width)]'
|
|
536
|
+
: 'w-14',
|
|
537
|
+
transitionsEnabled && animateWidth && widthTransition,
|
|
347
538
|
)}
|
|
539
|
+
style={expandedWidthStyle}
|
|
348
540
|
aria-hidden="true"
|
|
349
541
|
/>
|
|
350
542
|
|
|
@@ -353,68 +545,93 @@ export function NavigationSidebar({ config, disabled = false, pushOnTablet = fal
|
|
|
353
545
|
SIDEBAR_CONTAINER,
|
|
354
546
|
'hidden flex-shrink-0 flex-col md:flex',
|
|
355
547
|
'border-r border-ods-border bg-ods-card',
|
|
356
|
-
SIDEBAR_GEOMETRY_CLASSES,
|
|
548
|
+
customExpandedWidth === null ? SIDEBAR_GEOMETRY_CLASSES.default : SIDEBAR_GEOMETRY_CLASSES.custom,
|
|
357
549
|
// The one width a viewport cannot imply: an overlay the user opened on
|
|
358
550
|
// tablet. Only ever true after a click, so the first paint always gets
|
|
359
551
|
// the rail.
|
|
360
|
-
isOverlayOpen
|
|
361
|
-
|
|
552
|
+
!isOverlayOpen
|
|
553
|
+
? SIDEBAR_TABLET_WIDTH.rail
|
|
554
|
+
: customExpandedWidth === null
|
|
555
|
+
? SIDEBAR_TABLET_WIDTH.overlay
|
|
556
|
+
: SIDEBAR_TABLET_WIDTH.customOverlay,
|
|
557
|
+
transitionsEnabled && widthTransition,
|
|
558
|
+
// Snaps where its width moves the content: the desktop rail, and the
|
|
559
|
+
// tablet overlay too when it pushes (its slot above snaps with it).
|
|
560
|
+
!animateWidth && (pushOnTablet ? 'transition-none' : 'lg:transition-none'),
|
|
362
561
|
config.className,
|
|
363
562
|
)}
|
|
563
|
+
ref={asideRef}
|
|
564
|
+
style={expandedWidthStyle}
|
|
364
565
|
aria-label="Main navigation sidebar"
|
|
566
|
+
{...{ [NAVIGATION_SIDEBAR_ATTRIBUTE]: '' }}
|
|
365
567
|
>
|
|
366
568
|
<NavigationSidebarHeader minimized={minimized} />
|
|
367
569
|
|
|
368
|
-
<div
|
|
369
|
-
{
|
|
370
|
-
|
|
371
|
-
|
|
570
|
+
<div
|
|
571
|
+
className={cn(
|
|
572
|
+
'flex flex-1 flex-col justify-between overflow-y-auto',
|
|
573
|
+
// Grouped: one inset all round the rows (8px), so the first row sits as far under the
|
|
574
|
+
// header's border as the rows sit from the sidebar's sides.
|
|
575
|
+
grouped ? 'p-[var(--spacing-system-xsf)]' : 'py-4',
|
|
576
|
+
)}
|
|
577
|
+
>
|
|
578
|
+
{/* The top slot, the primary nav and the section are ONE
|
|
579
|
+
`justify-between` child. As siblings the spare space would open
|
|
580
|
+
between them instead of above the secondary nav. */}
|
|
372
581
|
<div className="flex flex-col">
|
|
373
582
|
{config.topSlot?.({ minimized })}
|
|
374
583
|
|
|
375
584
|
{/* `aria-busy` on the nav, not the rows: the region is what is loading,
|
|
376
585
|
and each placeholder row is already `aria-hidden`. */}
|
|
377
|
-
<nav
|
|
378
|
-
{
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
<NavigationSidebarItemButton
|
|
384
|
-
key={item.id}
|
|
385
|
-
item={item}
|
|
386
|
-
isActive={item.id === committedActiveId}
|
|
387
|
-
isPending={item.id === pendingItemId}
|
|
388
|
-
showLabel={showLabel}
|
|
389
|
-
disabled={disabled}
|
|
390
|
-
onClick={handleItemClick}
|
|
391
|
-
/>
|
|
392
|
-
))}
|
|
586
|
+
<nav
|
|
587
|
+
className={cn('flex flex-col', grouped && 'gap-[var(--spacing-system-xxs)]')}
|
|
588
|
+
aria-label="Primary navigation"
|
|
589
|
+
aria-busy={!!loadingRows}
|
|
590
|
+
>
|
|
591
|
+
{renderEntries(loadingRows?.primary ?? null, primaryItems)}
|
|
393
592
|
</nav>
|
|
593
|
+
|
|
594
|
+
{/* The host's section (the chat history), in the flow at its full
|
|
595
|
+
height: the body scrolls the tree and the section as one, so
|
|
596
|
+
there is one scroll to follow and none to get caught in. A node
|
|
597
|
+
has no use for a 56px rail and is hidden there by the rail's
|
|
598
|
+
width (mounted, so its search survives a toggle); a function
|
|
599
|
+
decides for itself. */}
|
|
600
|
+
{hasNavigationSidebarSlot(config.sectionSlot) && (
|
|
601
|
+
// A divider between the tree and the section, as under the top slot's rows.
|
|
602
|
+
<div
|
|
603
|
+
className={cn(
|
|
604
|
+
'mt-[var(--spacing-system-xsf)] flex flex-col border-t border-ods-border pt-[var(--spacing-system-sf)]',
|
|
605
|
+
sectionRailHidden,
|
|
606
|
+
)}
|
|
607
|
+
>
|
|
608
|
+
{renderNavigationSidebarSlot(config.sectionSlot, { minimized, inDrawer: false })}
|
|
609
|
+
</div>
|
|
610
|
+
)}
|
|
394
611
|
</div>
|
|
395
612
|
|
|
396
613
|
{(loadingRows ? loadingRows.secondary.length > 0 : secondaryItems.length > 0) && (
|
|
397
614
|
<nav className="flex flex-col" aria-label="Secondary navigation" aria-busy={!!loadingRows}>
|
|
398
|
-
{loadingRows
|
|
399
|
-
? loadingRows.secondary.map(key => (
|
|
400
|
-
<NavigationSidebarItemButton key={key} loading showLabel={showLabel} />
|
|
401
|
-
))
|
|
402
|
-
: secondaryItems.map(item => (
|
|
403
|
-
<NavigationSidebarItemButton
|
|
404
|
-
key={item.id}
|
|
405
|
-
item={item}
|
|
406
|
-
isActive={item.id === committedActiveId}
|
|
407
|
-
isPending={item.id === pendingItemId}
|
|
408
|
-
showLabel={showLabel}
|
|
409
|
-
disabled={disabled}
|
|
410
|
-
onClick={handleItemClick}
|
|
411
|
-
/>
|
|
412
|
-
))}
|
|
615
|
+
{renderEntries(loadingRows?.secondary ?? null, secondaryItems)}
|
|
413
616
|
</nav>
|
|
414
617
|
)}
|
|
415
618
|
</div>
|
|
416
619
|
|
|
417
|
-
|
|
620
|
+
{/* The host's footer (the account row), pinned above the toggle and inset
|
|
621
|
+
like the rows. Rendered in both widths: a function adapts to
|
|
622
|
+
`minimized`, a node is clipped to the rail. */}
|
|
623
|
+
{hasNavigationSidebarSlot(config.footerSlot) && (
|
|
624
|
+
<div className="shrink-0 overflow-hidden border-t border-ods-border px-[var(--spacing-system-xsf)] py-[var(--spacing-system-xxs)]">
|
|
625
|
+
{renderNavigationSidebarSlot(config.footerSlot, { minimized, inDrawer: false })}
|
|
626
|
+
</div>
|
|
627
|
+
)}
|
|
628
|
+
|
|
629
|
+
<NavigationSidebarToggle
|
|
630
|
+
minimized={minimized}
|
|
631
|
+
showLabel={showLabel}
|
|
632
|
+
onToggle={handleToggle}
|
|
633
|
+
compact={grouped}
|
|
634
|
+
/>
|
|
418
635
|
</aside>
|
|
419
636
|
</>
|
|
420
637
|
);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from '../../utils/cn';
|
|
4
|
+
import { useOptionalNotifications } from '../features/notifications/notifications-context';
|
|
5
|
+
import { XmarkIcon } from '../icons-v2-generated';
|
|
6
|
+
import { BellIcon } from '../icons-v2-generated/interface/bell-icon';
|
|
7
|
+
import { HeaderButton } from './header-button';
|
|
8
|
+
|
|
9
|
+
export interface NotificationsBellButtonProps {
|
|
10
|
+
/** Unread count to show the dot for when no `NotificationsProvider` is mounted. */
|
|
11
|
+
fallbackUnreadCount?: number;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* - `cell` (default): a cell of the top bar, as `AppHeader` draws it.
|
|
15
|
+
* - `floating`: a 36px bordered square for a place with no bar around it —
|
|
16
|
+
* `AppLayout`'s `contentCorner`.
|
|
17
|
+
* - `compact`: `HeaderButton`'s compact cell (20px glyph, pressed while the
|
|
18
|
+
* drawer is open) for the navigation sidebar's foot
|
|
19
|
+
* (beside the account row, `NavigationSidebarConfig.footerSlot`).
|
|
20
|
+
*/
|
|
21
|
+
variant?: 'cell' | 'floating' | 'compact';
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The notifications bell: toggles the `NotificationDrawer` through the
|
|
27
|
+
* `NotificationsProvider` it reads, shows the shared unread dot, and turns into
|
|
28
|
+
* a close "X" while the drawer is open. Disabled with no provider above it.
|
|
29
|
+
*
|
|
30
|
+
* `AppHeader` renders it under `showNotifications`. Without a header (the
|
|
31
|
+
* `AppLayout` `desktopHeader={false}` shell), render it in `contentCorner`
|
|
32
|
+
* (`floating`) or at the sidebar's foot (`compact`); the drawer
|
|
33
|
+
* `AppLayout` mounts follows the same provider either way.
|
|
34
|
+
*/
|
|
35
|
+
export function NotificationsBellButton({
|
|
36
|
+
fallbackUnreadCount = 0,
|
|
37
|
+
disabled = false,
|
|
38
|
+
variant = 'cell',
|
|
39
|
+
className,
|
|
40
|
+
}: NotificationsBellButtonProps) {
|
|
41
|
+
const ctx = useOptionalNotifications();
|
|
42
|
+
const hasUnread = (ctx?.unreadCount ?? fallbackUnreadCount) > 0;
|
|
43
|
+
const isActive = ctx?.isOpen ?? false;
|
|
44
|
+
const onClick = ctx?.toggle;
|
|
45
|
+
const floating = variant === 'floating';
|
|
46
|
+
const iconClassName = variant === 'cell' ? 'h-6 w-6' : 'h-5 w-5';
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<HeaderButton
|
|
50
|
+
icon={isActive ? <XmarkIcon className={iconClassName} /> : <BellIcon className={iconClassName} />}
|
|
51
|
+
// Shared dot primitive on the cell — same markup every indicator
|
|
52
|
+
// cell renders (see HeaderButton.showUnreadDot / <UnreadDot>).
|
|
53
|
+
showUnreadDot={!isActive && hasUnread}
|
|
54
|
+
aria-label={isActive ? 'Close notifications' : 'Notifications'}
|
|
55
|
+
onClick={onClick}
|
|
56
|
+
isActive={isActive}
|
|
57
|
+
disabled={disabled || !onClick}
|
|
58
|
+
size={variant === 'compact' ? 'compact' : 'cell'}
|
|
59
|
+
className={cn(
|
|
60
|
+
// Overrides the cell's bar-driven `h-full w-[--top-nav-cell]` box.
|
|
61
|
+
floating && 'h-9 w-9 rounded-md border border-ods-border',
|
|
62
|
+
// An opaque face over the page; the cell's own active colour wins while open.
|
|
63
|
+
floating && !isActive && 'bg-ods-card',
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default NotificationsBellButton;
|
|
@@ -46,10 +46,16 @@ export interface TicketAlertsButtonProps {
|
|
|
46
46
|
* drawer also smooth-scrolls the row). */
|
|
47
47
|
href: string;
|
|
48
48
|
disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* - `cell` (default): a cell of the top bar.
|
|
51
|
+
* - `compact`: `HeaderButton`'s compact cell with a 20px glyph and the same count pill,
|
|
52
|
+
* for the navigation sidebar's foot, beside the account row (`footerSlot`).
|
|
53
|
+
*/
|
|
54
|
+
variant?: 'cell' | 'compact';
|
|
49
55
|
className?: string;
|
|
50
56
|
}
|
|
51
57
|
|
|
52
|
-
export function TicketAlertsButton({ href, disabled, className }: TicketAlertsButtonProps) {
|
|
58
|
+
export function TicketAlertsButton({ href, disabled, variant = 'cell', className }: TicketAlertsButtonProps) {
|
|
53
59
|
const live = useOptionalTicketLive();
|
|
54
60
|
const runtime = useChatRuntime();
|
|
55
61
|
// Attention-only: no provider, signed out, or nothing unread → no cell.
|
|
@@ -71,13 +77,14 @@ export function TicketAlertsButton({ href, disabled, className }: TicketAlertsBu
|
|
|
71
77
|
// count pill (sidebar count-pill precedent) and by the cell only
|
|
72
78
|
// existing while updates are unread — never by tinting the glyph.
|
|
73
79
|
<span className="relative inline-flex">
|
|
74
|
-
<LifeBuoyIcon className=
|
|
80
|
+
<LifeBuoyIcon className={variant === 'compact' ? 'h-5 w-5' : 'h-6 w-6'} />
|
|
75
81
|
<UnreadCountBadge count={live.unreadTotal} />
|
|
76
82
|
</span>
|
|
77
83
|
}
|
|
78
84
|
aria-label={`Support tickets — ${live.unreadTotal} unread ${live.unreadTotal === 1 ? 'update' : 'updates'}`}
|
|
79
85
|
onClick={handleClick}
|
|
80
86
|
disabled={disabled}
|
|
87
|
+
size={variant}
|
|
81
88
|
className={cn(className)}
|
|
82
89
|
/>
|
|
83
90
|
);
|