@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
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cloneElement, isValidElement, type MouseEvent, type ReactNode, useId, useState } from 'react';
|
|
4
|
+
import Link from '../../embed-shims/next-link';
|
|
5
|
+
import type { NavigationSidebarItem } from '../../types/navigation';
|
|
6
|
+
import { cn } from '../../utils';
|
|
7
|
+
import { UnifiedSkeleton } from '../loading/unified-skeleton';
|
|
8
|
+
import { NavigationItemBadge } from './navigation-item-badge';
|
|
9
|
+
import { UnreadDot } from './unread-dot';
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* The grouped variant (`NavigationSidebarConfig.variant: 'grouped'`), drawn from
|
|
13
|
+
* the Figma `navigation-sidebar` component set: 44px rows, 20px icons, a group
|
|
14
|
+
* that opens into a bordered card with 16px child icons on a connector line, and
|
|
15
|
+
* an active pill that covers only a child's label.
|
|
16
|
+
*
|
|
17
|
+
* Expanded vs. collapsed is read off the RAIL'S WIDTH (`@[140px]/of-nav-sidebar:`,
|
|
18
|
+
* the container `navigation-sidebar.tsx` declares), not off `minimized`: the
|
|
19
|
+
* labels fade and the inset glides as the width crosses 140px, and a JS flag
|
|
20
|
+
* cannot be right on the first paint (before hydration it can only carry the
|
|
21
|
+
* server's answer). The width can. Collapsed is the default because container
|
|
22
|
+
* queries are min-width; the burger menu declares the same container at its
|
|
23
|
+
* full width, so it always gets the expanded rows.
|
|
24
|
+
*
|
|
25
|
+
* `showLabel` is still taken, for the one thing CSS cannot carry: the rail's
|
|
26
|
+
* `title` tooltip.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
interface IconProps {
|
|
30
|
+
size?: number;
|
|
31
|
+
color?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The host's icon at the row's size, coloured by the row (`currentColor`). */
|
|
35
|
+
function sizedIcon(icon: ReactNode, size: number): ReactNode {
|
|
36
|
+
return isValidElement<IconProps>(icon) ? cloneElement(icon, { size, color: 'currentColor' }) : icon;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function accessibleName(item: NavigationSidebarItem): string {
|
|
40
|
+
return item.badge ? `${item.label} (${item.badge})` : item.label;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Which group is open. One at a time: the group holding the current page,
|
|
45
|
+
* re-derived whenever that changes (a navigation into another group closes this
|
|
46
|
+
* one and opens that one; leaving every group closes them all). Between route
|
|
47
|
+
* changes the user's own folds and opens hold.
|
|
48
|
+
*
|
|
49
|
+
* Adjusted while rendering — React's pattern for a reset driven by a value the
|
|
50
|
+
* render already has — so the commit that lights the new page is the same one
|
|
51
|
+
* that opens its group.
|
|
52
|
+
*/
|
|
53
|
+
export function useOpenNavigationGroup(activeGroupId: string | null) {
|
|
54
|
+
const [openGroupId, setOpenGroupId] = useState(activeGroupId);
|
|
55
|
+
const [openFor, setOpenFor] = useState(activeGroupId);
|
|
56
|
+
if (openFor !== activeGroupId) {
|
|
57
|
+
setOpenFor(activeGroupId);
|
|
58
|
+
setOpenGroupId(activeGroupId);
|
|
59
|
+
}
|
|
60
|
+
return [openGroupId, setOpenGroupId] as const;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The active pill. Figma paints it `yellow sec` #614c12, which has no ODS token;
|
|
65
|
+
* the palette's `accent-secondary` stands in (design: no new colours, palette only).
|
|
66
|
+
*/
|
|
67
|
+
const ACTIVE_PILL = 'bg-ods-accent-secondary text-ods-accent';
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* An open group's parent row, flush inside its card: the card's 6px less its 1px border,
|
|
71
|
+
* so the hover and the focus ring run parallel to the border instead of a rounder curve.
|
|
72
|
+
*/
|
|
73
|
+
const CARD_INNER_RADIUS = 'rounded-[calc(var(--radius)-3px)] after:rounded-[calc(var(--radius)-3px)]';
|
|
74
|
+
|
|
75
|
+
/** The motion curve of the grouped sidebar: quick off the mark, a long soft landing. */
|
|
76
|
+
const EASE = '[transition-timing-function:cubic-bezier(0.2,0,0,1)]';
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The hover wash — the design system's `bg-hover`, a press its `bg-active` — on
|
|
80
|
+
* its own `::after` layer so the active pill never fades (see the hover-layer
|
|
81
|
+
* note in `navigation-sidebar-item.tsx`). Quick to answer the cursor, slower to
|
|
82
|
+
* let it go.
|
|
83
|
+
*/
|
|
84
|
+
const HOVER_LAYER = cn(
|
|
85
|
+
"after:pointer-events-none after:absolute after:inset-0 after:-z-10 after:rounded-md after:content-['']",
|
|
86
|
+
'after:bg-ods-bg-hover after:opacity-0 after:transition-opacity after:duration-200 after:ease-out',
|
|
87
|
+
'hover:after:duration-75 active:after:bg-ods-bg-active',
|
|
88
|
+
'motion-reduce:after:transition-none',
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
/** Keyboard focus, drawn inside the row so the card and the scroller do not clip it. */
|
|
92
|
+
const FOCUS_RING = 'outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ods-focus';
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The 44px row geometry shared by a top-level entry, a group's parent and an
|
|
96
|
+
* action row. The icon never moves while the rail widens or narrows: 8px in at
|
|
97
|
+
* both widths (2px left of the centre of the rail's 40px cell); only the right
|
|
98
|
+
* inset comes and goes. A row that re-centred its icon (`justify-center` in the
|
|
99
|
+
* rail) moved it ~50px in the frame the width crossed 140px, mid-toggle, and one
|
|
100
|
+
* that centred it with a wider inset nudged every icon sideways on each toggle.
|
|
101
|
+
*/
|
|
102
|
+
const ROW_CLASSES = cn(
|
|
103
|
+
'relative isolate flex h-11 w-full items-center overflow-hidden rounded-md text-left',
|
|
104
|
+
'pl-[var(--spacing-system-xsf)] pr-0 @[140px]/of-nav-sidebar:pr-[var(--spacing-system-xsf)]',
|
|
105
|
+
'transition-[padding] duration-300 motion-reduce:transition-none',
|
|
106
|
+
EASE,
|
|
107
|
+
FOCUS_RING,
|
|
108
|
+
HOVER_LAYER,
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The idle icon brightens with its row's hover. Lit icons get no transition, so
|
|
113
|
+
* the accent arrives in the commit that makes the row the page, like the pill.
|
|
114
|
+
*/
|
|
115
|
+
const idleIcon = (group: 'row' | 'child') =>
|
|
116
|
+
cn(
|
|
117
|
+
'text-ods-text-secondary transition-colors duration-150',
|
|
118
|
+
group === 'row' ? 'group-hover/nav-row:text-ods-text-primary' : 'group-hover/nav-child:text-ods-text-primary',
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* What only the expanded sidebar shows (labels, stamps, counts). In the rail it
|
|
123
|
+
* is still there, zero-wide and transparent, so crossing 140px fades it rather
|
|
124
|
+
* than popping it in or out.
|
|
125
|
+
*/
|
|
126
|
+
const EXPANDED_ONLY =
|
|
127
|
+
'opacity-0 transition-opacity duration-150 @[140px]/of-nav-sidebar:opacity-100 motion-reduce:transition-none';
|
|
128
|
+
|
|
129
|
+
interface RowStateProps {
|
|
130
|
+
showLabel: boolean;
|
|
131
|
+
disabled: boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** The count pill: 24px, widening for "99+". */
|
|
135
|
+
function CountPill({ count, className }: { count: number; className?: string }) {
|
|
136
|
+
return (
|
|
137
|
+
<span
|
|
138
|
+
className={cn(
|
|
139
|
+
'flex h-6 min-w-6 shrink-0 items-center justify-center rounded-md bg-ods-accent px-[var(--spacing-system-xxs)]',
|
|
140
|
+
className,
|
|
141
|
+
)}
|
|
142
|
+
>
|
|
143
|
+
<span className="text-ods-text-on-accent text-h5">{count > 99 ? '99+' : count}</span>
|
|
144
|
+
</span>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** The row's end, flush right where every row's count sits. */
|
|
149
|
+
function RowEnd({ count }: { count: number }) {
|
|
150
|
+
return count > 0 ? <CountPill count={count} className="ml-auto" /> : null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function RowLabel({ item }: { item: NavigationSidebarItem }) {
|
|
154
|
+
const unreadCount = item.unreadCount ?? 0;
|
|
155
|
+
return (
|
|
156
|
+
<span
|
|
157
|
+
className={cn(
|
|
158
|
+
'ml-[var(--spacing-system-xsf)] flex min-w-0 flex-1 items-center gap-[var(--spacing-system-xs)] overflow-hidden',
|
|
159
|
+
EXPANDED_ONLY,
|
|
160
|
+
)}
|
|
161
|
+
>
|
|
162
|
+
<span className="min-w-0 truncate text-h4">{item.label}</span>
|
|
163
|
+
{item.badge && <NavigationItemBadge label={item.badge} compact />}
|
|
164
|
+
<RowEnd count={unreadCount} />
|
|
165
|
+
</span>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function RowIcon({ item, size, className }: { item: NavigationSidebarItem; size: 16 | 20; className?: string }) {
|
|
170
|
+
return (
|
|
171
|
+
<span
|
|
172
|
+
className={cn('relative flex shrink-0 items-center justify-center', size === 20 ? 'size-5' : 'size-4', className)}
|
|
173
|
+
>
|
|
174
|
+
{sizedIcon(item.icon, size)}
|
|
175
|
+
{(item.unreadCount ?? 0) > 0 && <UnreadDot size="fixed" className="@[140px]/of-nav-sidebar:hidden" />}
|
|
176
|
+
</span>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** An entry without children: a link (or a button for `onClick` / disabled). */
|
|
181
|
+
function GroupedLeafRow({
|
|
182
|
+
item,
|
|
183
|
+
isActive,
|
|
184
|
+
isPending,
|
|
185
|
+
showLabel,
|
|
186
|
+
disabled,
|
|
187
|
+
onClick,
|
|
188
|
+
}: RowStateProps & {
|
|
189
|
+
item: NavigationSidebarItem;
|
|
190
|
+
isActive: boolean;
|
|
191
|
+
isPending: boolean;
|
|
192
|
+
onClick: (item: NavigationSidebarItem, event?: MouseEvent) => void;
|
|
193
|
+
}) {
|
|
194
|
+
const name = accessibleName(item);
|
|
195
|
+
const lit = isActive && !disabled;
|
|
196
|
+
const className = cn(
|
|
197
|
+
'group/nav-row',
|
|
198
|
+
ROW_CLASSES,
|
|
199
|
+
!disabled && !isActive && 'text-ods-text-primary hover:after:opacity-100',
|
|
200
|
+
!disabled && !isActive && isPending && 'after:opacity-100',
|
|
201
|
+
lit && ACTIVE_PILL,
|
|
202
|
+
disabled && 'cursor-not-allowed text-ods-text-secondary opacity-50',
|
|
203
|
+
);
|
|
204
|
+
const content = (
|
|
205
|
+
<>
|
|
206
|
+
<RowIcon item={item} size={20} className={lit ? 'text-ods-accent' : idleIcon('row')} />
|
|
207
|
+
<RowLabel item={item} />
|
|
208
|
+
</>
|
|
209
|
+
);
|
|
210
|
+
const shared = {
|
|
211
|
+
className,
|
|
212
|
+
title: showLabel ? undefined : name,
|
|
213
|
+
'aria-label': name,
|
|
214
|
+
'aria-current': isActive ? ('page' as const) : undefined,
|
|
215
|
+
};
|
|
216
|
+
if (disabled || !item.path || item.onClick) {
|
|
217
|
+
return (
|
|
218
|
+
<button type="button" onClick={event => onClick(item, event)} disabled={disabled} {...shared}>
|
|
219
|
+
{content}
|
|
220
|
+
</button>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
return (
|
|
224
|
+
<Link href={item.path} onClick={event => onClick(item, event)} {...shared}>
|
|
225
|
+
{content}
|
|
226
|
+
</Link>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* One child of an open group: a 20px column holding the 16px icon between two
|
|
232
|
+
* connector segments, then the label. The active pill covers the label only;
|
|
233
|
+
* in the rail, where there is no label, the active child is its accent icon.
|
|
234
|
+
* The hover wash is the pill's shape, lit by the whole row.
|
|
235
|
+
*/
|
|
236
|
+
function GroupedChildRow({
|
|
237
|
+
item,
|
|
238
|
+
isActive,
|
|
239
|
+
isPending,
|
|
240
|
+
showLabel,
|
|
241
|
+
disabled,
|
|
242
|
+
onClick,
|
|
243
|
+
}: RowStateProps & {
|
|
244
|
+
item: NavigationSidebarItem;
|
|
245
|
+
isActive: boolean;
|
|
246
|
+
isPending: boolean;
|
|
247
|
+
onClick: (item: NavigationSidebarItem, event?: MouseEvent) => void;
|
|
248
|
+
}) {
|
|
249
|
+
const name = accessibleName(item);
|
|
250
|
+
const lit = isActive && !disabled;
|
|
251
|
+
const className = cn(
|
|
252
|
+
// The icon column flush, under the parent's icon at both widths.
|
|
253
|
+
'group/nav-child relative flex h-11 w-full items-stretch gap-[var(--spacing-system-xxs)] rounded-md text-left',
|
|
254
|
+
FOCUS_RING,
|
|
255
|
+
disabled && 'cursor-not-allowed opacity-50',
|
|
256
|
+
);
|
|
257
|
+
const content = (
|
|
258
|
+
<>
|
|
259
|
+
<span className="flex w-5 shrink-0 flex-col items-center" aria-hidden="true">
|
|
260
|
+
<span className="h-2.5 w-px shrink-0 bg-ods-border" />
|
|
261
|
+
<RowIcon
|
|
262
|
+
item={item}
|
|
263
|
+
size={16}
|
|
264
|
+
className={cn('my-[var(--spacing-system-xxs)]', lit ? 'text-ods-accent' : idleIcon('child'))}
|
|
265
|
+
/>
|
|
266
|
+
<span className="h-2.5 w-px shrink-0 bg-ods-border" />
|
|
267
|
+
</span>
|
|
268
|
+
<span
|
|
269
|
+
className={cn(
|
|
270
|
+
'relative isolate flex min-w-0 flex-1 items-center gap-[var(--spacing-system-xs)] overflow-hidden rounded-md px-[var(--spacing-system-xsf)]',
|
|
271
|
+
EXPANDED_ONLY,
|
|
272
|
+
HOVER_LAYER,
|
|
273
|
+
lit && ACTIVE_PILL,
|
|
274
|
+
!lit &&
|
|
275
|
+
(disabled ? 'text-ods-text-secondary' : 'text-ods-text-primary group-hover/nav-child:after:opacity-100'),
|
|
276
|
+
!lit && !disabled && isPending && 'after:opacity-100',
|
|
277
|
+
)}
|
|
278
|
+
>
|
|
279
|
+
<span className="min-w-0 truncate text-h4">{item.label}</span>
|
|
280
|
+
{item.badge && <NavigationItemBadge label={item.badge} compact />}
|
|
281
|
+
<RowEnd count={item.unreadCount ?? 0} />
|
|
282
|
+
</span>
|
|
283
|
+
</>
|
|
284
|
+
);
|
|
285
|
+
const shared = {
|
|
286
|
+
className,
|
|
287
|
+
title: showLabel ? undefined : name,
|
|
288
|
+
'aria-label': name,
|
|
289
|
+
'aria-current': isActive ? ('page' as const) : undefined,
|
|
290
|
+
};
|
|
291
|
+
if (disabled || !item.path || item.onClick) {
|
|
292
|
+
return (
|
|
293
|
+
<button type="button" onClick={event => onClick(item, event)} disabled={disabled} {...shared}>
|
|
294
|
+
{content}
|
|
295
|
+
</button>
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
return (
|
|
299
|
+
<Link href={item.path} onClick={event => onClick(item, event)} {...shared}>
|
|
300
|
+
{content}
|
|
301
|
+
</Link>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* A parent and its card. The parent row stays the wrapper's first child in
|
|
307
|
+
* both states, so opening a group re-styles the button rather than remounting
|
|
308
|
+
* it — keyboard focus stays on the parent the user just toggled.
|
|
309
|
+
*
|
|
310
|
+
* The children stay mounted so the card can open and fold as a motion: the
|
|
311
|
+
* grid row eases between `0fr` and `1fr` (the design system's collapse, see
|
|
312
|
+
* `AnnouncementBar`), the rows fade and settle, the card's border and ground
|
|
313
|
+
* fade in. A folded group is `inert` and, once folded, `invisible`: out of the
|
|
314
|
+
* tab order and the accessibility tree, as an unmounted one was.
|
|
315
|
+
*
|
|
316
|
+
* The border is transparent while folded, and the `-m-px` hands its pixel back,
|
|
317
|
+
* so a folded group's row sits exactly where a leaf row does.
|
|
318
|
+
*/
|
|
319
|
+
function GroupedGroup({
|
|
320
|
+
item,
|
|
321
|
+
isOpen,
|
|
322
|
+
activeId,
|
|
323
|
+
pendingId,
|
|
324
|
+
showLabel,
|
|
325
|
+
disabled,
|
|
326
|
+
onItemClick,
|
|
327
|
+
onGroupClick,
|
|
328
|
+
}: RowStateProps & {
|
|
329
|
+
item: NavigationSidebarItem;
|
|
330
|
+
isOpen: boolean;
|
|
331
|
+
activeId: string | null;
|
|
332
|
+
pendingId: string | null;
|
|
333
|
+
onItemClick: (item: NavigationSidebarItem, event?: MouseEvent) => void;
|
|
334
|
+
onGroupClick: (item: NavigationSidebarItem) => void;
|
|
335
|
+
}) {
|
|
336
|
+
const groupDomId = `${useId()}-group`;
|
|
337
|
+
const name = accessibleName(item);
|
|
338
|
+
const children = item.children ?? [];
|
|
339
|
+
const lit = isOpen && !disabled;
|
|
340
|
+
return (
|
|
341
|
+
<div
|
|
342
|
+
className={cn(
|
|
343
|
+
'-m-px rounded-md border transition-[border-color,background-color] duration-300 motion-reduce:transition-none',
|
|
344
|
+
EASE,
|
|
345
|
+
isOpen ? 'border-ods-border bg-ods-bg' : 'border-transparent',
|
|
346
|
+
)}
|
|
347
|
+
>
|
|
348
|
+
<button
|
|
349
|
+
type="button"
|
|
350
|
+
onClick={() => onGroupClick(item)}
|
|
351
|
+
disabled={disabled}
|
|
352
|
+
aria-expanded={isOpen}
|
|
353
|
+
aria-controls={groupDomId}
|
|
354
|
+
aria-label={name}
|
|
355
|
+
title={showLabel ? undefined : name}
|
|
356
|
+
className={cn(
|
|
357
|
+
'group/nav-row',
|
|
358
|
+
ROW_CLASSES,
|
|
359
|
+
// The open group's parent is accent with no background, whether or
|
|
360
|
+
// not one of its children is the current page.
|
|
361
|
+
!disabled && (isOpen ? 'text-ods-accent' : 'text-ods-text-primary'),
|
|
362
|
+
!disabled && 'hover:after:opacity-100',
|
|
363
|
+
isOpen && CARD_INNER_RADIUS,
|
|
364
|
+
disabled && 'cursor-not-allowed text-ods-text-secondary opacity-50',
|
|
365
|
+
)}
|
|
366
|
+
>
|
|
367
|
+
<RowIcon item={item} size={20} className={lit ? 'text-ods-accent' : idleIcon('row')} />
|
|
368
|
+
<RowLabel item={item} />
|
|
369
|
+
</button>
|
|
370
|
+
<div
|
|
371
|
+
id={groupDomId}
|
|
372
|
+
role="group"
|
|
373
|
+
aria-label={item.label}
|
|
374
|
+
inert={!isOpen}
|
|
375
|
+
className={cn(
|
|
376
|
+
'grid transition-[grid-template-rows,visibility] duration-300 motion-reduce:transition-none',
|
|
377
|
+
EASE,
|
|
378
|
+
isOpen ? 'visible grid-rows-[1fr]' : 'invisible grid-rows-[0fr]',
|
|
379
|
+
)}
|
|
380
|
+
>
|
|
381
|
+
<div className="min-h-0 overflow-hidden">
|
|
382
|
+
<div
|
|
383
|
+
className={cn(
|
|
384
|
+
'flex flex-col px-[var(--spacing-system-xsf)] pb-[var(--spacing-system-xsf)]',
|
|
385
|
+
'transition-[opacity,transform] duration-300 motion-reduce:transition-none',
|
|
386
|
+
EASE,
|
|
387
|
+
isOpen ? 'translate-y-0 opacity-100' : '-translate-y-1 opacity-0',
|
|
388
|
+
)}
|
|
389
|
+
>
|
|
390
|
+
{children.map(child => (
|
|
391
|
+
<GroupedChildRow
|
|
392
|
+
key={child.id}
|
|
393
|
+
item={child}
|
|
394
|
+
isActive={child.id === activeId}
|
|
395
|
+
isPending={child.id === pendingId}
|
|
396
|
+
showLabel={showLabel}
|
|
397
|
+
disabled={disabled}
|
|
398
|
+
onClick={onItemClick}
|
|
399
|
+
/>
|
|
400
|
+
))}
|
|
401
|
+
</div>
|
|
402
|
+
</div>
|
|
403
|
+
</div>
|
|
404
|
+
</div>
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export interface NavigationSidebarGroupedEntriesProps {
|
|
409
|
+
items: readonly NavigationSidebarItem[];
|
|
410
|
+
activeId: string | null;
|
|
411
|
+
pendingId: string | null;
|
|
412
|
+
openGroupId: string | null;
|
|
413
|
+
showLabel: boolean;
|
|
414
|
+
disabled: boolean;
|
|
415
|
+
onItemClick: (item: NavigationSidebarItem, event?: MouseEvent) => void;
|
|
416
|
+
/** A parent row was clicked; the owner applies the open/fold/navigate rule. */
|
|
417
|
+
onGroupClick: (item: NavigationSidebarItem) => void;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/** The entries of one `<nav>` block in the grouped variant (the caller owns the landmark and the gap). */
|
|
421
|
+
export function NavigationSidebarGroupedEntries({
|
|
422
|
+
items,
|
|
423
|
+
activeId,
|
|
424
|
+
pendingId,
|
|
425
|
+
openGroupId,
|
|
426
|
+
showLabel,
|
|
427
|
+
disabled,
|
|
428
|
+
onItemClick,
|
|
429
|
+
onGroupClick,
|
|
430
|
+
}: NavigationSidebarGroupedEntriesProps) {
|
|
431
|
+
return (
|
|
432
|
+
<>
|
|
433
|
+
{items.map(item =>
|
|
434
|
+
(item.children?.length ?? 0) > 0 ? (
|
|
435
|
+
<GroupedGroup
|
|
436
|
+
key={item.id}
|
|
437
|
+
item={item}
|
|
438
|
+
isOpen={item.id === openGroupId}
|
|
439
|
+
activeId={activeId}
|
|
440
|
+
pendingId={pendingId}
|
|
441
|
+
showLabel={showLabel}
|
|
442
|
+
disabled={disabled}
|
|
443
|
+
onItemClick={onItemClick}
|
|
444
|
+
onGroupClick={onGroupClick}
|
|
445
|
+
/>
|
|
446
|
+
) : (
|
|
447
|
+
<GroupedLeafRow
|
|
448
|
+
key={item.id}
|
|
449
|
+
item={item}
|
|
450
|
+
isActive={item.id === activeId}
|
|
451
|
+
isPending={item.id === pendingId}
|
|
452
|
+
showLabel={showLabel}
|
|
453
|
+
disabled={disabled}
|
|
454
|
+
onClick={onItemClick}
|
|
455
|
+
/>
|
|
456
|
+
),
|
|
457
|
+
)}
|
|
458
|
+
</>
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export interface NavigationSidebarActionRowProps {
|
|
463
|
+
icon: ReactNode;
|
|
464
|
+
label: string;
|
|
465
|
+
/** A link (prefetch, open in a new tab); without it the row is a button. */
|
|
466
|
+
href?: string;
|
|
467
|
+
/** Runs on click, before a link's own navigation (e.g. to close a menu). */
|
|
468
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
469
|
+
/** The page the row leads to is open: the active pill and, on a link, `aria-current="page"`. */
|
|
470
|
+
active?: boolean;
|
|
471
|
+
/** A count pill after the label (capped at "99+"); a dot on the icon in the rail. 0 = none. */
|
|
472
|
+
count?: number;
|
|
473
|
+
/** `'outline'`: a bordered row with an accent icon — an action rather than a place ("New chat"). */
|
|
474
|
+
variant?: 'default' | 'outline';
|
|
475
|
+
disabled?: boolean;
|
|
476
|
+
/** The sidebar's `minimized` (from the slot's render function): the rail's tooltip. The geometry follows the rail's width on its own. */
|
|
477
|
+
minimized?: boolean;
|
|
478
|
+
/** Accessible name. Default: the label, with the count — "Needs approval (3)". */
|
|
479
|
+
'aria-label'?: string;
|
|
480
|
+
className?: string;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* A row for a grouped sidebar's slots (`topSlot`): the nav entry's geometry —
|
|
485
|
+
* 44px with an 8px inset, the icon centred in the rail — its hover, active pill
|
|
486
|
+
* and count pill, for what is not a nav entry: an action ("New chat",
|
|
487
|
+
* `variant="outline"`) or a host-owned destination with its own count ("Needs
|
|
488
|
+
* approval"). Renders in the mobile burger menu too, expanded.
|
|
489
|
+
*/
|
|
490
|
+
export function NavigationSidebarActionRow({
|
|
491
|
+
icon,
|
|
492
|
+
label,
|
|
493
|
+
href,
|
|
494
|
+
onClick,
|
|
495
|
+
active = false,
|
|
496
|
+
count = 0,
|
|
497
|
+
variant = 'default',
|
|
498
|
+
disabled = false,
|
|
499
|
+
minimized = false,
|
|
500
|
+
'aria-label': ariaLabel,
|
|
501
|
+
className,
|
|
502
|
+
}: NavigationSidebarActionRowProps) {
|
|
503
|
+
// The nav row's own parts, fed a stand-in entry: one geometry, one pill.
|
|
504
|
+
const entry: NavigationSidebarItem = { id: 'action', label, icon, unreadCount: count };
|
|
505
|
+
const lit = active && !disabled;
|
|
506
|
+
const outline = variant === 'outline';
|
|
507
|
+
const name = ariaLabel ?? (count > 0 ? `${label} (${count > 99 ? '99+' : count})` : label);
|
|
508
|
+
const classes = cn(
|
|
509
|
+
'group/nav-row',
|
|
510
|
+
ROW_CLASSES,
|
|
511
|
+
outline && 'border border-ods-border',
|
|
512
|
+
!disabled && !lit && 'text-ods-text-primary hover:after:opacity-100',
|
|
513
|
+
lit && ACTIVE_PILL,
|
|
514
|
+
disabled && 'cursor-not-allowed text-ods-text-secondary opacity-50',
|
|
515
|
+
className,
|
|
516
|
+
);
|
|
517
|
+
const content = (
|
|
518
|
+
<>
|
|
519
|
+
<RowIcon item={entry} size={20} className={lit || (outline && !disabled) ? 'text-ods-accent' : idleIcon('row')} />
|
|
520
|
+
<RowLabel item={entry} />
|
|
521
|
+
</>
|
|
522
|
+
);
|
|
523
|
+
const shared = { className: classes, title: minimized ? name : undefined, 'aria-label': name };
|
|
524
|
+
if (href && !disabled) {
|
|
525
|
+
return (
|
|
526
|
+
<Link href={href} onClick={onClick} aria-current={lit ? 'page' : undefined} {...shared}>
|
|
527
|
+
{content}
|
|
528
|
+
</Link>
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
return (
|
|
532
|
+
<button type="button" onClick={onClick} disabled={disabled} {...shared}>
|
|
533
|
+
{content}
|
|
534
|
+
</button>
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/** A placeholder row in the grouped geometry, for `NavigationSidebarConfig.loading`. */
|
|
539
|
+
export function NavigationSidebarGroupedSkeleton() {
|
|
540
|
+
return (
|
|
541
|
+
<div
|
|
542
|
+
className="flex h-11 w-full items-center overflow-hidden pl-[var(--spacing-system-xsf)] @[140px]/of-nav-sidebar:pr-[var(--spacing-system-xsf)]"
|
|
543
|
+
aria-hidden="true"
|
|
544
|
+
>
|
|
545
|
+
<UnifiedSkeleton className="size-5 shrink-0 rounded" />
|
|
546
|
+
{/* The label's fade rides a wrapper, not the bar: its `duration-*` also sets
|
|
547
|
+
`animation-duration` (tailwindcss-animate), which would run the bar's pulse
|
|
548
|
+
at the fade's 150ms while the icon beside it keeps the shared one. */}
|
|
549
|
+
<div className={cn('ml-[var(--spacing-system-xsf)] min-w-0 flex-1', EXPANDED_ONLY)}>
|
|
550
|
+
<UnifiedSkeleton className="h-4 w-full rounded" />
|
|
551
|
+
</div>
|
|
552
|
+
</div>
|
|
553
|
+
);
|
|
554
|
+
}
|