@lateralus-ai/shipping-ui 1.4.15 → 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
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import { Dialog, DialogBody } from "@material-tailwind/react";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { useHotkeys } from "react-hotkeys-hook";
|
|
4
|
-
import { useMediaQuery } from "@uidotdev/usehooks";
|
|
5
|
-
import { cn } from "../utils/cn";
|
|
6
|
-
|
|
7
|
-
export const formatDateReport = (date: string | Date) => {
|
|
8
|
-
const formattedDate = new Date(date);
|
|
9
|
-
return formattedDate.toLocaleDateString("en-US", {
|
|
10
|
-
month: "long",
|
|
11
|
-
day: "numeric",
|
|
12
|
-
year: "numeric",
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const highlightText = (text: string, searchTerm: string) => {
|
|
17
|
-
if (!searchTerm) return text;
|
|
18
|
-
|
|
19
|
-
const regex = new RegExp(`(\\b${searchTerm}\\b)`, "gi");
|
|
20
|
-
const parts = text.split(regex);
|
|
21
|
-
const firstMatchIndex = parts.findIndex((part) => regex.test(part));
|
|
22
|
-
|
|
23
|
-
if (firstMatchIndex === -1) return text;
|
|
24
|
-
|
|
25
|
-
if (firstMatchIndex === 0) {
|
|
26
|
-
return parts.map((part, i) =>
|
|
27
|
-
regex.test(part) ? (
|
|
28
|
-
<span key={i} className="text-gray-900 font-medium">
|
|
29
|
-
{part}
|
|
30
|
-
</span>
|
|
31
|
-
) : (
|
|
32
|
-
part
|
|
33
|
-
),
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const matchedPart = parts[firstMatchIndex];
|
|
38
|
-
const beforeMatch = parts.slice(0, firstMatchIndex).join("");
|
|
39
|
-
const afterMatch = parts.slice(firstMatchIndex + 1).join("");
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<>
|
|
43
|
-
<span key="match" className="text-gray-900 font-medium">
|
|
44
|
-
{beforeMatch && <>...</>}
|
|
45
|
-
{matchedPart}
|
|
46
|
-
</span>
|
|
47
|
-
{afterMatch && <span key="after"> {afterMatch}</span>}
|
|
48
|
-
</>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export interface SearchItem {
|
|
53
|
-
id: string;
|
|
54
|
-
title: string;
|
|
55
|
-
subtitle?: string;
|
|
56
|
-
icon?: React.ReactNode;
|
|
57
|
-
metadata?: Record<string, any>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface SearchModalProps {
|
|
61
|
-
open: boolean;
|
|
62
|
-
onClose: () => void;
|
|
63
|
-
items?: SearchItem[];
|
|
64
|
-
loading?: boolean;
|
|
65
|
-
placeholder?: string;
|
|
66
|
-
onSearch?: (query: string) => void;
|
|
67
|
-
onSelect?: (item: SearchItem) => void;
|
|
68
|
-
filterOptions?: string[];
|
|
69
|
-
selectedFilter?: string;
|
|
70
|
-
onFilterChange?: (filter: string) => void;
|
|
71
|
-
recentlyViewedLabel?: string;
|
|
72
|
-
noResultsText?: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const SearchFilters = ({
|
|
76
|
-
filters,
|
|
77
|
-
selected,
|
|
78
|
-
onChange,
|
|
79
|
-
}: {
|
|
80
|
-
filters: string[];
|
|
81
|
-
selected: string;
|
|
82
|
-
onChange: (filter: string) => void;
|
|
83
|
-
}) => {
|
|
84
|
-
return (
|
|
85
|
-
<div className="flex gap-2 px-2">
|
|
86
|
-
{filters.map((filter) => (
|
|
87
|
-
<button
|
|
88
|
-
key={filter}
|
|
89
|
-
onClick={() => onChange(filter)}
|
|
90
|
-
className={cn(
|
|
91
|
-
"px-3 py-1 text-sm rounded-full transition-colors",
|
|
92
|
-
selected === filter
|
|
93
|
-
? "bg-brand-600 text-white"
|
|
94
|
-
: "bg-gray-100 text-gray-600 hover:bg-gray-200",
|
|
95
|
-
)}
|
|
96
|
-
>
|
|
97
|
-
{filter}
|
|
98
|
-
</button>
|
|
99
|
-
))}
|
|
100
|
-
</div>
|
|
101
|
-
);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const SearchSkeleton = () => {
|
|
105
|
-
return (
|
|
106
|
-
<div className="p-4 flex flex-col gap-[6px]">
|
|
107
|
-
{[...Array(8)].map((_, i) => (
|
|
108
|
-
<div key={i} className="flex items-center gap-3 animate-pulse py-2">
|
|
109
|
-
<div className="size-3 bg-gray-100 rounded-full" />
|
|
110
|
-
<div className={cn(i % 2 === 0 ? "w-[250px]" : "w-[320px]","h-3 bg-gray-100 rounded-full")} />
|
|
111
|
-
</div>
|
|
112
|
-
))}
|
|
113
|
-
</div>
|
|
114
|
-
);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const SearchItemComponent = ({
|
|
118
|
-
item,
|
|
119
|
-
isActive,
|
|
120
|
-
onClick,
|
|
121
|
-
searchTerm,
|
|
122
|
-
}: {
|
|
123
|
-
item: SearchItem;
|
|
124
|
-
isActive: boolean;
|
|
125
|
-
onClick: () => void;
|
|
126
|
-
searchTerm: string;
|
|
127
|
-
}) => {
|
|
128
|
-
return (
|
|
129
|
-
<div
|
|
130
|
-
onClick={onClick}
|
|
131
|
-
className={cn(
|
|
132
|
-
"flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-colors",
|
|
133
|
-
isActive ? "bg-gray-100" : "hover:bg-gray-50",
|
|
134
|
-
)}
|
|
135
|
-
>
|
|
136
|
-
{item.icon && <div className="shrink-0 text-gray-600">{item.icon}</div>}
|
|
137
|
-
<div className="flex-1 min-w-0">
|
|
138
|
-
<div className="text-sm font-medium text-gray-900 truncate">
|
|
139
|
-
{item.title}
|
|
140
|
-
</div>
|
|
141
|
-
{item.subtitle && (
|
|
142
|
-
<div className="text-sm text-gray-600 truncate">
|
|
143
|
-
{typeof item.subtitle === "string"
|
|
144
|
-
? highlightText(item.subtitle, searchTerm)
|
|
145
|
-
: item.subtitle}
|
|
146
|
-
</div>
|
|
147
|
-
)}
|
|
148
|
-
</div>
|
|
149
|
-
</div>
|
|
150
|
-
);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const SearchModal = ({
|
|
154
|
-
open,
|
|
155
|
-
onClose,
|
|
156
|
-
items = [],
|
|
157
|
-
loading = false,
|
|
158
|
-
placeholder = "Search...",
|
|
159
|
-
onSearch,
|
|
160
|
-
onSelect,
|
|
161
|
-
filterOptions = [],
|
|
162
|
-
selectedFilter = "All",
|
|
163
|
-
onFilterChange,
|
|
164
|
-
recentlyViewedLabel = "Recently viewed",
|
|
165
|
-
noResultsText = "No results found.",
|
|
166
|
-
}: SearchModalProps) => {
|
|
167
|
-
const [searchValue, setSearchValue] = useState("");
|
|
168
|
-
const [activeIndex, setActiveIndex] = useState(-1);
|
|
169
|
-
const isMobile = useMediaQuery("only screen and (max-width: 768px)");
|
|
170
|
-
const itemRefs = useRef<HTMLDivElement[]>([]);
|
|
171
|
-
|
|
172
|
-
useEffect(() => {
|
|
173
|
-
itemRefs.current = itemRefs.current.slice(0, items.length);
|
|
174
|
-
}, [items]);
|
|
175
|
-
|
|
176
|
-
useEffect(() => {
|
|
177
|
-
if (activeIndex > items.length) {
|
|
178
|
-
setActiveIndex(-1);
|
|
179
|
-
}
|
|
180
|
-
}, [items, activeIndex]);
|
|
181
|
-
|
|
182
|
-
useEffect(() => {
|
|
183
|
-
const currentItem = itemRefs.current[activeIndex];
|
|
184
|
-
currentItem?.scrollIntoView({
|
|
185
|
-
behavior: "smooth",
|
|
186
|
-
block: "nearest",
|
|
187
|
-
});
|
|
188
|
-
}, [activeIndex]);
|
|
189
|
-
|
|
190
|
-
useHotkeys(
|
|
191
|
-
"ArrowUp",
|
|
192
|
-
() => {
|
|
193
|
-
if (items.length === 0) return;
|
|
194
|
-
setActiveIndex((prev) => (prev <= 0 ? items.length - 1 : prev - 1));
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
preventDefault: true,
|
|
198
|
-
enableOnFormTags: true,
|
|
199
|
-
enabled: open,
|
|
200
|
-
},
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
useHotkeys(
|
|
204
|
-
"ArrowDown",
|
|
205
|
-
() => {
|
|
206
|
-
if (items.length === 0) return;
|
|
207
|
-
setActiveIndex((prev) => (prev >= items.length - 1 ? 0 : prev + 1));
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
preventDefault: true,
|
|
211
|
-
enableOnFormTags: true,
|
|
212
|
-
enabled: open,
|
|
213
|
-
},
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
useHotkeys(
|
|
217
|
-
"Enter",
|
|
218
|
-
() => {
|
|
219
|
-
if (activeIndex >= 0 && activeIndex < items.length) {
|
|
220
|
-
handleItemSelect(items[activeIndex]);
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
enableOnFormTags: true,
|
|
225
|
-
preventDefault: true,
|
|
226
|
-
enabled: open,
|
|
227
|
-
},
|
|
228
|
-
);
|
|
229
|
-
|
|
230
|
-
const handleSearchChange = (value: string) => {
|
|
231
|
-
setSearchValue(value);
|
|
232
|
-
onSearch?.(value);
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
const handleItemSelect = (item: SearchItem) => {
|
|
236
|
-
onSelect?.(item);
|
|
237
|
-
handleClose();
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
const handleClose = () => {
|
|
241
|
-
setSearchValue("");
|
|
242
|
-
setActiveIndex(-1);
|
|
243
|
-
onClose();
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
const showFilters = filterOptions.length > 0 && searchValue;
|
|
247
|
-
const showRecentlyViewed = !searchValue && items.length > 0;
|
|
248
|
-
|
|
249
|
-
return (
|
|
250
|
-
<Dialog
|
|
251
|
-
open={open}
|
|
252
|
-
size="lg"
|
|
253
|
-
handler={handleClose}
|
|
254
|
-
className={cn(
|
|
255
|
-
isMobile && "w-screen m-0",
|
|
256
|
-
"focus:outline-none 2xl:min-w-px",
|
|
257
|
-
)}
|
|
258
|
-
>
|
|
259
|
-
<DialogBody className="relative px-0 py-2">
|
|
260
|
-
<div>
|
|
261
|
-
<div className="border-b border-b-gray-100 px-6 pb-2">
|
|
262
|
-
<input
|
|
263
|
-
type="text"
|
|
264
|
-
placeholder={placeholder}
|
|
265
|
-
value={searchValue}
|
|
266
|
-
onChange={(e) => handleSearchChange(e.target.value)}
|
|
267
|
-
className="w-full bg-transparent p-2 px-0 text-sm font-medium text-gray-600 placeholder-gray-400 outline-none focus:outline-none"
|
|
268
|
-
/>
|
|
269
|
-
</div>
|
|
270
|
-
|
|
271
|
-
{loading ? (
|
|
272
|
-
<SearchSkeleton />
|
|
273
|
-
) : (
|
|
274
|
-
<div className="p-4 flex flex-col gap-2">
|
|
275
|
-
{showRecentlyViewed && (
|
|
276
|
-
<p className="text-sm font-normal text-gray-600 px-2">
|
|
277
|
-
{recentlyViewedLabel}
|
|
278
|
-
</p>
|
|
279
|
-
)}
|
|
280
|
-
|
|
281
|
-
{showFilters && (
|
|
282
|
-
<SearchFilters
|
|
283
|
-
filters={filterOptions}
|
|
284
|
-
selected={selectedFilter}
|
|
285
|
-
onChange={(filter) => onFilterChange?.(filter)}
|
|
286
|
-
/>
|
|
287
|
-
)}
|
|
288
|
-
|
|
289
|
-
<div className="overflow-y-auto max-h-[320px]" tabIndex={0}>
|
|
290
|
-
{items.map((item, index) => (
|
|
291
|
-
<div
|
|
292
|
-
key={item.id}
|
|
293
|
-
ref={(el) => {
|
|
294
|
-
if (el) itemRefs.current[index] = el;
|
|
295
|
-
}}
|
|
296
|
-
>
|
|
297
|
-
<SearchItemComponent
|
|
298
|
-
item={item}
|
|
299
|
-
isActive={activeIndex === index}
|
|
300
|
-
onClick={() => handleItemSelect(item)}
|
|
301
|
-
searchTerm={searchValue}
|
|
302
|
-
/>
|
|
303
|
-
</div>
|
|
304
|
-
))}
|
|
305
|
-
|
|
306
|
-
{!loading && items.length === 0 && (
|
|
307
|
-
<div className="text-sm text-gray-900 font-medium">
|
|
308
|
-
{noResultsText}
|
|
309
|
-
</div>
|
|
310
|
-
)}
|
|
311
|
-
</div>
|
|
312
|
-
</div>
|
|
313
|
-
)}
|
|
314
|
-
</div>
|
|
315
|
-
</DialogBody>
|
|
316
|
-
</Dialog>
|
|
317
|
-
);
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
export default SearchModal;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useContext, type ReactNode } from "react";
|
|
2
|
-
import { collapsedContext } from "./Provider";
|
|
3
|
-
|
|
4
|
-
interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
icon?: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const Button = ({ icon, children, ...props }: ButtonProps) => {
|
|
10
|
-
const { isCollapsed, isHovered } = useContext(collapsedContext)!;
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<button
|
|
14
|
-
className="flex items-center gap-2 w-full hover:bg-gray-100 text-caption-1-em text-gray-600 hover:text-gray-900 h-[38px] rounded-lg px-2"
|
|
15
|
-
{...props}
|
|
16
|
-
>
|
|
17
|
-
{icon} {(!isCollapsed || isHovered) && children}
|
|
18
|
-
</button>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useContext, type ReactNode } from "react"
|
|
2
|
-
import { cn } from "../../utils/cn"
|
|
3
|
-
import { collapsedContext } from "./Provider"
|
|
4
|
-
|
|
5
|
-
export interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
children?: ReactNode
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const Container = ({
|
|
10
|
-
className,
|
|
11
|
-
children,
|
|
12
|
-
...props
|
|
13
|
-
}: ContainerProps) => {
|
|
14
|
-
const { isCollapsed, isHovered, setIsHovered } = useContext(collapsedContext)!
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div
|
|
18
|
-
className={cn(
|
|
19
|
-
className,
|
|
20
|
-
isCollapsed && "shadow-lg rounded-lg",
|
|
21
|
-
isCollapsed && !isHovered ? "w-auto" : "w-[280px]",
|
|
22
|
-
"bg-gray-50 p-2 flex flex-col justify-between items-center rounded-tr-lg rounded-br-lg"
|
|
23
|
-
)}
|
|
24
|
-
onMouseEnter={() => isCollapsed && setIsHovered(true)}
|
|
25
|
-
onMouseLeave={() => isCollapsed && setIsHovered(false)}
|
|
26
|
-
{...props}
|
|
27
|
-
>
|
|
28
|
-
{children}
|
|
29
|
-
</div>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useContext, type ReactNode } from "react";
|
|
2
|
-
import { cn } from "../../utils/cn";
|
|
3
|
-
import { collapsedContext } from "./Provider";
|
|
4
|
-
|
|
5
|
-
interface ItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
children?: ReactNode;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
isActive?: boolean;
|
|
9
|
-
trailing?: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const Item = ({
|
|
13
|
-
children,
|
|
14
|
-
className,
|
|
15
|
-
icon,
|
|
16
|
-
isActive,
|
|
17
|
-
trailing,
|
|
18
|
-
...props
|
|
19
|
-
}: ItemProps) => {
|
|
20
|
-
const { isCollapsed, isHovered } = useContext(collapsedContext)!;
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div
|
|
24
|
-
className={cn(
|
|
25
|
-
isActive ? "!text-gray-900" : "!text-gray-600",
|
|
26
|
-
"flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg px-2 cursor-pointer group",
|
|
27
|
-
className,
|
|
28
|
-
)}
|
|
29
|
-
{...props}
|
|
30
|
-
>
|
|
31
|
-
<div className="flex items-center gap-2">
|
|
32
|
-
{icon}
|
|
33
|
-
{(!isCollapsed || isHovered) && children}
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
{(!isCollapsed || isHovered) && trailing}
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Provider } from "./Provider"
|
|
2
|
-
import { Container, type ContainerProps } from "./Container"
|
|
3
|
-
import { ReactNode } from "react"
|
|
4
|
-
import { SideContainer } from "./SideContainer"
|
|
5
|
-
|
|
6
|
-
interface LayoutProps extends ContainerProps {
|
|
7
|
-
isCollapsed?: boolean
|
|
8
|
-
sideContainer?: ReactNode
|
|
9
|
-
sideClassName?: string
|
|
10
|
-
onSwitchLayout?: (isCollapsed: boolean) => void
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const Layout = ({
|
|
14
|
-
className,
|
|
15
|
-
children,
|
|
16
|
-
isCollapsed,
|
|
17
|
-
sideContainer,
|
|
18
|
-
sideClassName,
|
|
19
|
-
onSwitchLayout,
|
|
20
|
-
...props
|
|
21
|
-
}: LayoutProps) => {
|
|
22
|
-
return (
|
|
23
|
-
<Provider isCollapsed={isCollapsed} onSwitchLayout={onSwitchLayout}>
|
|
24
|
-
{sideContainer && (
|
|
25
|
-
<SideContainer className={sideClassName}>{sideContainer}</SideContainer>
|
|
26
|
-
)}
|
|
27
|
-
<Container className={className} {...props}>
|
|
28
|
-
{children}
|
|
29
|
-
</Container>
|
|
30
|
-
</Provider>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { createContext, useState, type ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
export const collapsedContext = createContext<
|
|
4
|
-
| {
|
|
5
|
-
isCollapsed: boolean;
|
|
6
|
-
toggleCollapsed: () => void;
|
|
7
|
-
isHovered: boolean;
|
|
8
|
-
setIsHovered: (value: boolean) => void;
|
|
9
|
-
}
|
|
10
|
-
| undefined
|
|
11
|
-
>(undefined);
|
|
12
|
-
|
|
13
|
-
interface ProviderProps {
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
isCollapsed?: boolean;
|
|
16
|
-
onSwitchLayout?: (isCollapsed: boolean) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const Provider = ({
|
|
20
|
-
children,
|
|
21
|
-
isCollapsed: controlledIsCollapsed,
|
|
22
|
-
onSwitchLayout,
|
|
23
|
-
}: ProviderProps) => {
|
|
24
|
-
const [internalIsCollapsed, setInternalIsCollapsed] = useState(false);
|
|
25
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
26
|
-
|
|
27
|
-
const isCollapsed =
|
|
28
|
-
controlledIsCollapsed !== undefined
|
|
29
|
-
? controlledIsCollapsed
|
|
30
|
-
: internalIsCollapsed;
|
|
31
|
-
|
|
32
|
-
const toggleCollapsed = (value?: boolean) => {
|
|
33
|
-
const newValue = value ?? !isCollapsed;
|
|
34
|
-
if (controlledIsCollapsed === undefined) {
|
|
35
|
-
setInternalIsCollapsed(newValue);
|
|
36
|
-
}
|
|
37
|
-
onSwitchLayout?.(newValue);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<collapsedContext.Provider
|
|
42
|
-
value={{ isCollapsed, toggleCollapsed, isHovered, setIsHovered }}
|
|
43
|
-
>
|
|
44
|
-
{children}
|
|
45
|
-
</collapsedContext.Provider>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useContext, type ReactNode } from "react";
|
|
2
|
-
import { cn } from "../../utils/cn";
|
|
3
|
-
import { collapsedContext } from "./Provider";
|
|
4
|
-
|
|
5
|
-
interface SecondaryItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
children?: ReactNode;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
isActive?: boolean;
|
|
9
|
-
trailing?: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const SecondaryItem = ({
|
|
13
|
-
children,
|
|
14
|
-
className,
|
|
15
|
-
isActive,
|
|
16
|
-
trailing,
|
|
17
|
-
icon,
|
|
18
|
-
...props
|
|
19
|
-
}: SecondaryItemProps) => {
|
|
20
|
-
const { isCollapsed, isHovered } = useContext(collapsedContext)!;
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div
|
|
24
|
-
className={cn(
|
|
25
|
-
isActive ? "!text-gray-900" : "!text-gray-600",
|
|
26
|
-
"flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg pr-2 pl-3 cursor-pointer group text-sm",
|
|
27
|
-
className,
|
|
28
|
-
)}
|
|
29
|
-
{...props}
|
|
30
|
-
>
|
|
31
|
-
<div className="flex items-center gap-2 overflow-auto">
|
|
32
|
-
{(!isCollapsed || isHovered) && icon}{" "}
|
|
33
|
-
{(!isCollapsed || isHovered) && children}
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
{(!isCollapsed || isHovered) && trailing}
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { useContext, type ReactNode } from "react"
|
|
2
|
-
import { cn } from "../../utils/cn"
|
|
3
|
-
import { collapsedContext } from "./Provider"
|
|
4
|
-
|
|
5
|
-
export interface SideContainerProps
|
|
6
|
-
extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
-
children?: ReactNode
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const SideContainer = ({
|
|
11
|
-
className,
|
|
12
|
-
children,
|
|
13
|
-
...props
|
|
14
|
-
}: SideContainerProps) => {
|
|
15
|
-
const { isCollapsed, setIsHovered } = useContext(collapsedContext)!
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div
|
|
19
|
-
className={cn(
|
|
20
|
-
className,
|
|
21
|
-
isCollapsed && "!hidden",
|
|
22
|
-
"p-2 flex flex-col gap-2 items-center rounded-tl-lg rounded-bl-lg w-16"
|
|
23
|
-
)}
|
|
24
|
-
onMouseEnter={() => isCollapsed && setIsHovered(true)}
|
|
25
|
-
onMouseLeave={() => isCollapsed && setIsHovered(false)}
|
|
26
|
-
{...props}
|
|
27
|
-
>
|
|
28
|
-
{children}
|
|
29
|
-
</div>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { IconButton } from "@material-tailwind/react";
|
|
3
|
-
import { collapsedContext } from "./Provider";
|
|
4
|
-
import CloseSidebarIcon from "../icons/CloseSidebarIcon";
|
|
5
|
-
import CloseSidebarMidIcon from "../icons/CloseSidebarMidIcon";
|
|
6
|
-
|
|
7
|
-
export const ToggleCollapseButton = () => {
|
|
8
|
-
const { isCollapsed, isHovered, toggleCollapsed } =
|
|
9
|
-
useContext(collapsedContext)!;
|
|
10
|
-
|
|
11
|
-
if (isCollapsed && !isHovered) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<IconButton variant="text" color="gray" onClick={() => toggleCollapsed()}>
|
|
17
|
-
{isCollapsed ? (
|
|
18
|
-
<CloseSidebarIcon className="size-4" />
|
|
19
|
-
) : (
|
|
20
|
-
<CloseSidebarMidIcon className="size-4" />
|
|
21
|
-
)}
|
|
22
|
-
</IconButton>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { Provider } from "./Provider"
|
|
2
|
-
export { Container } from "./Container"
|
|
3
|
-
export { SideContainer } from "./SideContainer"
|
|
4
|
-
export { Layout } from "./Layout"
|
|
5
|
-
export { Button } from "./Button"
|
|
6
|
-
export { ToggleCollapseButton } from "./ToggleCollapseButton"
|
|
7
|
-
export { Item } from "./Item"
|
|
8
|
-
export { SecondaryItem } from "./SecondaryItem"
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
export default function CloseSidebarIcon(props: React.SVGProps<SVGSVGElement>) {
|
|
4
|
-
return (
|
|
5
|
-
<svg
|
|
6
|
-
width="16"
|
|
7
|
-
height="16"
|
|
8
|
-
viewBox="0 0 16 16"
|
|
9
|
-
fill="none"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
{...props}
|
|
12
|
-
>
|
|
13
|
-
<path
|
|
14
|
-
d="M13 1C14.6569 1 16 2.34315 16 4V12L15.9961 12.1543C15.9158 13.7394 14.6051 15 13 15H3L2.8457 14.9961C1.31166 14.9184 0.0816253 13.6883 0.00390625 12.1543L0 12V4C1.28853e-07 2.34315 1.34315 1 3 1H13ZM3 2.5C2.17157 2.5 1.5 3.17157 1.5 4V12C1.5 12.8284 2.17157 13.5 3 13.5H13C13.8284 13.5 14.5 12.8284 14.5 12V4C14.5 3.17157 13.8284 2.5 13 2.5H3ZM3.75 3.5C4.16421 3.5 4.5 3.83579 4.5 4.25V11.75C4.5 12.1642 4.16421 12.5 3.75 12.5C3.33579 12.5 3 12.1642 3 11.75V4.25C3 3.83579 3.33579 3.5 3.75 3.5Z"
|
|
15
|
-
fill="currentColor"
|
|
16
|
-
/>
|
|
17
|
-
</svg>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export default function CloseSidebarMidIcon(
|
|
2
|
-
props: React.SVGProps<SVGSVGElement>,
|
|
3
|
-
) {
|
|
4
|
-
return (
|
|
5
|
-
<svg
|
|
6
|
-
width="16"
|
|
7
|
-
height="16"
|
|
8
|
-
viewBox="0 0 16 16"
|
|
9
|
-
fill="none"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
{...props}
|
|
12
|
-
>
|
|
13
|
-
<path
|
|
14
|
-
d="M13 1C14.6569 1 16 2.34315 16 4V12L15.9961 12.1543C15.9158 13.7394 14.6051 15 13 15H3L2.8457 14.9961C1.31166 14.9184 0.0816253 13.6883 0.00390625 12.1543L0 12V4C1.28853e-07 2.34315 1.34315 1 3 1H13ZM3 2.5C2.17157 2.5 1.5 3.17157 1.5 4V12C1.5 12.8284 2.17157 13.5 3 13.5H13C13.8284 13.5 14.5 12.8284 14.5 12V4C14.5 3.17157 13.8284 2.5 13 2.5H3ZM7.5 4C7.77614 4 8 4.22386 8 4.5V11.5C8 11.7761 7.77614 12 7.5 12H3.5C3.22386 12 3 11.7761 3 11.5V4.5C3 4.22386 3.22386 4 3.5 4H7.5Z"
|
|
15
|
-
fill="currentColor"
|
|
16
|
-
/>
|
|
17
|
-
</svg>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
const ExpandIcon = (props: React.SVGProps<SVGSVGElement>) => {
|
|
4
|
-
return (
|
|
5
|
-
<svg
|
|
6
|
-
width="16"
|
|
7
|
-
height="16"
|
|
8
|
-
viewBox="0 0 16 16"
|
|
9
|
-
fill="none"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
{...props}
|
|
12
|
-
>
|
|
13
|
-
<path
|
|
14
|
-
d="M2.25 5.5C2.66421 5.5 3 5.83579 3 6.25C3 6.66421 2.66421 7 2.25 7H2C1.72386 7 1.5 7.22386 1.5 7.5V13.5C1.5 13.7761 1.72386 14 2 14H8C8.27614 14 8.5 13.7761 8.5 13.5V13.25C8.5 12.8358 8.83579 12.5 9.25 12.5C9.66421 12.5 10 12.8358 10 13.25V13.5C10 14.5357 9.21278 15.387 8.2041 15.4893L8 15.5H2L1.7959 15.4893C0.854346 15.3938 0.1062 14.6457 0.0107422 13.7041L0 13.5V7.5C0 6.39543 0.895431 5.5 2 5.5H2.25ZM13.75 0C14.7165 1.28853e-07 15.5 0.783502 15.5 1.75V9.75C15.5 10.7165 14.7165 11.5 13.75 11.5H5.75C4.7835 11.5 4 10.7165 4 9.75V1.75C4 0.783502 4.7835 8.0532e-09 5.75 0H13.75ZM5.75 1.5C5.61193 1.5 5.5 1.61193 5.5 1.75V9.75C5.5 9.88807 5.61193 10 5.75 10H13.75C13.8881 10 14 9.88807 14 9.75V1.75C14 1.61193 13.8881 1.5 13.75 1.5H5.75ZM11.75 3C11.795 3 11.839 3.00413 11.8818 3.01172C11.8874 3.0127 11.8929 3.01354 11.8984 3.01465C11.9118 3.01733 11.9244 3.02298 11.9375 3.02637C11.9707 3.03495 12.0041 3.04344 12.0361 3.05664C12.0653 3.06868 12.092 3.08512 12.1191 3.10059C12.1763 3.1331 12.2316 3.171 12.2803 3.21973C12.3287 3.26812 12.366 3.3232 12.3984 3.37988C12.414 3.40703 12.4303 3.43375 12.4424 3.46289C12.4631 3.51289 12.4779 3.56459 12.4873 3.61719C12.495 3.66035 12.5 3.70462 12.5 3.75V7.75C12.5 8.16421 12.1642 8.5 11.75 8.5C11.3358 8.5 11 8.16421 11 7.75V5.56055L8.28027 8.28027C7.98738 8.57317 7.51262 8.57317 7.21973 8.28027C6.92683 7.98738 6.92683 7.51262 7.21973 7.21973L9.93945 4.5H7.75C7.33579 4.5 7 4.16421 7 3.75C7 3.33579 7.33579 3 7.75 3H11.75Z"
|
|
15
|
-
fill="currentColor"
|
|
16
|
-
/>
|
|
17
|
-
</svg>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default ExpandIcon;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export default function SendArrowIcon({ className = "", size = "1em" }) {
|
|
2
|
-
return (
|
|
3
|
-
<svg
|
|
4
|
-
width="24"
|
|
5
|
-
height="25"
|
|
6
|
-
viewBox="0 0 24 25"
|
|
7
|
-
fill="none"
|
|
8
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
-
className={className}
|
|
10
|
-
>
|
|
11
|
-
<path
|
|
12
|
-
d="M12.001 7.7395C12.2367 7.73978 12.4591 7.85076 12.6006 8.03931L15.376 11.7395C15.5459 11.9666 15.5731 12.2708 15.4463 12.5247C15.3193 12.7785 15.0592 12.9395 14.7754 12.9397H12.75V17.2766C12.7499 17.6907 12.4142 18.0266 12 18.0266C11.5858 18.0266 11.2501 17.6907 11.25 17.2766V12.9397H9.22559C8.94169 12.9397 8.68182 12.7785 8.55469 12.5247C8.42778 12.2706 8.45558 11.9667 8.62598 11.7395L11.4004 8.03931L11.457 7.97192C11.5977 7.82422 11.7945 7.7395 12.001 7.7395Z"
|
|
13
|
-
fill="currentColor"
|
|
14
|
-
/>
|
|
15
|
-
<path
|
|
16
|
-
fill-rule="evenodd"
|
|
17
|
-
clip-rule="evenodd"
|
|
18
|
-
d="M12 2.65161C17.5228 2.65161 22 7.12876 22 12.6516C22 18.1744 17.5228 22.6516 12 22.6516C6.47715 22.6516 2 18.1744 2 12.6516C2 7.12876 6.47715 2.65161 12 2.65161ZM12 4.15161C7.30558 4.15161 3.5 7.95719 3.5 12.6516C3.5 17.346 7.30558 21.1516 12 21.1516C16.6944 21.1516 20.5 17.346 20.5 12.6516C20.5 7.95719 16.6944 4.15161 12 4.15161Z"
|
|
19
|
-
fill="currentColor"
|
|
20
|
-
/>
|
|
21
|
-
</svg>
|
|
22
|
-
);
|
|
23
|
-
}
|