@lateralus-ai/shipping-ui 1.4.16 → 2.0.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -53
- package/dist/components/Checkbox.d.ts +9 -0
- package/dist/components/Chip.d.ts +15 -0
- package/dist/components/EmptyState.d.ts +10 -0
- package/dist/components/Entry.d.ts +13 -0
- package/dist/components/Header.d.ts +9 -0
- package/dist/components/Input.d.ts +11 -0
- package/dist/components/InputType.d.ts +10 -0
- package/dist/components/ModalPanel.d.ts +7 -7
- package/dist/components/PdfViewer/ImageViewer.d.ts +2 -2
- package/dist/components/PdfViewer/PdfViewer.d.ts +2 -2
- package/dist/components/ReportInput.d.ts +10 -0
- package/dist/components/Tab.d.ts +7 -0
- package/dist/components/Tabs.d.ts +11 -12
- package/dist/components/index.d.ts +11 -4
- package/dist/domain/Filters/FilterPill.d.ts +6 -0
- package/dist/domain/Filters/FilteredPill.d.ts +8 -0
- package/dist/domain/Filters/FiltersBar.d.ts +12 -0
- package/dist/domain/Filters/index.d.ts +3 -0
- package/dist/domain/Forms/FormCard.d.ts +12 -0
- package/dist/domain/Forms/FormHeader.d.ts +8 -0
- package/dist/domain/Forms/ListRow.d.ts +8 -0
- package/dist/domain/Forms/RiskMeter.d.ts +8 -0
- package/dist/domain/Forms/index.d.ts +4 -0
- package/dist/domain/Library/File.d.ts +8 -0
- package/dist/domain/Library/Folder.d.ts +8 -0
- package/dist/domain/Library/Folders.d.ts +11 -0
- package/dist/domain/Library/ListRow.d.ts +8 -0
- package/dist/domain/Library/Navigation.d.ts +7 -0
- package/dist/domain/Library/index.d.ts +5 -0
- package/dist/domain/Report/InfoHeading.d.ts +7 -0
- package/dist/domain/Report/InfoRow.d.ts +8 -0
- package/dist/domain/Report/Report.d.ts +7 -0
- package/dist/domain/Report/SectionHeader.d.ts +10 -0
- package/dist/domain/Report/TaskRow.d.ts +11 -0
- package/dist/domain/Report/index.d.ts +5 -0
- package/dist/domain/Settings/EquipmentRow.d.ts +8 -0
- package/dist/domain/Settings/MemberRow.d.ts +11 -0
- package/dist/domain/Settings/SettingRow.d.ts +10 -0
- package/dist/domain/Settings/index.d.ts +3 -0
- package/dist/domain/Ships/ShipRow.d.ts +10 -0
- package/dist/domain/Ships/index.d.ts +1 -0
- package/dist/domain/Workflows/GroupHeader.d.ts +8 -0
- package/dist/domain/Workflows/Importance.d.ts +8 -0
- package/dist/domain/Workflows/Progress.d.ts +7 -0
- package/dist/domain/Workflows/Question.d.ts +9 -0
- package/dist/domain/Workflows/StatusPopover.d.ts +7 -0
- package/dist/domain/Workflows/Task.d.ts +9 -0
- package/dist/domain/Workflows/TaskHeader.d.ts +9 -0
- package/dist/domain/Workflows/WorkflowFilters.d.ts +6 -0
- package/dist/domain/Workflows/WorkflowForm.d.ts +8 -0
- package/dist/domain/Workflows/WorkflowHeader.d.ts +11 -0
- package/dist/domain/Workflows/WorkflowListItem.d.ts +11 -0
- package/dist/domain/Workflows/WorkflowProgress.d.ts +6 -0
- package/dist/domain/Workflows/WorkflowRow.d.ts +10 -0
- package/dist/domain/Workflows/index.d.ts +13 -0
- package/dist/domain/index.d.ts +7 -0
- package/dist/icons/ArrowIcon.d.ts +8 -0
- package/dist/icons/ChevronIcon.d.ts +8 -0
- package/dist/icons/Icon.d.ts +96 -0
- package/dist/icons/arrow-paths.d.ts +12 -0
- package/dist/icons/chevron-paths.d.ts +27 -0
- package/dist/icons/createIcon.d.ts +34 -0
- package/dist/icons/generated.d.ts +68 -0
- package/dist/icons/icon-sizes.d.ts +5 -0
- package/dist/icons/icons-data.d.ts +1023 -0
- package/dist/icons/index.d.ts +13 -0
- package/dist/icons/types.d.ts +10 -0
- package/dist/illustrations/AuditPreparation.d.ts +4 -0
- package/dist/illustrations/CompletedTasks.d.ts +4 -0
- package/dist/illustrations/Creation.d.ts +4 -0
- package/dist/illustrations/InternalAudit.d.ts +4 -0
- package/dist/illustrations/Invite.d.ts +4 -0
- package/dist/illustrations/PortStateControl.d.ts +4 -0
- package/dist/illustrations/Processing.d.ts +4 -0
- package/dist/illustrations/QuestionsDone.d.ts +4 -0
- package/dist/illustrations/RightShipInspection.d.ts +4 -0
- package/dist/illustrations/Upload.d.ts +4 -0
- package/dist/illustrations/WorkflowCreated.d.ts +4 -0
- package/dist/illustrations/Workflows.d.ts +4 -0
- package/dist/illustrations/createIllustration.d.ts +11 -0
- package/dist/illustrations/index.d.ts +13 -0
- package/dist/index.cjs +64 -80
- package/dist/index.d.ts +9 -3
- package/dist/index.esm.js +10964 -36537
- package/dist/patterns/Chat/Attachment.d.ts +6 -0
- package/dist/patterns/Chat/ChatEntry.d.ts +10 -0
- package/dist/patterns/Chat/ChatHeader.d.ts +7 -0
- package/dist/patterns/Chat/ChatInput.d.ts +5 -0
- package/dist/patterns/Chat/ChatStatus.d.ts +6 -0
- package/dist/patterns/Chat/ChatTile.d.ts +9 -0
- package/dist/patterns/Chat/Copilot.d.ts +8 -0
- package/dist/patterns/Chat/Draft.d.ts +5 -0
- package/dist/patterns/Chat/Greeting.d.ts +7 -0
- package/dist/patterns/Chat/Reference.d.ts +6 -0
- package/dist/patterns/Chat/Source.d.ts +6 -0
- package/dist/patterns/Chat/Sources.d.ts +5 -0
- package/dist/patterns/Chat/Suggestion.d.ts +5 -0
- package/dist/patterns/Chat/Suggestions.d.ts +4 -0
- package/dist/patterns/Chat/index.d.ts +14 -0
- package/dist/patterns/Modal/Invitee.d.ts +8 -0
- package/dist/patterns/Modal/ModalFooter.d.ts +6 -0
- package/dist/patterns/Modal/ModalHeader.d.ts +10 -0
- package/dist/patterns/Modal/index.d.ts +3 -0
- package/dist/patterns/Search/Pill.d.ts +10 -0
- package/dist/patterns/Search/PillInfo.d.ts +8 -0
- package/dist/patterns/Search/ResultRow.d.ts +10 -0
- package/dist/patterns/Search/SearchModal.d.ts +6 -0
- package/dist/patterns/Search/SectionHeader.d.ts +5 -0
- package/dist/patterns/Search/index.d.ts +5 -0
- package/dist/patterns/Sidebar/Account.d.ts +22 -0
- package/dist/patterns/Sidebar/ActivityNavGroup.d.ts +17 -0
- package/dist/patterns/Sidebar/CollapsibleNavGroup.d.ts +24 -0
- package/dist/patterns/Sidebar/Indicator.d.ts +6 -0
- package/dist/patterns/Sidebar/NewChat.d.ts +10 -0
- package/dist/patterns/Sidebar/Sidebar.d.ts +13 -0
- package/dist/patterns/Sidebar/SidebarAction.d.ts +11 -0
- package/dist/patterns/Sidebar/SidebarEntry.d.ts +25 -0
- package/dist/patterns/Sidebar/SidebarHeading.d.ts +11 -0
- package/dist/patterns/Sidebar/SidebarLink.d.ts +22 -0
- package/dist/patterns/Sidebar/SidebarShell.d.ts +11 -0
- package/dist/patterns/Sidebar/Switcher.d.ts +8 -0
- package/dist/patterns/Sidebar/constants.d.ts +2 -0
- package/dist/patterns/Sidebar/figma-assets.d.ts +3 -0
- package/dist/patterns/Sidebar/figma-demo-content.d.ts +75 -0
- package/dist/patterns/Sidebar/figma-sidebar-nav.d.ts +12 -0
- package/dist/patterns/Sidebar/index.d.ts +13 -0
- package/dist/patterns/Sidebar/sidebar-styles.d.ts +45 -0
- package/dist/patterns/Skeleton/Skeleton.d.ts +6 -0
- package/dist/patterns/Skeleton/index.d.ts +1 -0
- package/dist/patterns/index.d.ts +5 -0
- package/dist/primitives/Avatar.d.ts +10 -0
- package/dist/primitives/Badge.d.ts +11 -0
- package/dist/primitives/Button.d.ts +13 -0
- package/dist/primitives/Callout.d.ts +7 -0
- package/dist/primitives/Count.d.ts +5 -0
- package/dist/primitives/DropdownMenu.d.ts +15 -0
- package/dist/primitives/GroupedAvatars.d.ts +7 -0
- package/dist/primitives/IconButton.d.ts +16 -0
- package/dist/primitives/Logo.d.ts +8 -0
- package/dist/primitives/MenuItem.d.ts +7 -0
- package/dist/primitives/Switch.d.ts +7 -0
- package/dist/primitives/ThinkingDot.d.ts +4 -0
- package/dist/primitives/Tooltip.d.ts +12 -0
- package/dist/primitives/index.d.ts +13 -0
- package/dist/style.css +1 -1
- package/dist/tailwind-theme.d.ts +234 -198
- package/dist/tokens/colors.d.ts +148 -0
- package/dist/tokens/elevation.d.ts +11 -0
- package/dist/tokens/index.d.ts +4 -0
- package/dist/tokens/semantic.d.ts +89 -0
- package/dist/tokens/typography.d.ts +85 -0
- package/package.json +27 -5
- package/src/components/Checkbox.tsx +77 -0
- package/src/components/Chip.tsx +69 -0
- package/src/components/EmptyState.tsx +44 -0
- package/src/components/Entry.tsx +64 -0
- package/src/components/Header.tsx +39 -0
- package/src/components/Input.tsx +69 -0
- package/src/components/InputType.tsx +76 -0
- package/src/components/ModalPanel.tsx +22 -37
- package/src/components/PdfViewer/ImageViewer.tsx +121 -182
- package/src/components/PdfViewer/PdfViewer.tsx +103 -155
- package/src/components/ReportInput.tsx +65 -0
- package/src/components/Tab.tsx +33 -0
- package/src/components/Tabs.tsx +43 -38
- package/src/components/index.ts +11 -4
- package/src/domain/Filters/FilterPill.tsx +25 -0
- package/src/domain/Filters/FilteredPill.tsx +39 -0
- package/src/domain/Filters/FiltersBar.tsx +76 -0
- package/src/domain/Filters/index.ts +3 -0
- package/src/domain/Forms/FormCard.tsx +61 -0
- package/src/domain/Forms/FormHeader.tsx +34 -0
- package/src/domain/Forms/ListRow.tsx +40 -0
- package/src/domain/Forms/RiskMeter.tsx +50 -0
- package/src/domain/Forms/index.ts +4 -0
- package/src/domain/Library/File.tsx +59 -0
- package/src/domain/Library/Folder.tsx +55 -0
- package/src/domain/Library/Folders.tsx +43 -0
- package/src/domain/Library/ListRow.tsx +40 -0
- package/src/domain/Library/Navigation.tsx +31 -0
- package/src/domain/Library/index.ts +5 -0
- package/src/domain/Report/InfoHeading.tsx +25 -0
- package/src/domain/Report/InfoRow.tsx +35 -0
- package/src/domain/Report/Report.tsx +53 -0
- package/src/domain/Report/SectionHeader.tsx +43 -0
- package/src/domain/Report/TaskRow.tsx +57 -0
- package/src/domain/Report/index.ts +5 -0
- package/src/domain/Settings/EquipmentRow.tsx +39 -0
- package/src/domain/Settings/MemberRow.tsx +53 -0
- package/src/domain/Settings/SettingRow.tsx +66 -0
- package/src/domain/Settings/index.ts +3 -0
- package/src/domain/Ships/ShipRow.tsx +49 -0
- package/src/domain/Ships/index.ts +1 -0
- package/src/domain/Workflows/GroupHeader.tsx +48 -0
- package/src/domain/Workflows/Importance.tsx +48 -0
- package/src/domain/Workflows/Progress.tsx +55 -0
- package/src/domain/Workflows/Question.tsx +42 -0
- package/src/domain/Workflows/StatusPopover.tsx +53 -0
- package/src/domain/Workflows/Task.tsx +46 -0
- package/src/domain/Workflows/TaskHeader.tsx +51 -0
- package/src/domain/Workflows/WorkflowFilters.tsx +40 -0
- package/src/domain/Workflows/WorkflowForm.tsx +40 -0
- package/src/domain/Workflows/WorkflowHeader.tsx +62 -0
- package/src/domain/Workflows/WorkflowListItem.tsx +45 -0
- package/src/domain/Workflows/WorkflowProgress.tsx +36 -0
- package/src/domain/Workflows/WorkflowRow.tsx +43 -0
- package/src/domain/Workflows/index.ts +13 -0
- package/src/domain/index.ts +37 -0
- package/src/icons/ArrowIcon.tsx +42 -0
- package/src/icons/ChevronIcon.tsx +42 -0
- package/src/icons/Icon.tsx +184 -0
- package/src/icons/arrow-paths.ts +8 -0
- package/src/icons/chevron-paths.ts +17 -0
- package/src/icons/createIcon.tsx +128 -0
- package/src/icons/generated.tsx +71 -0
- package/src/icons/icon-sizes.ts +20 -0
- package/src/icons/icons-data.ts +656 -0
- package/src/icons/index.ts +25 -0
- package/src/icons/types.ts +18 -0
- package/src/illustrations/AuditPreparation.tsx +15 -0
- package/src/illustrations/CompletedTasks.tsx +16 -0
- package/src/illustrations/Creation.tsx +13 -0
- package/src/illustrations/InternalAudit.tsx +13 -0
- package/src/illustrations/Invite.tsx +13 -0
- package/src/illustrations/PortStateControl.tsx +13 -0
- package/src/illustrations/Processing.tsx +17 -0
- package/src/illustrations/QuestionsDone.tsx +16 -0
- package/src/illustrations/RightShipInspection.tsx +18 -0
- package/src/illustrations/Upload.tsx +12 -0
- package/src/illustrations/WorkflowCreated.tsx +13 -0
- package/src/illustrations/Workflows.tsx +13 -0
- package/src/illustrations/createIllustration.tsx +30 -0
- package/src/illustrations/index.ts +14 -0
- package/src/index.ts +49 -3
- package/src/patterns/Chat/Attachment.tsx +27 -0
- package/src/patterns/Chat/ChatEntry.tsx +41 -0
- package/src/patterns/Chat/ChatHeader.tsx +39 -0
- package/src/patterns/Chat/ChatInput.tsx +35 -0
- package/src/patterns/Chat/ChatStatus.tsx +26 -0
- package/src/patterns/Chat/ChatTile.tsx +40 -0
- package/src/patterns/Chat/Copilot.tsx +50 -0
- package/src/patterns/Chat/Draft.tsx +23 -0
- package/src/patterns/Chat/Greeting.tsx +32 -0
- package/src/patterns/Chat/Reference.tsx +26 -0
- package/src/patterns/Chat/Source.tsx +27 -0
- package/src/patterns/Chat/Sources.tsx +23 -0
- package/src/patterns/Chat/Suggestion.tsx +23 -0
- package/src/patterns/Chat/Suggestions.tsx +21 -0
- package/src/patterns/Chat/index.ts +14 -0
- package/src/patterns/Modal/Invitee.tsx +44 -0
- package/src/patterns/Modal/ModalFooter.tsx +39 -0
- package/src/patterns/Modal/ModalHeader.tsx +77 -0
- package/src/patterns/Modal/index.ts +3 -0
- package/src/patterns/Search/Pill.tsx +44 -0
- package/src/patterns/Search/PillInfo.tsx +41 -0
- package/src/patterns/Search/ResultRow.tsx +52 -0
- package/src/patterns/Search/SearchModal.tsx +88 -0
- package/src/patterns/Search/SectionHeader.tsx +20 -0
- package/src/patterns/Search/index.ts +5 -0
- package/src/patterns/Sidebar/Account.tsx +193 -0
- package/src/patterns/Sidebar/ActivityNavGroup.tsx +71 -0
- package/src/patterns/Sidebar/CollapsibleNavGroup.tsx +106 -0
- package/src/patterns/Sidebar/Indicator.tsx +14 -0
- package/src/patterns/Sidebar/NewChat.tsx +71 -0
- package/src/patterns/Sidebar/Sidebar.tsx +363 -0
- package/src/patterns/Sidebar/SidebarAction.tsx +55 -0
- package/src/patterns/Sidebar/SidebarEntry.tsx +129 -0
- package/src/patterns/Sidebar/SidebarHeading.tsx +38 -0
- package/src/patterns/Sidebar/SidebarLink.tsx +125 -0
- package/src/patterns/Sidebar/SidebarShell.tsx +32 -0
- package/src/patterns/Sidebar/Switcher.tsx +116 -0
- package/src/patterns/Sidebar/assets/account-avatar-24.jpg +0 -0
- package/src/patterns/Sidebar/assets/account-avatar.jpg +0 -0
- package/src/patterns/Sidebar/assets/indicator-compliance.png +0 -0
- package/src/patterns/Sidebar/assets/indicator-technical.png +0 -0
- package/src/patterns/Sidebar/assets/logo-compliance-mark.png +5 -0
- package/src/patterns/Sidebar/assets/logo-compliance-mask.png +13 -0
- package/src/patterns/Sidebar/assets/logo-compliance.svg +17 -0
- package/src/patterns/Sidebar/assets/logo-technical-avatar.svg +17 -0
- package/src/patterns/Sidebar/assets/logo-technical-mark.png +5 -0
- package/src/patterns/Sidebar/assets/logo-technical.svg +16 -0
- package/src/patterns/Sidebar/constants.ts +2 -0
- package/src/patterns/Sidebar/figma-assets.ts +4 -0
- package/src/patterns/Sidebar/figma-demo-content.ts +30 -0
- package/src/patterns/Sidebar/figma-sidebar-nav.ts +79 -0
- package/src/patterns/Sidebar/index.ts +13 -0
- package/src/patterns/Sidebar/sidebar-styles.ts +101 -0
- package/src/patterns/Skeleton/Skeleton.tsx +57 -0
- package/src/patterns/Skeleton/index.ts +1 -0
- package/src/patterns/index.ts +5 -0
- package/src/primitives/Avatar.tsx +71 -0
- package/src/primitives/Badge.tsx +34 -0
- package/src/primitives/Button.tsx +67 -0
- package/src/primitives/Callout.tsx +21 -0
- package/src/primitives/Count.tsx +18 -0
- package/src/primitives/DropdownMenu.tsx +60 -0
- package/src/primitives/GroupedAvatars.tsx +36 -0
- package/src/primitives/IconButton.tsx +56 -0
- package/src/primitives/Logo.tsx +43 -0
- package/src/primitives/MenuItem.tsx +35 -0
- package/src/primitives/Switch.tsx +38 -0
- package/src/primitives/ThinkingDot.tsx +34 -0
- package/src/primitives/Tooltip.tsx +42 -0
- package/src/primitives/index.ts +13 -0
- package/src/stories/_layout/FigmaPage.tsx +94 -0
- package/src/stories/_layout/index.ts +8 -0
- package/src/stories/canvases/ButtonsCanvas.tsx +57 -0
- package/src/stories/canvases/ButtonsMatrixCanvas.tsx +64 -0
- package/src/stories/canvases/ChatCanvas.tsx +130 -0
- package/src/stories/canvases/ColorTokensCanvas.tsx +16 -0
- package/src/stories/canvases/ColorsCanvas.tsx +101 -0
- package/src/stories/canvases/ContentCanvas.tsx +88 -0
- package/src/stories/canvases/CoreCanvas.tsx +125 -0
- package/src/stories/canvases/DomainFormsCanvas.tsx +67 -0
- package/src/stories/canvases/FiltersCanvas.tsx +41 -0
- package/src/stories/canvases/FormsCanvas.tsx +71 -0
- package/src/stories/canvases/IconsCanvas.tsx +99 -0
- package/src/stories/canvases/IllustrationsCanvas.tsx +50 -0
- package/src/stories/canvases/LibraryCanvas.tsx +67 -0
- package/src/stories/canvases/ModalsCanvas.tsx +54 -0
- package/src/stories/canvases/RaiseLevelsCanvas.tsx +27 -0
- package/src/stories/canvases/ReportCanvas.tsx +33 -0
- package/src/stories/canvases/ReportLayoutCanvas.tsx +19 -0
- package/src/stories/canvases/SearchCanvas.tsx +65 -0
- package/src/stories/canvases/SettingsCanvas.tsx +41 -0
- package/src/stories/canvases/ShipsCanvas.tsx +38 -0
- package/src/stories/canvases/SidebarCanvas.tsx +147 -0
- package/src/stories/canvases/SidebarLayoutsCanvas.tsx +71 -0
- package/src/stories/canvases/SidebarPlayground.tsx +35 -0
- package/src/stories/canvases/SkeletonsCanvas.tsx +30 -0
- package/src/stories/canvases/TypographyCanvas.tsx +53 -0
- package/src/stories/canvases/WorkflowsCanvas.tsx +129 -0
- package/src/stories/canvases/figma-icons-layout.ts +318 -0
- package/src/stories/canvases/figma-sidebar-layout.ts +212 -0
- package/src/stories/canvases/figma-sidebar-layouts-layout.ts +84 -0
- package/src/stories/canvases/figma-widths.ts +28 -0
- package/src/stories/canvases/helpers.tsx +163 -0
- package/src/stories/components/Buttons.stories.tsx +12 -0
- package/src/stories/components/Chat.stories.tsx +12 -0
- package/src/stories/components/Content.stories.tsx +12 -0
- package/src/stories/components/Core.stories.tsx +12 -0
- package/src/stories/components/DomainForms.stories.tsx +12 -0
- package/src/stories/components/Filters.stories.tsx +12 -0
- package/src/stories/components/Forms.stories.tsx +12 -0
- package/src/stories/components/Icons.stories.tsx +12 -0
- package/src/stories/components/Illustrations.stories.tsx +12 -0
- package/src/stories/components/Library.stories.tsx +12 -0
- package/src/stories/components/Modals.stories.tsx +12 -0
- package/src/stories/components/Report.stories.tsx +12 -0
- package/src/stories/components/ReportLayout.stories.tsx +12 -0
- package/src/stories/components/Search.stories.tsx +12 -0
- package/src/stories/components/Settings.stories.tsx +12 -0
- package/src/stories/components/Ships.stories.tsx +12 -0
- package/src/stories/components/Sidebar.stories.tsx +37 -0
- package/src/stories/components/SidebarLayouts.stories.tsx +12 -0
- package/src/stories/components/Skeletons.stories.tsx +12 -0
- package/src/stories/components/Workflows.stories.tsx +12 -0
- package/src/stories/style-guide/Buttons.stories.tsx +12 -0
- package/src/stories/style-guide/ColorTokens.stories.tsx +12 -0
- package/src/stories/style-guide/Colors.stories.tsx +12 -0
- package/src/stories/style-guide/RaiseLevels.stories.tsx +12 -0
- package/src/stories/style-guide/Typography.stories.tsx +12 -0
- package/src/style.css +169 -2
- package/src/tailwind-theme.ts +164 -240
- package/src/tokens/colors.ts +82 -0
- package/src/tokens/elevation.ts +12 -0
- package/src/tokens/index.ts +4 -0
- package/src/tokens/semantic.ts +89 -0
- package/src/tokens/typography.ts +21 -0
- package/dist/components/HelloWorld.d.ts +0 -1
- package/dist/components/InputPrompt.d.ts +0 -20
- package/dist/components/SearchModal.d.ts +0 -24
- package/dist/components/Sidebar/Button.d.ts +0 -7
- package/dist/components/Sidebar/Container.d.ts +0 -5
- package/dist/components/Sidebar/Item.d.ts +0 -9
- package/dist/components/Sidebar/Layout.d.ts +0 -10
- package/dist/components/Sidebar/Provider.d.ts +0 -14
- package/dist/components/Sidebar/SecondaryItem.d.ts +0 -9
- package/dist/components/Sidebar/SideContainer.d.ts +0 -5
- package/dist/components/Sidebar/ToggleCollapseButton.d.ts +0 -1
- package/dist/components/Sidebar/index.d.ts +0 -8
- package/dist/components/icons/CloseSidebarIcon.d.ts +0 -2
- package/dist/components/icons/CloseSidebarMidIcon.d.ts +0 -1
- package/dist/components/icons/ExpandIcon.d.ts +0 -3
- package/dist/components/icons/SendArrowIcon.d.ts +0 -4
- package/dist/components/icons/SendArrowIconGreen.d.ts +0 -4
- package/dist/components/icons/SettingsIcon.d.ts +0 -3
- package/dist/components/icons/XIcon.d.ts +0 -3
- package/dist/material-theme.d.ts +0 -442
- package/dist/stories/Buttons.d.ts +0 -1
- package/dist/stories/Checkbox.d.ts +0 -1
- package/dist/stories/ColorPalette.d.ts +0 -1
- package/dist/stories/Dropdowns.d.ts +0 -1
- package/dist/stories/InputPrompt.d.ts +0 -1
- package/dist/stories/SearchModal.d.ts +0 -1
- package/dist/stories/Sidebar.d.ts +0 -1
- package/dist/stories/Typography.d.ts +0 -1
- package/src/components/HelloWorld.tsx +0 -3
- package/src/components/InputPrompt.tsx +0 -96
- package/src/components/SearchModal.tsx +0 -320
- package/src/components/Sidebar/Button.tsx +0 -20
- package/src/components/Sidebar/Container.tsx +0 -31
- package/src/components/Sidebar/Item.tsx +0 -39
- package/src/components/Sidebar/Layout.tsx +0 -32
- package/src/components/Sidebar/Provider.tsx +0 -47
- package/src/components/Sidebar/SecondaryItem.tsx +0 -39
- package/src/components/Sidebar/SideContainer.tsx +0 -31
- package/src/components/Sidebar/ToggleCollapseButton.tsx +0 -24
- package/src/components/Sidebar/index.ts +0 -8
- package/src/components/icons/CloseSidebarIcon.tsx +0 -19
- package/src/components/icons/CloseSidebarMidIcon.tsx +0 -19
- package/src/components/icons/ExpandIcon.tsx +0 -21
- package/src/components/icons/SendArrowIcon.tsx +0 -23
- package/src/components/icons/SendArrowIconGreen.tsx +0 -17
- package/src/components/icons/SettingsIcon.tsx +0 -33
- package/src/components/icons/XIcon.tsx +0 -21
- package/src/material-theme.ts +0 -477
- package/src/stories/Buttons.stories.tsx +0 -15
- package/src/stories/Buttons.tsx +0 -52
- package/src/stories/Checkbox.stories.tsx +0 -15
- package/src/stories/Checkbox.tsx +0 -56
- package/src/stories/ColorPalette.stories.tsx +0 -15
- package/src/stories/ColorPalette.tsx +0 -85
- package/src/stories/DocumentEditor.stories.tsx +0 -287
- package/src/stories/Dropdowns.stories.tsx +0 -15
- package/src/stories/Dropdowns.tsx +0 -52
- package/src/stories/InputPrompt.stories.tsx +0 -15
- package/src/stories/InputPrompt.tsx +0 -63
- package/src/stories/ModalHeader.stories.tsx +0 -36
- package/src/stories/PDFViewer.stories.tsx +0 -39
- package/src/stories/SearchModal.stories.tsx +0 -132
- package/src/stories/SearchModal.tsx +0 -82
- package/src/stories/Sidebar.stories.tsx +0 -15
- package/src/stories/Sidebar.tsx +0 -108
- package/src/stories/Tabs.stories.tsx +0 -51
- package/src/stories/Typography.stories.tsx +0 -15
- package/src/stories/Typography.tsx +0 -110
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { type MouseEvent, type ReactNode, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
ActivityIcon,
|
|
4
|
+
AnalyticsIcon,
|
|
5
|
+
BookIcon,
|
|
6
|
+
DefectReportIcon,
|
|
7
|
+
FormsIcon,
|
|
8
|
+
SearchIcon,
|
|
9
|
+
ShipIcon,
|
|
10
|
+
TasksIcon,
|
|
11
|
+
WorkflowIcon,
|
|
12
|
+
} from "../../icons";
|
|
13
|
+
import { cn } from "../../utils/cn";import { Account } from "./Account";
|
|
14
|
+
import { ActivityNavGroup } from "./ActivityNavGroup";
|
|
15
|
+
import { CollapsibleNavGroup } from "./CollapsibleNavGroup";
|
|
16
|
+
import { DEMO_SIDEBAR_ENTRY_MENU_ITEMS } from "./figma-demo-content";
|
|
17
|
+
import {
|
|
18
|
+
FIGMA_NAV_LABELS,
|
|
19
|
+
getFigmaSidebarNav,
|
|
20
|
+
type FigmaNavItemId,
|
|
21
|
+
} from "./figma-sidebar-nav";
|
|
22
|
+
import { NewChat } from "./NewChat";
|
|
23
|
+
import { SidebarLink } from "./SidebarLink";
|
|
24
|
+
import { Switcher, type Chief } from "./Switcher";
|
|
25
|
+
import { SIDEBAR_COLLAPSED_WIDTH, SIDEBAR_EXPANDED_WIDTH } from "./constants";
|
|
26
|
+
import { sidebarBlockGap, sidebarScrollRegion } from "./sidebar-styles";
|
|
27
|
+
import type { SidebarEntryMenuItem } from "./SidebarEntry";
|
|
28
|
+
|
|
29
|
+
export type SidebarProps = {
|
|
30
|
+
chief?: Chief;
|
|
31
|
+
activity?: boolean;
|
|
32
|
+
/** Figma layouts: initial ships expanded. Interactive: toggles via chevron. */
|
|
33
|
+
ships?: boolean;
|
|
34
|
+
collapsed?: boolean;
|
|
35
|
+
showSearch?: boolean;
|
|
36
|
+
/** Frozen Figma grid — no toggles or menus. */
|
|
37
|
+
presentation?: boolean;
|
|
38
|
+
className?: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const navHref = (id: FigmaNavItemId) =>
|
|
42
|
+
`#${id.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
|
|
43
|
+
|
|
44
|
+
const navIcons: Record<FigmaNavItemId, ReactNode> = {
|
|
45
|
+
search: <SearchIcon size="small" className="text-display-on-light-primary" />,
|
|
46
|
+
workflows: <WorkflowIcon size="small" className="text-display-on-light-primary" />,
|
|
47
|
+
analytics: <AnalyticsIcon size="small" className="text-display-on-light-primary" />,
|
|
48
|
+
forms: <FormsIcon size="small" className="text-display-on-light-primary" />,
|
|
49
|
+
ships: <ShipIcon size="small" className="text-display-on-light-primary" />,
|
|
50
|
+
defectReports: <DefectReportIcon size="small" className="text-display-on-light-primary" />,
|
|
51
|
+
tasks: <TasksIcon size="small" className="text-display-on-light-primary" />,
|
|
52
|
+
knowledge: <BookIcon size="small" className="text-display-on-light-primary" />,
|
|
53
|
+
activity: <ActivityIcon size="small" className="text-display-on-light-tertiary" />,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const collapsedNavIcons: Record<FigmaNavItemId, ReactNode> = {
|
|
57
|
+
search: <SearchIcon size="small" />,
|
|
58
|
+
workflows: <WorkflowIcon size="small" />,
|
|
59
|
+
analytics: <AnalyticsIcon size="small" />,
|
|
60
|
+
forms: <FormsIcon size="small" />,
|
|
61
|
+
ships: <ShipIcon size="small" />,
|
|
62
|
+
defectReports: <DefectReportIcon size="small" />,
|
|
63
|
+
tasks: <TasksIcon size="small" />,
|
|
64
|
+
knowledge: <BookIcon size="small" />,
|
|
65
|
+
activity: <ActivityIcon size="small" />,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type RenderNavOptions = {
|
|
69
|
+
chief: Chief;
|
|
70
|
+
activity: boolean;
|
|
71
|
+
shipsExpanded: boolean;
|
|
72
|
+
onShipsExpandedChange: (expanded: boolean) => void;
|
|
73
|
+
presentation: boolean;
|
|
74
|
+
showSearch: boolean;
|
|
75
|
+
entryMenuItems?: SidebarEntryMenuItem[];
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const renderShipsItem = (
|
|
79
|
+
label: string,
|
|
80
|
+
href: string,
|
|
81
|
+
icon: ReactNode,
|
|
82
|
+
{ shipsExpanded, onShipsExpandedChange, presentation, entryMenuItems }: RenderNavOptions,
|
|
83
|
+
onNavigate: (event: MouseEvent<HTMLAnchorElement>) => void,
|
|
84
|
+
) => (
|
|
85
|
+
<CollapsibleNavGroup
|
|
86
|
+
href={href}
|
|
87
|
+
label={label}
|
|
88
|
+
icon={icon}
|
|
89
|
+
expanded={shipsExpanded}
|
|
90
|
+
onNavigate={onNavigate}
|
|
91
|
+
onExpandedChange={presentation ? () => undefined : onShipsExpandedChange}
|
|
92
|
+
entryMenuItems={entryMenuItems}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const renderActivityItem = (
|
|
97
|
+
href: string,
|
|
98
|
+
label: string,
|
|
99
|
+
icon: ReactNode,
|
|
100
|
+
{ chief, activity, entryMenuItems }: RenderNavOptions,
|
|
101
|
+
onNavigate: (event: MouseEvent<HTMLAnchorElement>) => void,
|
|
102
|
+
) => {
|
|
103
|
+
if (activity) {
|
|
104
|
+
return (
|
|
105
|
+
<ActivityNavGroup
|
|
106
|
+
href={href}
|
|
107
|
+
chief={chief}
|
|
108
|
+
icon={icon}
|
|
109
|
+
onNavigate={onNavigate}
|
|
110
|
+
entryMenuItems={entryMenuItems}
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<SidebarLink href={href} label={label} icon={icon} onNavigate={onNavigate} />
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const renderFigmaExpandedItem = (
|
|
121
|
+
id: FigmaNavItemId,
|
|
122
|
+
options: RenderNavOptions,
|
|
123
|
+
onNavigate: (event: MouseEvent<HTMLAnchorElement>) => void,
|
|
124
|
+
) => {
|
|
125
|
+
const label = FIGMA_NAV_LABELS[id];
|
|
126
|
+
|
|
127
|
+
if (id === "ships") {
|
|
128
|
+
return (
|
|
129
|
+
<div key={id}>
|
|
130
|
+
{renderShipsItem(label, navHref(id), navIcons.ships, options, onNavigate)}
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (id === "activity") {
|
|
136
|
+
return (
|
|
137
|
+
<div key={id}>
|
|
138
|
+
{renderActivityItem(navHref(id), label, navIcons.activity, options, onNavigate)}
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<SidebarLink
|
|
145
|
+
key={id}
|
|
146
|
+
href={navHref(id)}
|
|
147
|
+
label={label}
|
|
148
|
+
icon={navIcons[id]}
|
|
149
|
+
onNavigate={onNavigate}
|
|
150
|
+
/>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const renderDefaultExpandedNav = (
|
|
155
|
+
options: RenderNavOptions,
|
|
156
|
+
onNavigate: (event: MouseEvent<HTMLAnchorElement>) => void,
|
|
157
|
+
) => (
|
|
158
|
+
<>
|
|
159
|
+
{options.showSearch && (
|
|
160
|
+
<SidebarLink
|
|
161
|
+
href="#search"
|
|
162
|
+
label="Search"
|
|
163
|
+
icon={navIcons.search}
|
|
164
|
+
onNavigate={onNavigate}
|
|
165
|
+
/>
|
|
166
|
+
)}
|
|
167
|
+
|
|
168
|
+
<SidebarLink
|
|
169
|
+
href="#workflows"
|
|
170
|
+
label="Workflows"
|
|
171
|
+
icon={navIcons.workflows}
|
|
172
|
+
onNavigate={onNavigate}
|
|
173
|
+
/>
|
|
174
|
+
|
|
175
|
+
<SidebarLink
|
|
176
|
+
href="#analytics"
|
|
177
|
+
label="Analytics"
|
|
178
|
+
icon={navIcons.analytics}
|
|
179
|
+
onNavigate={onNavigate}
|
|
180
|
+
/>
|
|
181
|
+
|
|
182
|
+
{renderShipsItem("Ships", "#ships", navIcons.ships, options, onNavigate)}
|
|
183
|
+
|
|
184
|
+
<SidebarLink
|
|
185
|
+
href="#defect-reports"
|
|
186
|
+
label="Defect Reports"
|
|
187
|
+
icon={navIcons.defectReports}
|
|
188
|
+
onNavigate={onNavigate}
|
|
189
|
+
/>
|
|
190
|
+
|
|
191
|
+
<SidebarLink
|
|
192
|
+
href="#knowledge"
|
|
193
|
+
label="Knowledge"
|
|
194
|
+
icon={navIcons.knowledge}
|
|
195
|
+
onNavigate={onNavigate}
|
|
196
|
+
/>
|
|
197
|
+
|
|
198
|
+
{renderActivityItem("#activity", "Activity", navIcons.activity, options, onNavigate)}
|
|
199
|
+
</>
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
export const Sidebar = ({
|
|
203
|
+
chief = "technical",
|
|
204
|
+
activity = true,
|
|
205
|
+
ships = true,
|
|
206
|
+
collapsed = false,
|
|
207
|
+
showSearch = true,
|
|
208
|
+
presentation = false,
|
|
209
|
+
className,
|
|
210
|
+
}: SidebarProps) => {
|
|
211
|
+
const [sidebarHovered, setSidebarHovered] = useState(false);
|
|
212
|
+
const [isCollapsed, setIsCollapsed] = useState(collapsed);
|
|
213
|
+
const [shipsExpanded, setShipsExpanded] = useState(ships);
|
|
214
|
+
const [activeChief, setActiveChief] = useState(chief);
|
|
215
|
+
const figmaNav = getFigmaSidebarNav(activeChief);
|
|
216
|
+
|
|
217
|
+
const isSidebarCollapsed = presentation ? collapsed : isCollapsed;
|
|
218
|
+
const isShipsExpanded = presentation ? ships : shipsExpanded;
|
|
219
|
+
const resolvedChief = presentation ? chief : activeChief;
|
|
220
|
+
|
|
221
|
+
const entryMenuItems = presentation
|
|
222
|
+
? undefined
|
|
223
|
+
: [...DEMO_SIDEBAR_ENTRY_MENU_ITEMS];
|
|
224
|
+
|
|
225
|
+
const navOptions: RenderNavOptions = {
|
|
226
|
+
chief: resolvedChief,
|
|
227
|
+
activity,
|
|
228
|
+
shipsExpanded: isShipsExpanded,
|
|
229
|
+
onShipsExpandedChange: setShipsExpanded,
|
|
230
|
+
presentation,
|
|
231
|
+
showSearch,
|
|
232
|
+
entryMenuItems,
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const handleNavigate = (event: MouseEvent<HTMLAnchorElement>) => {
|
|
236
|
+
event.preventDefault();
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
const handleCollapsedExpandClick = (event: MouseEvent<HTMLDivElement>) => {
|
|
240
|
+
if (presentation || !isSidebarCollapsed) return;
|
|
241
|
+
|
|
242
|
+
const target = event.target as HTMLElement;
|
|
243
|
+
const isInteractive =
|
|
244
|
+
target.closest('button, a, [role="button"], [role="menuitem"]') !== null;
|
|
245
|
+
|
|
246
|
+
if (isInteractive) return;
|
|
247
|
+
|
|
248
|
+
setIsCollapsed(false);
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const renderCollapsedNav = () => {
|
|
252
|
+
const items = presentation
|
|
253
|
+
? figmaNav.collapsedItems
|
|
254
|
+
: figmaNav.collapsedItems.filter(({ id }) => {
|
|
255
|
+
if (id === "activity") return activity;
|
|
256
|
+
if (id === "ships") return true;
|
|
257
|
+
return showSearch || id !== "search";
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
return items.map(({ id, unread }) => (
|
|
261
|
+
<SidebarLink
|
|
262
|
+
key={id}
|
|
263
|
+
href={navHref(id)}
|
|
264
|
+
label={FIGMA_NAV_LABELS[id]}
|
|
265
|
+
icon={collapsedNavIcons[id]}
|
|
266
|
+
collapsed
|
|
267
|
+
unread={unread}
|
|
268
|
+
presentation={presentation}
|
|
269
|
+
tooltip={presentation ? undefined : FIGMA_NAV_LABELS[id]}
|
|
270
|
+
onNavigate={handleNavigate}
|
|
271
|
+
/>
|
|
272
|
+
));
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
const renderExpandedNav = () => {
|
|
276
|
+
if (presentation) {
|
|
277
|
+
return figmaNav.expandedItems.map((id) =>
|
|
278
|
+
renderFigmaExpandedItem(id, navOptions, handleNavigate),
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (chief === "compliance") {
|
|
283
|
+
return figmaNav.expandedItems.map((id) =>
|
|
284
|
+
renderFigmaExpandedItem(id, navOptions, handleNavigate),
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return renderDefaultExpandedNav(navOptions, handleNavigate);
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
return (
|
|
292
|
+
<aside
|
|
293
|
+
className={cn(
|
|
294
|
+
"flex h-full shrink-0 flex-col overflow-hidden border-r border-divider-primary bg-background-secondary",
|
|
295
|
+
"transition-[width,padding] duration-200 ease-in-out",
|
|
296
|
+
isSidebarCollapsed ? "p-2" : "p-4",
|
|
297
|
+
className,
|
|
298
|
+
)}
|
|
299
|
+
style={{
|
|
300
|
+
width: isSidebarCollapsed ? SIDEBAR_COLLAPSED_WIDTH : SIDEBAR_EXPANDED_WIDTH,
|
|
301
|
+
}}
|
|
302
|
+
data-collapsed={isSidebarCollapsed}
|
|
303
|
+
data-chief={resolvedChief}
|
|
304
|
+
aria-label="Sidebar navigation"
|
|
305
|
+
onMouseEnter={() => isSidebarCollapsed && setSidebarHovered(true)}
|
|
306
|
+
onMouseLeave={() => isSidebarCollapsed && setSidebarHovered(false)}
|
|
307
|
+
>
|
|
308
|
+
<div className={cn("flex min-h-0 flex-1 flex-col", sidebarBlockGap)}>
|
|
309
|
+
<div className={cn("flex shrink-0 flex-col", sidebarBlockGap)}>
|
|
310
|
+
<Switcher
|
|
311
|
+
chief={resolvedChief}
|
|
312
|
+
expanded={!isSidebarCollapsed}
|
|
313
|
+
onChiefChange={presentation ? undefined : setActiveChief}
|
|
314
|
+
/>
|
|
315
|
+
|
|
316
|
+
<NewChat
|
|
317
|
+
collapsed={isSidebarCollapsed}
|
|
318
|
+
presentation={presentation}
|
|
319
|
+
onNavigate={handleNavigate}
|
|
320
|
+
/>
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
<div
|
|
324
|
+
className={cn(
|
|
325
|
+
sidebarScrollRegion,
|
|
326
|
+
sidebarBlockGap,
|
|
327
|
+
isSidebarCollapsed ? "-mr-2 pr-2" : "-mr-4 pr-4",
|
|
328
|
+
)}
|
|
329
|
+
>
|
|
330
|
+
{!isSidebarCollapsed && (
|
|
331
|
+
<div className={cn("flex flex-col", sidebarBlockGap)}>{renderExpandedNav()}</div>
|
|
332
|
+
)}
|
|
333
|
+
|
|
334
|
+
{isSidebarCollapsed && (
|
|
335
|
+
<div
|
|
336
|
+
className={cn(
|
|
337
|
+
"flex min-h-0 flex-1 flex-col",
|
|
338
|
+
!presentation && "cursor-col-resize",
|
|
339
|
+
)}
|
|
340
|
+
onClick={handleCollapsedExpandClick}
|
|
341
|
+
>
|
|
342
|
+
<div className={cn("flex w-full flex-col", sidebarBlockGap)}>
|
|
343
|
+
{renderCollapsedNav()}
|
|
344
|
+
</div>
|
|
345
|
+
<div className="min-h-0 flex-1" aria-hidden />
|
|
346
|
+
</div>
|
|
347
|
+
)}
|
|
348
|
+
</div>
|
|
349
|
+
|
|
350
|
+
<div className="shrink-0">
|
|
351
|
+
<Account
|
|
352
|
+
collapsed={isSidebarCollapsed}
|
|
353
|
+
sidebarHovered={sidebarHovered}
|
|
354
|
+
presentation={presentation}
|
|
355
|
+
onToggleCollapsed={
|
|
356
|
+
presentation ? undefined : () => setIsCollapsed((value) => !value)
|
|
357
|
+
}
|
|
358
|
+
/>
|
|
359
|
+
</div>
|
|
360
|
+
</div>
|
|
361
|
+
</aside>
|
|
362
|
+
);
|
|
363
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { Tooltip } from "../../primitives";
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
|
+
import { sidebarLinkActive, sidebarLinkIdle, sidebarRowClass, sidebarRowInteractiveHover, sidebarSectionAnchorClass } from "./sidebar-styles";
|
|
5
|
+
|
|
6
|
+
export type SidebarActionProps = {
|
|
7
|
+
label: string;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
active?: boolean;
|
|
11
|
+
collapsed?: boolean;
|
|
12
|
+
tooltip?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const SidebarAction = ({
|
|
17
|
+
label,
|
|
18
|
+
icon,
|
|
19
|
+
onClick,
|
|
20
|
+
active = false,
|
|
21
|
+
collapsed = false,
|
|
22
|
+
tooltip,
|
|
23
|
+
className,
|
|
24
|
+
}: SidebarActionProps) => {
|
|
25
|
+
const row = (
|
|
26
|
+
<div
|
|
27
|
+
className={sidebarRowClass(
|
|
28
|
+
cn(
|
|
29
|
+
active ? sidebarLinkActive : sidebarLinkIdle,
|
|
30
|
+
!active && sidebarRowInteractiveHover,
|
|
31
|
+
className,
|
|
32
|
+
),
|
|
33
|
+
)}
|
|
34
|
+
data-active={active}
|
|
35
|
+
data-collapsed={collapsed}
|
|
36
|
+
>
|
|
37
|
+
<button
|
|
38
|
+
type="button"
|
|
39
|
+
className={sidebarSectionAnchorClass(collapsed ? "justify-center" : undefined)}
|
|
40
|
+
onClick={onClick}
|
|
41
|
+
>
|
|
42
|
+
{icon && <span className="shrink-0 [&>svg]:size-5">{icon}</span>}
|
|
43
|
+
{!collapsed && <span className="truncate">{label}</span>}
|
|
44
|
+
</button>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
if (!collapsed || !tooltip) return row;
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Tooltip content={tooltip ?? label} side="right" className="w-full">
|
|
52
|
+
{row}
|
|
53
|
+
</Tooltip>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { type MouseEvent, type ReactNode, useState } from "react";
|
|
2
|
+
import { DropdownMenu, DropdownMenuItem, IconButton } from "../../primitives";
|
|
3
|
+
import { MoreIcon } from "../../icons";
|
|
4
|
+
import { cn } from "../../utils/cn";
|
|
5
|
+
import {
|
|
6
|
+
sidebarAnchorClass,
|
|
7
|
+
sidebarEntryHover,
|
|
8
|
+
sidebarEntryIdle,
|
|
9
|
+
sidebarEntrySelected,
|
|
10
|
+
sidebarEntryShell,
|
|
11
|
+
sidebarQuaternaryIconButton,
|
|
12
|
+
sidebarRowInteractiveHover,
|
|
13
|
+
} from "./sidebar-styles";
|
|
14
|
+
|
|
15
|
+
export type SidebarEntryMenuItem = {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
destructive?: boolean;
|
|
20
|
+
onSelect: () => void;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type SidebarEntryState = "idle" | "hover" | "selected";
|
|
24
|
+
|
|
25
|
+
export type SidebarEntryProps = {
|
|
26
|
+
href: string;
|
|
27
|
+
label: string;
|
|
28
|
+
state?: SidebarEntryState;
|
|
29
|
+
icon?: ReactNode;
|
|
30
|
+
badge?: ReactNode;
|
|
31
|
+
menuItems?: SidebarEntryMenuItem[];
|
|
32
|
+
forceMenuVisible?: boolean;
|
|
33
|
+
className?: string;
|
|
34
|
+
onNavigate?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const stateStyles: Record<SidebarEntryState, string> = {
|
|
38
|
+
idle: sidebarEntryIdle,
|
|
39
|
+
hover: sidebarEntryHover,
|
|
40
|
+
selected: sidebarEntrySelected,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const SidebarEntry = ({
|
|
44
|
+
href,
|
|
45
|
+
label,
|
|
46
|
+
state = "idle",
|
|
47
|
+
icon,
|
|
48
|
+
badge,
|
|
49
|
+
menuItems,
|
|
50
|
+
forceMenuVisible = false,
|
|
51
|
+
className,
|
|
52
|
+
onNavigate,
|
|
53
|
+
}: SidebarEntryProps) => {
|
|
54
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
55
|
+
const showMenu = Boolean(menuItems?.length);
|
|
56
|
+
const menuVisible = forceMenuVisible || menuOpen;
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div
|
|
60
|
+
className={cn(
|
|
61
|
+
"group/row relative w-full",
|
|
62
|
+
sidebarEntryShell,
|
|
63
|
+
stateStyles[state],
|
|
64
|
+
state === "idle" && sidebarRowInteractiveHover,
|
|
65
|
+
className,
|
|
66
|
+
)}
|
|
67
|
+
data-state={state}
|
|
68
|
+
>
|
|
69
|
+
<a
|
|
70
|
+
href={href}
|
|
71
|
+
className={sidebarAnchorClass("gap-1")}
|
|
72
|
+
aria-current={state === "selected" ? "true" : undefined}
|
|
73
|
+
onClick={onNavigate}
|
|
74
|
+
>
|
|
75
|
+
{icon && <span className="shrink-0 px-1 py-0.5 [&>svg]:size-4">{icon}</span>}
|
|
76
|
+
<span className="truncate">{label}</span>
|
|
77
|
+
</a>
|
|
78
|
+
|
|
79
|
+
{badge && !(showMenu && menuVisible) && (
|
|
80
|
+
<span
|
|
81
|
+
className={cn("shrink-0", showMenu && !forceMenuVisible && "group-hover/row:hidden")}
|
|
82
|
+
>
|
|
83
|
+
{badge}
|
|
84
|
+
</span>
|
|
85
|
+
)}
|
|
86
|
+
|
|
87
|
+
{showMenu && (
|
|
88
|
+
<DropdownMenu
|
|
89
|
+
open={menuOpen}
|
|
90
|
+
onOpenChange={setMenuOpen}
|
|
91
|
+
align="end"
|
|
92
|
+
trigger={
|
|
93
|
+
<IconButton
|
|
94
|
+
hierarchy="quaternary"
|
|
95
|
+
size="small"
|
|
96
|
+
aria-label={`Actions for ${label}`}
|
|
97
|
+
aria-haspopup="menu"
|
|
98
|
+
aria-expanded={menuOpen}
|
|
99
|
+
className={cn(
|
|
100
|
+
"size-6 min-h-6 shrink-0 p-1",
|
|
101
|
+
sidebarQuaternaryIconButton,
|
|
102
|
+
!forceMenuVisible && !menuOpen && "hidden group-hover/row:inline-flex",
|
|
103
|
+
(forceMenuVisible || menuOpen) && "inline-flex",
|
|
104
|
+
)}
|
|
105
|
+
>
|
|
106
|
+
<MoreIcon size="small" />
|
|
107
|
+
</IconButton>
|
|
108
|
+
}
|
|
109
|
+
>
|
|
110
|
+
{menuItems?.map((item) => (
|
|
111
|
+
<DropdownMenuItem
|
|
112
|
+
key={item.id}
|
|
113
|
+
className={cn(item.destructive && "text-red-500 hover:bg-red-50 hover:text-red-700")}
|
|
114
|
+
onSelect={() => item.onSelect()}
|
|
115
|
+
>
|
|
116
|
+
{item.icon && <span className="shrink-0 [&>svg]:size-4">{item.icon}</span>}
|
|
117
|
+
{item.label}
|
|
118
|
+
</DropdownMenuItem>
|
|
119
|
+
))}
|
|
120
|
+
</DropdownMenu>
|
|
121
|
+
)}
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/** @deprecated Use SidebarEntry */
|
|
127
|
+
export const Entry = SidebarEntry;
|
|
128
|
+
export type EntryProps = SidebarEntryProps;
|
|
129
|
+
export type EntryState = SidebarEntryState;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ChevronIcon } from "../../icons";
|
|
2
|
+
import { cn } from "../../utils/cn";
|
|
3
|
+
import { sidebarRowInteractiveHover, sidebarSurfaceHover } from "./sidebar-styles";
|
|
4
|
+
|
|
5
|
+
export type SidebarHeadingProps = {
|
|
6
|
+
title: string;
|
|
7
|
+
/** Figma Collapsed=On — section label with trailing chevron */
|
|
8
|
+
collapsed?: boolean;
|
|
9
|
+
state?: "idle" | "hover";
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const SidebarHeading = ({
|
|
14
|
+
title,
|
|
15
|
+
collapsed = false,
|
|
16
|
+
state = "idle",
|
|
17
|
+
className,
|
|
18
|
+
}: SidebarHeadingProps) => (
|
|
19
|
+
<div
|
|
20
|
+
className={cn(
|
|
21
|
+
"flex w-full items-center justify-between rounded-control px-2 py-1",
|
|
22
|
+
state === "hover" && sidebarSurfaceHover,
|
|
23
|
+
state === "idle" && sidebarRowInteractiveHover,
|
|
24
|
+
className,
|
|
25
|
+
)}
|
|
26
|
+
data-collapsed={collapsed}
|
|
27
|
+
data-state={state}
|
|
28
|
+
>
|
|
29
|
+
<span className="truncate text-caption-2 text-display-on-light-secondary">{title}</span>
|
|
30
|
+
{collapsed && (
|
|
31
|
+
<ChevronIcon direction="right" className="size-4 shrink-0 text-display-on-light-primary" />
|
|
32
|
+
)}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
/** @deprecated Use SidebarHeading */
|
|
37
|
+
export const Heading = SidebarHeading;
|
|
38
|
+
export type HeadingProps = SidebarHeadingProps;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type MouseEvent, type ReactNode } from "react";
|
|
2
|
+
import { Tooltip } from "../../primitives";
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
|
+
import {
|
|
5
|
+
sidebarLinkActive,
|
|
6
|
+
sidebarLinkHover,
|
|
7
|
+
sidebarLinkIdle,
|
|
8
|
+
sidebarRowInteractiveHover,
|
|
9
|
+
sidebarSectionContent,
|
|
10
|
+
sidebarSectionIconClass,
|
|
11
|
+
sidebarSectionLabelClass,
|
|
12
|
+
sidebarSectionShell,
|
|
13
|
+
sidebarSectionShellCollapsed,
|
|
14
|
+
sidebarSectionShellTall,
|
|
15
|
+
sidebarUnreadDot,
|
|
16
|
+
sidebarUnreadOverlay,
|
|
17
|
+
} from "./sidebar-styles";
|
|
18
|
+
|
|
19
|
+
export type SidebarLinkState = "idle" | "hover" | "active";
|
|
20
|
+
|
|
21
|
+
export type SidebarLinkProps = {
|
|
22
|
+
href: string;
|
|
23
|
+
label: string;
|
|
24
|
+
icon?: ReactNode;
|
|
25
|
+
state?: SidebarLinkState;
|
|
26
|
+
collapsed?: boolean;
|
|
27
|
+
tall?: boolean;
|
|
28
|
+
badge?: ReactNode;
|
|
29
|
+
trailing?: ReactNode;
|
|
30
|
+
tooltip?: string;
|
|
31
|
+
presentation?: boolean;
|
|
32
|
+
unread?: boolean;
|
|
33
|
+
className?: string;
|
|
34
|
+
onNavigate?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const stateStyles: Record<SidebarLinkState, string> = {
|
|
38
|
+
idle: sidebarLinkIdle,
|
|
39
|
+
hover: sidebarLinkHover,
|
|
40
|
+
active: sidebarLinkActive,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const SidebarLink = ({
|
|
44
|
+
href,
|
|
45
|
+
label,
|
|
46
|
+
icon,
|
|
47
|
+
state = "idle",
|
|
48
|
+
collapsed = false,
|
|
49
|
+
tall = false,
|
|
50
|
+
badge,
|
|
51
|
+
trailing,
|
|
52
|
+
tooltip,
|
|
53
|
+
presentation = false,
|
|
54
|
+
unread = false,
|
|
55
|
+
className,
|
|
56
|
+
onNavigate,
|
|
57
|
+
}: SidebarLinkProps) => {
|
|
58
|
+
const row = collapsed ? (
|
|
59
|
+
<div
|
|
60
|
+
className={cn(
|
|
61
|
+
sidebarSectionShellCollapsed,
|
|
62
|
+
stateStyles[state],
|
|
63
|
+
state === "idle" && sidebarRowInteractiveHover,
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
data-state={state}
|
|
67
|
+
data-collapsed={collapsed}
|
|
68
|
+
>
|
|
69
|
+
<a
|
|
70
|
+
href={href}
|
|
71
|
+
className="flex w-full items-center justify-center"
|
|
72
|
+
aria-current={state === "active" ? "page" : undefined}
|
|
73
|
+
aria-label={label}
|
|
74
|
+
onClick={onNavigate}
|
|
75
|
+
>
|
|
76
|
+
<span className="relative inline-flex shrink-0 items-center">
|
|
77
|
+
{icon && <span className={sidebarSectionIconClass}>{icon}</span>}
|
|
78
|
+
{unread && (
|
|
79
|
+
<span aria-hidden className={sidebarUnreadOverlay}>
|
|
80
|
+
<span className={sidebarUnreadDot} />
|
|
81
|
+
</span>
|
|
82
|
+
)}
|
|
83
|
+
</span>
|
|
84
|
+
</a>
|
|
85
|
+
</div>
|
|
86
|
+
) : (
|
|
87
|
+
<div
|
|
88
|
+
className={cn(
|
|
89
|
+
tall ? sidebarSectionShellTall : sidebarSectionShell,
|
|
90
|
+
stateStyles[state],
|
|
91
|
+
state === "idle" && sidebarRowInteractiveHover,
|
|
92
|
+
className,
|
|
93
|
+
)}
|
|
94
|
+
data-state={state}
|
|
95
|
+
data-collapsed={collapsed}
|
|
96
|
+
>
|
|
97
|
+
<div className={sidebarSectionContent}>
|
|
98
|
+
<a
|
|
99
|
+
href={href}
|
|
100
|
+
className="flex min-w-0 flex-1 items-center gap-2 truncate text-left"
|
|
101
|
+
aria-current={state === "active" ? "page" : undefined}
|
|
102
|
+
onClick={onNavigate}
|
|
103
|
+
>
|
|
104
|
+
{icon && <span className={sidebarSectionIconClass}>{icon}</span>}
|
|
105
|
+
<span className={sidebarSectionLabelClass}>{label}</span>
|
|
106
|
+
{badge}
|
|
107
|
+
</a>
|
|
108
|
+
{trailing}
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
if (presentation || !collapsed || !tooltip) return row;
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<Tooltip content={tooltip ?? label} side="right" className="w-full">
|
|
117
|
+
{row}
|
|
118
|
+
</Tooltip>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/** @deprecated Use SidebarLink */
|
|
123
|
+
export const Section = SidebarLink;
|
|
124
|
+
export type SectionProps = SidebarLinkProps;
|
|
125
|
+
export type SectionState = SidebarLinkState;
|