moi-computer 0.11.0 → 0.11.1-dev.be1ed10
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 +2 -2
- package/client/AGENTS.md +2 -2
- package/client/app/AppRouter.tsx +2 -2
- package/client/app/routes/WorkspaceRoute.tsx +7 -9
- package/client/app/shell/SidebarLayout.tsx +18 -15
- package/client/components/shared/BottomPanel.tsx +26 -14
- package/client/components/shared/PanelHeader.tsx +1 -1
- package/client/components/shared/ReorderableList.tsx +7 -2
- package/client/components/shared/WorkspaceIcon.tsx +92 -0
- package/client/components/ui/alert-dialog.tsx +1 -0
- package/client/components/ui/button.tsx +1 -53
- package/client/components/ui/checkbox.tsx +1 -0
- package/client/components/ui/collapsible.tsx +1 -15
- package/client/components/ui/dialog.tsx +1 -58
- package/client/components/ui/dropdown-menu.tsx +1 -254
- package/client/components/ui/hover-card.tsx +1 -44
- package/client/components/ui/inline-input.tsx +84 -0
- package/client/components/ui/input.tsx +1 -21
- package/client/components/ui/popover.tsx +1 -88
- package/client/components/ui/resizable.tsx +1 -40
- package/client/components/ui/skeleton.tsx +1 -13
- package/client/components/ui/slider.tsx +1 -70
- package/client/components/ui/spinner.tsx +1 -18
- package/client/components/ui/switch.tsx +1 -23
- package/client/components/ui/tabs.tsx +1 -0
- package/client/components/ui/textarea.tsx +1 -18
- package/client/components/ui/toast.tsx +2 -2
- package/client/components/ui/tooltip.tsx +1 -51
- package/client/features/applets/AppletMount.tsx +1 -1
- package/client/features/applets/applet-cache.ts +3 -3
- package/client/features/applets/applet-runtime.ts +147 -108
- package/client/features/applets/applet-styles.ts +2 -2
- package/client/features/applets/applet-thumbnail.ts +6 -8
- package/client/features/applets/useApplet.ts +10 -9
- package/client/features/chat/ChatPanel.tsx +24 -15
- package/client/features/chat/ChatPopup.tsx +9 -5
- package/client/features/chat/applet-chat-intents.ts +170 -0
- package/client/features/chat/chat-send.ts +116 -64
- package/client/features/chat/chat-store.ts +51 -62
- package/client/features/chat/composer/ChatComposer.tsx +43 -128
- package/client/features/chat/composer/ModelPicker.tsx +47 -60
- package/client/features/chat/composer/attachments/AttachmentChip.tsx +99 -0
- package/client/features/chat/composer/attachments/DrawingAttachmentChip.tsx +37 -0
- package/client/features/chat/composer/attachments/FileAttachmentChip.tsx +22 -0
- package/client/features/chat/composer/attachments/TextAttachmentChip.tsx +11 -0
- package/client/features/chat/composer/attachments/draft-attachments.ts +168 -0
- package/client/features/chat/composer/attachments/types.ts +25 -0
- package/client/features/chat/composer/attachments/uploads.ts +26 -0
- package/client/features/chat/composer/banners/ErrorBanner.tsx +20 -12
- package/client/features/chat/composer/model-order.ts +15 -0
- package/client/features/chat/composer/useWorkspaceComposerState.tsx +15 -7
- package/client/features/chat/{chat-connection.ts → connection/chat-connection.ts} +1 -1
- package/client/features/chat/{chat-frames.ts → connection/chat-frames.ts} +10 -8
- package/client/features/chat/{ChatEmptyState.tsx → messages/ChatEmptyState.tsx} +16 -11
- package/client/features/chat/{MarkdownContent.tsx → messages/MarkdownContent.tsx} +16 -1
- package/client/features/chat/{TurnView.tsx → messages/TurnView.tsx} +27 -19
- package/client/features/chat/{group-turns.ts → messages/group-turns.ts} +12 -0
- package/client/features/chat/{interleave-notices.ts → messages/interleave-notices.ts} +7 -11
- package/client/features/chat/{tool-group → messages/tool-group}/SubagentCard.tsx +1 -1
- package/client/features/chat/{tool-group → messages/tool-group}/TimelineRow.tsx +2 -2
- package/client/features/chat/{tool-group → messages/tool-group}/ToolCallGroup.tsx +2 -5
- package/client/features/chat/{tool-group → messages/tool-group}/format/codex.ts +4 -1
- package/client/features/chat/{ChatSelector.tsx → sessions/ChatSelector.tsx} +3 -3
- package/client/features/chat/{api.ts → sessions/api.ts} +5 -14
- package/client/features/chat/sessions/session-view.ts +53 -0
- package/client/features/chat/useChat.ts +42 -24
- package/client/features/dev/ChatStatesPage.tsx +8 -7
- package/client/features/dev/DevIndexPage.tsx +5 -0
- package/client/features/dev/DevRoutes.tsx +2 -0
- package/client/features/dev/HarnessDebugPage.tsx +11 -8
- package/client/features/dev/ToolCallsPage.tsx +1 -1
- package/client/features/dev/UiComponentPreviews.tsx +855 -0
- package/client/features/dev/UiComponentsPage.tsx +60 -0
- package/client/features/dev/chat-states-fixtures.ts +13 -2
- package/client/features/drawings/useChatAnnotation.ts +17 -17
- package/client/features/drawings/useDrawingLayer.ts +7 -9
- package/client/features/drawings/useViewBuilderSketch.ts +18 -15
- package/client/features/home/HomePage.tsx +8 -7
- package/client/features/home/WorkspacePreview.tsx +2 -2
- package/client/features/home/workspace-presentation.tsx +1 -11
- package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
- package/client/features/home/workspace-setup/WorkspaceAgentStep.tsx +2 -4
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
- package/client/features/overview/HiddenPanel.tsx +109 -0
- package/client/features/overview/Overview.tsx +302 -0
- package/client/features/overview/WidgetCanvas.tsx +164 -0
- package/client/features/{widgets → overview}/WidgetFrame.tsx +25 -17
- package/client/features/overview/WorkspaceName.tsx +60 -0
- package/client/features/overview/api.ts +30 -0
- package/client/features/overview/default/ViewsWidget.tsx +252 -0
- package/client/features/overview/default/registry.tsx +36 -0
- package/client/features/{widgets → overview}/grid.ts +36 -0
- package/client/features/overview/useGridReconcile.ts +94 -0
- package/client/features/scratchpad/Scratchpad.tsx +7 -8
- package/client/features/scratchpad/ScratchpadControls.tsx +0 -1
- package/client/features/scratchpad/useScratchpadSnapshot.tsx +23 -13
- package/client/features/settings/GeneralSettings.tsx +55 -58
- package/client/features/settings/SettingsLayout.tsx +2 -2
- package/client/features/settings/WorkspaceIconPicker.tsx +318 -0
- package/client/features/settings/WorkspaceSettingsDialog.tsx +65 -0
- package/client/features/settings/api.ts +48 -24
- package/client/features/views/ViewBuilder.tsx +5 -4
- package/client/features/views/ViewManager.tsx +25 -22
- package/client/features/views/api.ts +36 -2
- package/client/features/views/useViewBuilderActions.ts +8 -5
- package/client/features/views/useViewBuilderDrafts.ts +23 -21
- package/client/features/views/view-presentation.ts +13 -0
- package/client/features/workspace/{CustomizePanel.tsx → ThemePanel.tsx} +26 -31
- package/client/features/workspace/UnavailablePage.tsx +21 -0
- package/client/features/workspace/WorkspaceLayoutContext.tsx +4 -7
- package/client/features/workspace/WorkspaceScreen.tsx +210 -162
- package/client/features/workspace/WorkspaceSplitLayout.tsx +7 -2
- package/client/features/workspace/WorkspaceTabs.tsx +2 -0
- package/client/features/workspace/api.ts +2 -30
- package/client/features/workspace/moi-context.ts +8 -9
- package/client/features/workspace/tab-resolution.ts +10 -33
- package/client/features/workspace/useWorkspaceNavigation.ts +164 -101
- package/client/index.css +23 -30
- package/client/lib/app-icon-registry.ts +2 -0
- package/client/lib/use-latest-ref.ts +11 -0
- package/client/main.tsx +1 -1
- package/client/runtime/useWorkspaceEvents.ts +59 -14
- package/client/theme.css +5 -5
- package/dist/{chunk-tqd3pkg8.css → chunk-60q353jq.css} +1 -1
- package/dist/chunk-691pqsj6.js +2 -0
- package/dist/chunk-7a5nm4k9.css +1 -0
- package/dist/chunk-amb8y04y.js +1 -0
- package/dist/chunk-cf3pgy7j.js +546 -0
- package/dist/{chunk-11cab5dq.css → chunk-cq2r11fg.css} +1 -1
- package/dist/chunk-mzrgr577.js +5 -0
- package/dist/chunk-nf2wkvf9.js +14 -0
- package/dist/chunk-q6a0g26x.js +1 -0
- package/dist/chunk-twgdemkc.js +74 -0
- package/dist/chunk-x90k0f5c.js +2 -0
- package/dist/chunk-yq00csvd.js +2 -0
- package/dist/index.html +1 -1
- package/lib/app-icons.ts +1 -0
- package/lib/applet-selector.ts +24 -0
- package/lib/chat-title.ts +6 -1
- package/lib/default-widgets.ts +32 -0
- package/lib/format.ts +67 -7
- package/lib/message-attachments.ts +40 -0
- package/lib/moi-attachments.ts +204 -0
- package/lib/moi-context.ts +20 -35
- package/lib/navigation.ts +84 -0
- package/lib/themes.ts +6 -6
- package/lib/types.ts +91 -34
- package/lib/workspace-icon.ts +20 -0
- package/lib/workspace-layout.ts +22 -2
- package/lib/workspace-tabs.ts +9 -33
- package/package.json +42 -32
- package/registry.json +656 -0
- package/server/AGENTS.md +2 -0
- package/server/agent.ts +1 -1
- package/server/api.ts +139 -66
- package/server/applet-typecheck.ts +95 -0
- package/server/applets/applet-css.ts +55 -0
- package/server/{bundler → applets}/build-applet.ts +13 -242
- package/server/applets/build-worker.ts +178 -0
- package/server/applets/config.ts +226 -0
- package/server/applets/dependencies.ts +206 -0
- package/server/{applets.ts → applets/index.ts} +44 -189
- package/server/applets/runtime/base.ts +4 -0
- package/server/applets/runtime/moi.ts +42 -0
- package/server/applets/runtime/rpc.ts +17 -0
- package/server/applets/view-source.ts +67 -0
- package/server/attachment-message.ts +95 -0
- package/server/cli-ui-components.ts +28 -33
- package/server/cli.ts +169 -108
- package/server/control.ts +63 -42
- package/server/data-dir.ts +1 -1
- package/server/harness/README.md +45 -50
- package/server/harness/acp/NOTES.md +426 -0
- package/server/harness/acp/adapter.ts +7 -21
- package/server/harness/acp/discovery.ts +27 -30
- package/server/harness/acp/model-state.ts +57 -0
- package/server/harness/acp/session.ts +49 -56
- package/server/harness/claude-code/NOTES.md +54 -13
- package/server/harness/claude-code/adapter.ts +8 -25
- package/server/harness/claude-code/cli.ts +40 -0
- package/server/harness/claude-code/index.ts +13 -5
- package/server/harness/claude-code/models.ts +72 -19
- package/server/harness/claude-code/session.ts +447 -343
- package/server/harness/claude-code/sessions.ts +9 -4
- package/server/harness/codex/NOTES.md +222 -350
- package/server/harness/codex/adapter.ts +102 -52
- package/server/harness/codex/auth.ts +1 -3
- package/server/harness/codex/client.ts +169 -249
- package/server/harness/codex/discovery.ts +9 -17
- package/server/harness/codex/index.ts +3 -1
- package/server/harness/codex/pagination.ts +24 -0
- package/server/harness/codex/permissions.ts +32 -8
- package/server/harness/codex/probe.ts +10 -13
- package/server/harness/codex/session.ts +567 -181
- package/server/harness/codex/transport.ts +184 -0
- package/server/harness/debug.ts +1 -1
- package/server/harness/hermes/NOTES.md +19 -1
- package/server/harness/hermes/discovery.ts +20 -0
- package/server/harness/hermes/index.ts +13 -0
- package/server/harness/hermes/models.ts +28 -8
- package/server/harness/openclaw/NOTES.md +1 -1
- package/server/harness/openclaw/adapter.ts +22 -4
- package/server/harness/openclaw/gateway.ts +5 -3
- package/server/harness/openclaw/session.ts +27 -27
- package/server/harness/types.ts +9 -5
- package/server/layout.ts +9 -14
- package/server/moi-scaffold.ts +22 -14
- package/server/navigation-relay.ts +110 -0
- package/server/preview.ts +3 -1
- package/server/registry.ts +71 -41
- package/server/scratchpad-executor.ts +79 -56
- package/server/scratchpad-shape-defaults.ts +82 -0
- package/server/selected-session.ts +24 -4
- package/server/skill-update.ts +5 -3
- package/server/skill-version.ts +4 -7
- package/server/skills-template.ts +48 -9
- package/server/tabs.ts +19 -33
- package/server/tldraw-package.d.ts +4 -0
- package/server/ui-components.ts +101 -434
- package/server/uploads.ts +0 -0
- package/server/view-builders.ts +20 -2
- package/server/views.ts +126 -6
- package/server/web.ts +46 -13
- package/server/widgets.ts +12 -5
- package/server/workspace-config.ts +13 -9
- package/server/workspace-env.ts +3 -2
- package/tsconfig.json +0 -1
- package/ui-components/accordion.tsx +71 -0
- package/ui-components/alert-dialog.tsx +165 -0
- package/ui-components/alert.tsx +68 -0
- package/ui-components/attachment.tsx +195 -0
- package/ui-components/avatar.tsx +90 -0
- package/ui-components/badge.tsx +49 -0
- package/ui-components/button-group.tsx +78 -0
- package/ui-components/button.tsx +55 -0
- package/ui-components/calendar.tsx +180 -0
- package/ui-components/card.tsx +84 -0
- package/ui-components/carousel.tsx +235 -0
- package/ui-components/chart.tsx +338 -0
- package/ui-components/checkbox.tsx +28 -0
- package/ui-components/collapsible.tsx +15 -0
- package/ui-components/combobox.tsx +267 -0
- package/ui-components/context-menu.tsx +244 -0
- package/ui-components/dialog.tsx +138 -0
- package/ui-components/docs/accordion.md +463 -0
- package/ui-components/docs/alert-dialog.md +481 -0
- package/ui-components/docs/alert.md +301 -0
- package/ui-components/docs/attachment.md +689 -0
- package/ui-components/docs/avatar.md +495 -0
- package/ui-components/docs/badge.md +258 -0
- package/ui-components/docs/button-group.md +879 -0
- package/ui-components/docs/button.md +26 -0
- package/ui-components/docs/calendar.md +862 -0
- package/ui-components/docs/card.md +265 -0
- package/ui-components/docs/carousel.md +627 -0
- package/ui-components/docs/chart.md +1256 -0
- package/ui-components/docs/checkbox.md +477 -0
- package/ui-components/docs/collapsible.md +446 -0
- package/ui-components/docs/combobox.md +1003 -0
- package/ui-components/docs/context-menu.md +860 -0
- package/ui-components/docs/data-table.md +1580 -0
- package/ui-components/docs/date-picker.md +614 -0
- package/ui-components/docs/dialog.md +414 -0
- package/ui-components/docs/drawer.md +51 -0
- package/ui-components/docs/dropdown-menu.md +1000 -0
- package/ui-components/docs/field.md +1192 -0
- package/ui-components/docs/hover-card.md +275 -0
- package/ui-components/docs/input-group.md +866 -0
- package/ui-components/docs/input.md +456 -0
- package/ui-components/docs/kbd.md +191 -0
- package/ui-components/docs/label.md +295 -0
- package/ui-components/docs/pagination.md +416 -0
- package/ui-components/docs/popover.md +348 -0
- package/ui-components/docs/progress.md +214 -0
- package/ui-components/docs/radio-group.md +389 -0
- package/ui-components/docs/resizable.md +265 -0
- package/ui-components/docs/select.md +616 -0
- package/ui-components/docs/separator.md +216 -0
- package/ui-components/docs/skeleton.md +205 -0
- package/ui-components/docs/slider.md +226 -0
- package/ui-components/docs/spinner.md +332 -0
- package/ui-components/docs/switch.md +236 -0
- package/ui-components/docs/table.md +551 -0
- package/ui-components/docs/tabs.md +379 -0
- package/ui-components/docs/textarea.md +187 -0
- package/ui-components/docs/toggle-group.md +370 -0
- package/ui-components/docs/toggle.md +91 -0
- package/ui-components/docs/tooltip.md +290 -0
- package/ui-components/drawer.tsx +213 -0
- package/ui-components/dropdown-menu.tsx +263 -0
- package/ui-components/field.tsx +224 -0
- package/ui-components/hover-card.tsx +46 -0
- package/ui-components/input-group.tsx +146 -0
- package/ui-components/input.tsx +20 -0
- package/ui-components/kbd.tsx +32 -0
- package/ui-components/label.tsx +17 -0
- package/ui-components/pagination.tsx +124 -0
- package/ui-components/popover.tsx +81 -0
- package/ui-components/progress.tsx +63 -0
- package/ui-components/radio-group.tsx +38 -0
- package/ui-components/resizable.tsx +40 -0
- package/ui-components/scoped-portal.tsx +31 -0
- package/ui-components/select.tsx +195 -0
- package/ui-components/separator.tsx +18 -0
- package/ui-components/skeleton.tsx +15 -0
- package/ui-components/slider.tsx +75 -0
- package/ui-components/spinner.tsx +20 -0
- package/ui-components/switch.tsx +27 -0
- package/ui-components/table.tsx +86 -0
- package/ui-components/tabs.tsx +75 -0
- package/ui-components/textarea.tsx +17 -0
- package/ui-components/toggle-group.tsx +85 -0
- package/ui-components/toggle.tsx +42 -0
- package/ui-components/tooltip.tsx +61 -0
- package/ui-components/utils.ts +8 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +295 -248
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +100 -152
- package/workspace/.claude/skills/moi-workspace/references/INTENTS.md +156 -0
- package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
- package/client/features/chat/attachment-staging.ts +0 -153
- package/client/features/chat/uploads.ts +0 -18
- package/client/features/chat/useAppletChatMessage.ts +0 -68
- package/client/features/settings/IconPicker.tsx +0 -442
- package/client/features/settings/WorkspaceSettings.tsx +0 -92
- package/client/features/settings/render-icon.ts +0 -173
- package/client/features/widgets/HiddenPanel.tsx +0 -80
- package/client/features/widgets/WidgetGrid.tsx +0 -123
- package/client/features/widgets/Widgets.tsx +0 -264
- package/client/features/widgets/useGridReconcile.ts +0 -73
- package/dist/chunk-104m57qw.js +0 -2
- package/dist/chunk-59zf0m6n.js +0 -1
- package/dist/chunk-bj3akjs2.js +0 -1
- package/dist/chunk-c9pjqx9m.js +0 -14
- package/dist/chunk-j2w2vak4.js +0 -546
- package/dist/chunk-k2r9c95m.js +0 -10
- package/dist/chunk-kmbxhgwv.js +0 -1
- package/dist/chunk-p1yqa71k.js +0 -83
- package/dist/chunk-pcnahct1.js +0 -5
- package/dist/chunk-r5xrenjy.css +0 -1
- package/dist/chunk-tny85yt2.js +0 -2
- package/dist/chunk-v7wr1df4.js +0 -2
- package/server/bundler/applet-css.ts +0 -155
- /package/client/features/chat/{ChatPromptBubbles.tsx → messages/ChatPromptBubbles.tsx} +0 -0
- /package/client/features/chat/{ShimmerText.tsx → messages/ShimmerText.tsx} +0 -0
- /package/client/features/chat/{preview-turn.ts → messages/preview-turn.ts} +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/CodeBlock.tsx +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/Collapse.tsx +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/ReadImagePreview.tsx +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/ToolOutput.tsx +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/detect.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/fixtures.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/claude.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/hermes.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/index.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/mcp.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/openclaw.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/shared.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/format/shell.ts +0 -0
- /package/client/features/chat/{tool-group → messages/tool-group}/index.ts +0 -0
- /package/client/features/chat/{useStickToBottom.ts → messages/useStickToBottom.ts} +0 -0
- /package/client/features/chat/{useSelectedSession.ts → sessions/useSelectedSession.ts} +0 -0
|
@@ -1,254 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Menu as MenuPrimitive } from '@base-ui/react/menu'
|
|
4
|
-
import { IconCheck, IconChevronRight } from '@tabler/icons-react'
|
|
5
|
-
|
|
6
|
-
import { cn } from '@/client/lib/cn'
|
|
7
|
-
|
|
8
|
-
function DropdownMenu({ ...props }: MenuPrimitive.Root.Props) {
|
|
9
|
-
return <MenuPrimitive.Root data-slot="dropdown-menu" {...props} />
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function DropdownMenuPortal({ ...props }: MenuPrimitive.Portal.Props) {
|
|
13
|
-
return <MenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function DropdownMenuTrigger({ ...props }: MenuPrimitive.Trigger.Props) {
|
|
17
|
-
return <MenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function DropdownMenuContent({
|
|
21
|
-
align = 'start',
|
|
22
|
-
alignOffset = 0,
|
|
23
|
-
side = 'bottom',
|
|
24
|
-
sideOffset = 4,
|
|
25
|
-
className,
|
|
26
|
-
...props
|
|
27
|
-
}: MenuPrimitive.Popup.Props &
|
|
28
|
-
Pick<MenuPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {
|
|
29
|
-
return (
|
|
30
|
-
<MenuPrimitive.Portal>
|
|
31
|
-
<MenuPrimitive.Positioner
|
|
32
|
-
className="isolate z-50 outline-none"
|
|
33
|
-
align={align}
|
|
34
|
-
alignOffset={alignOffset}
|
|
35
|
-
side={side}
|
|
36
|
-
sideOffset={sideOffset}
|
|
37
|
-
>
|
|
38
|
-
<MenuPrimitive.Popup
|
|
39
|
-
data-slot="dropdown-menu-content"
|
|
40
|
-
className={cn(
|
|
41
|
-
'z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
42
|
-
className
|
|
43
|
-
)}
|
|
44
|
-
{...props}
|
|
45
|
-
/>
|
|
46
|
-
</MenuPrimitive.Positioner>
|
|
47
|
-
</MenuPrimitive.Portal>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function DropdownMenuGroup({ ...props }: MenuPrimitive.Group.Props) {
|
|
52
|
-
return <MenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function DropdownMenuLabel({
|
|
56
|
-
className,
|
|
57
|
-
inset,
|
|
58
|
-
...props
|
|
59
|
-
}: MenuPrimitive.GroupLabel.Props & {
|
|
60
|
-
inset?: boolean
|
|
61
|
-
}) {
|
|
62
|
-
return (
|
|
63
|
-
<MenuPrimitive.GroupLabel
|
|
64
|
-
data-slot="dropdown-menu-label"
|
|
65
|
-
data-inset={inset}
|
|
66
|
-
className={cn('px-2 pt-1.5 pb-0.5 text-xs text-muted-foreground data-inset:pl-7', className)}
|
|
67
|
-
{...props}
|
|
68
|
-
/>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function DropdownMenuItem({
|
|
73
|
-
className,
|
|
74
|
-
inset,
|
|
75
|
-
variant = 'default',
|
|
76
|
-
...props
|
|
77
|
-
}: MenuPrimitive.Item.Props & {
|
|
78
|
-
inset?: boolean
|
|
79
|
-
variant?: 'default' | 'destructive'
|
|
80
|
-
}) {
|
|
81
|
-
return (
|
|
82
|
-
<MenuPrimitive.Item
|
|
83
|
-
data-slot="dropdown-menu-item"
|
|
84
|
-
data-inset={inset}
|
|
85
|
-
data-variant={variant}
|
|
86
|
-
className={cn(
|
|
87
|
-
"group/dropdown-menu-item relative flex cursor-default items-center gap-2 rounded-md px-2 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
|
|
88
|
-
className
|
|
89
|
-
)}
|
|
90
|
-
{...props}
|
|
91
|
-
/>
|
|
92
|
-
)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function DropdownMenuSub({ ...props }: MenuPrimitive.SubmenuRoot.Props) {
|
|
96
|
-
return <MenuPrimitive.SubmenuRoot data-slot="dropdown-menu-sub" {...props} />
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function DropdownMenuSubTrigger({
|
|
100
|
-
className,
|
|
101
|
-
inset,
|
|
102
|
-
children,
|
|
103
|
-
...props
|
|
104
|
-
}: MenuPrimitive.SubmenuTrigger.Props & {
|
|
105
|
-
inset?: boolean
|
|
106
|
-
}) {
|
|
107
|
-
return (
|
|
108
|
-
<MenuPrimitive.SubmenuTrigger
|
|
109
|
-
data-slot="dropdown-menu-sub-trigger"
|
|
110
|
-
data-inset={inset}
|
|
111
|
-
className={cn(
|
|
112
|
-
"flex cursor-default items-center gap-2 rounded-md px-2 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
113
|
-
className
|
|
114
|
-
)}
|
|
115
|
-
{...props}
|
|
116
|
-
>
|
|
117
|
-
{children}
|
|
118
|
-
<IconChevronRight className="cn-rtl-flip ml-auto" stroke={1.75} />
|
|
119
|
-
</MenuPrimitive.SubmenuTrigger>
|
|
120
|
-
)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function DropdownMenuSubContent({
|
|
124
|
-
align = 'start',
|
|
125
|
-
alignOffset = -3,
|
|
126
|
-
side = 'right',
|
|
127
|
-
sideOffset = 0,
|
|
128
|
-
className,
|
|
129
|
-
...props
|
|
130
|
-
}: ComponentProps<typeof DropdownMenuContent>) {
|
|
131
|
-
return (
|
|
132
|
-
<DropdownMenuContent
|
|
133
|
-
data-slot="dropdown-menu-sub-content"
|
|
134
|
-
className={cn(
|
|
135
|
-
'w-auto min-w-[96px] rounded-lg bg-popover p-1 text-popover-foreground shadow-lg duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
136
|
-
className
|
|
137
|
-
)}
|
|
138
|
-
align={align}
|
|
139
|
-
alignOffset={alignOffset}
|
|
140
|
-
side={side}
|
|
141
|
-
sideOffset={sideOffset}
|
|
142
|
-
{...props}
|
|
143
|
-
/>
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function DropdownMenuCheckboxItem({
|
|
148
|
-
className,
|
|
149
|
-
children,
|
|
150
|
-
checked,
|
|
151
|
-
inset,
|
|
152
|
-
...props
|
|
153
|
-
}: MenuPrimitive.CheckboxItem.Props & {
|
|
154
|
-
inset?: boolean
|
|
155
|
-
}) {
|
|
156
|
-
return (
|
|
157
|
-
<MenuPrimitive.CheckboxItem
|
|
158
|
-
data-slot="dropdown-menu-checkbox-item"
|
|
159
|
-
data-inset={inset}
|
|
160
|
-
className={cn(
|
|
161
|
-
"relative flex cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
162
|
-
className
|
|
163
|
-
)}
|
|
164
|
-
checked={checked}
|
|
165
|
-
{...props}
|
|
166
|
-
>
|
|
167
|
-
<span
|
|
168
|
-
className="pointer-events-none absolute right-2 flex items-center justify-center"
|
|
169
|
-
data-slot="dropdown-menu-checkbox-item-indicator"
|
|
170
|
-
>
|
|
171
|
-
<MenuPrimitive.CheckboxItemIndicator>
|
|
172
|
-
<IconCheck stroke={1.75} />
|
|
173
|
-
</MenuPrimitive.CheckboxItemIndicator>
|
|
174
|
-
</span>
|
|
175
|
-
{children}
|
|
176
|
-
</MenuPrimitive.CheckboxItem>
|
|
177
|
-
)
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function DropdownMenuRadioGroup({ ...props }: MenuPrimitive.RadioGroup.Props) {
|
|
181
|
-
return <MenuPrimitive.RadioGroup data-slot="dropdown-menu-radio-group" {...props} />
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function DropdownMenuRadioItem({
|
|
185
|
-
className,
|
|
186
|
-
children,
|
|
187
|
-
inset,
|
|
188
|
-
...props
|
|
189
|
-
}: MenuPrimitive.RadioItem.Props & {
|
|
190
|
-
inset?: boolean
|
|
191
|
-
}) {
|
|
192
|
-
return (
|
|
193
|
-
<MenuPrimitive.RadioItem
|
|
194
|
-
data-slot="dropdown-menu-radio-item"
|
|
195
|
-
data-inset={inset}
|
|
196
|
-
className={cn(
|
|
197
|
-
"relative flex cursor-default items-center gap-2 rounded-md py-1 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
198
|
-
className
|
|
199
|
-
)}
|
|
200
|
-
{...props}
|
|
201
|
-
>
|
|
202
|
-
<span
|
|
203
|
-
className="pointer-events-none absolute right-2 flex items-center justify-center"
|
|
204
|
-
data-slot="dropdown-menu-radio-item-indicator"
|
|
205
|
-
>
|
|
206
|
-
<MenuPrimitive.RadioItemIndicator>
|
|
207
|
-
<IconCheck stroke={1.75} />
|
|
208
|
-
</MenuPrimitive.RadioItemIndicator>
|
|
209
|
-
</span>
|
|
210
|
-
{children}
|
|
211
|
-
</MenuPrimitive.RadioItem>
|
|
212
|
-
)
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function DropdownMenuSeparator({ className, ...props }: MenuPrimitive.Separator.Props) {
|
|
216
|
-
return (
|
|
217
|
-
<MenuPrimitive.Separator
|
|
218
|
-
data-slot="dropdown-menu-separator"
|
|
219
|
-
className={cn('mx-2 my-1 h-px bg-border', className)}
|
|
220
|
-
{...props}
|
|
221
|
-
/>
|
|
222
|
-
)
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function DropdownMenuShortcut({ className, ...props }: ComponentProps<'span'>) {
|
|
226
|
-
return (
|
|
227
|
-
<span
|
|
228
|
-
data-slot="dropdown-menu-shortcut"
|
|
229
|
-
className={cn(
|
|
230
|
-
'ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground',
|
|
231
|
-
className
|
|
232
|
-
)}
|
|
233
|
-
{...props}
|
|
234
|
-
/>
|
|
235
|
-
)
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
export {
|
|
239
|
-
DropdownMenu,
|
|
240
|
-
DropdownMenuPortal,
|
|
241
|
-
DropdownMenuTrigger,
|
|
242
|
-
DropdownMenuContent,
|
|
243
|
-
DropdownMenuGroup,
|
|
244
|
-
DropdownMenuLabel,
|
|
245
|
-
DropdownMenuItem,
|
|
246
|
-
DropdownMenuCheckboxItem,
|
|
247
|
-
DropdownMenuRadioGroup,
|
|
248
|
-
DropdownMenuRadioItem,
|
|
249
|
-
DropdownMenuSeparator,
|
|
250
|
-
DropdownMenuShortcut,
|
|
251
|
-
DropdownMenuSub,
|
|
252
|
-
DropdownMenuSubTrigger,
|
|
253
|
-
DropdownMenuSubContent
|
|
254
|
-
}
|
|
1
|
+
export * from '@/ui-components/dropdown-menu'
|
|
@@ -1,44 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/client/lib/cn'
|
|
4
|
-
|
|
5
|
-
function HoverCard({ ...props }: PreviewCardPrimitive.Root.Props) {
|
|
6
|
-
return <PreviewCardPrimitive.Root data-slot="hover-card" {...props} />
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function HoverCardTrigger({ ...props }: PreviewCardPrimitive.Trigger.Props) {
|
|
10
|
-
return <PreviewCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function HoverCardContent({
|
|
14
|
-
className,
|
|
15
|
-
side = 'bottom',
|
|
16
|
-
sideOffset = 4,
|
|
17
|
-
align = 'center',
|
|
18
|
-
alignOffset = 0,
|
|
19
|
-
...props
|
|
20
|
-
}: PreviewCardPrimitive.Popup.Props &
|
|
21
|
-
Pick<PreviewCardPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'>) {
|
|
22
|
-
return (
|
|
23
|
-
<PreviewCardPrimitive.Portal data-slot="hover-card-portal">
|
|
24
|
-
<PreviewCardPrimitive.Positioner
|
|
25
|
-
align={align}
|
|
26
|
-
alignOffset={alignOffset}
|
|
27
|
-
side={side}
|
|
28
|
-
sideOffset={sideOffset}
|
|
29
|
-
className="isolate z-50"
|
|
30
|
-
>
|
|
31
|
-
<PreviewCardPrimitive.Popup
|
|
32
|
-
data-slot="hover-card-content"
|
|
33
|
-
className={cn(
|
|
34
|
-
'z-50 w-64 origin-(--transform-origin) rounded-xl bg-popover p-2.5 text-sm text-popover-foreground shadow-md outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
35
|
-
className
|
|
36
|
-
)}
|
|
37
|
-
{...props}
|
|
38
|
-
/>
|
|
39
|
-
</PreviewCardPrimitive.Positioner>
|
|
40
|
-
</PreviewCardPrimitive.Portal>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { HoverCard, HoverCardTrigger, HoverCardContent }
|
|
1
|
+
export * from '@/ui-components/hover-card'
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useRef } from 'react'
|
|
2
|
+
import type { ComponentProps } from 'react'
|
|
3
|
+
|
|
4
|
+
import { Input as InputPrimitive } from '@base-ui/react/input'
|
|
5
|
+
|
|
6
|
+
import { cn } from '@/client/lib/cn'
|
|
7
|
+
|
|
8
|
+
type InputPrimitiveProps = ComponentProps<typeof InputPrimitive>
|
|
9
|
+
type InputFocusEvent = Parameters<NonNullable<InputPrimitiveProps['onFocus']>>[0]
|
|
10
|
+
type InputKeyboardEvent = Parameters<NonNullable<InputPrimitiveProps['onKeyDown']>>[0]
|
|
11
|
+
|
|
12
|
+
type InlineInputProps = Omit<InputPrimitiveProps, 'onChange'> & {
|
|
13
|
+
onValueChange?: (value: string) => void
|
|
14
|
+
onValueCommit?: (value: string) => void
|
|
15
|
+
selectOnFocus?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function InlineInput({
|
|
19
|
+
className,
|
|
20
|
+
onBlur,
|
|
21
|
+
onFocus,
|
|
22
|
+
onKeyDown,
|
|
23
|
+
onValueChange,
|
|
24
|
+
onValueCommit,
|
|
25
|
+
selectOnFocus,
|
|
26
|
+
...props
|
|
27
|
+
}: InlineInputProps) {
|
|
28
|
+
const valueBeforeEditRef = useRef<string | null>(null)
|
|
29
|
+
|
|
30
|
+
function handleBlur(event: InputFocusEvent) {
|
|
31
|
+
const shouldCommit = valueBeforeEditRef.current !== null
|
|
32
|
+
valueBeforeEditRef.current = null
|
|
33
|
+
onBlur?.(event)
|
|
34
|
+
if (!event.defaultPrevented && shouldCommit) {
|
|
35
|
+
onValueCommit?.(event.currentTarget.value)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function handleFocus(event: InputFocusEvent) {
|
|
40
|
+
valueBeforeEditRef.current = event.currentTarget.value
|
|
41
|
+
if (selectOnFocus) {
|
|
42
|
+
const input = event.currentTarget
|
|
43
|
+
input.select()
|
|
44
|
+
requestAnimationFrame(() => {
|
|
45
|
+
input.scrollLeft = 0
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
onFocus?.(event)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function handleKeyDown(event: InputKeyboardEvent) {
|
|
52
|
+
onKeyDown?.(event)
|
|
53
|
+
if (event.defaultPrevented) return
|
|
54
|
+
|
|
55
|
+
if (event.key === 'Enter') {
|
|
56
|
+
event.preventDefault()
|
|
57
|
+
event.currentTarget.blur()
|
|
58
|
+
} else if (event.key === 'Escape') {
|
|
59
|
+
event.preventDefault()
|
|
60
|
+
const valueBeforeEdit = valueBeforeEditRef.current ?? event.currentTarget.value
|
|
61
|
+
valueBeforeEditRef.current = null
|
|
62
|
+
event.currentTarget.value = valueBeforeEdit
|
|
63
|
+
onValueChange?.(valueBeforeEdit)
|
|
64
|
+
event.currentTarget.blur()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<InputPrimitive
|
|
70
|
+
data-slot="inline-input"
|
|
71
|
+
className={cn(
|
|
72
|
+
'-ml-2 [field-sizing:content] w-auto max-w-full min-w-0 rounded-md bg-transparent px-2 py-0.5 text-sm shadow-none outline-none focus:[field-sizing:fixed] focus:w-full focus-visible:border-ring focus-visible:bg-accent disabled:pointer-events-none',
|
|
73
|
+
className
|
|
74
|
+
)}
|
|
75
|
+
onBlur={handleBlur}
|
|
76
|
+
onChange={event => onValueChange?.(event.target.value)}
|
|
77
|
+
onFocus={handleFocus}
|
|
78
|
+
onKeyDown={handleKeyDown}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { InlineInput }
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Input as InputPrimitive } from '@base-ui/react/input'
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/client/lib/cn'
|
|
6
|
-
|
|
7
|
-
function Input({ className, type, ...props }: ComponentProps<'input'>) {
|
|
8
|
-
return (
|
|
9
|
-
<InputPrimitive
|
|
10
|
-
type={type}
|
|
11
|
-
data-slot="input"
|
|
12
|
-
className={cn(
|
|
13
|
-
'h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-sm transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40',
|
|
14
|
-
className
|
|
15
|
-
)}
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { Input }
|
|
1
|
+
export * from '@/ui-components/input'
|
|
@@ -1,88 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Popover as PopoverPrimitive } from '@base-ui/react/popover'
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/client/lib/cn'
|
|
6
|
-
|
|
7
|
-
function Popover({ ...props }: PopoverPrimitive.Root.Props) {
|
|
8
|
-
return <PopoverPrimitive.Root data-slot="popover" {...props} />
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function PopoverTrigger({ ...props }: PopoverPrimitive.Trigger.Props) {
|
|
12
|
-
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
type PopoverContentProps = PopoverPrimitive.Popup.Props &
|
|
16
|
-
Pick<
|
|
17
|
-
PopoverPrimitive.Positioner.Props,
|
|
18
|
-
'align' | 'alignOffset' | 'disableAnchorTracking' | 'positionMethod' | 'side' | 'sideOffset'
|
|
19
|
-
> &
|
|
20
|
-
Pick<PopoverPrimitive.Portal.Props, 'keepMounted' | 'container'>
|
|
21
|
-
|
|
22
|
-
function PopoverContent({
|
|
23
|
-
className,
|
|
24
|
-
align = 'center',
|
|
25
|
-
alignOffset = 0,
|
|
26
|
-
disableAnchorTracking = false,
|
|
27
|
-
positionMethod = 'absolute',
|
|
28
|
-
side = 'bottom',
|
|
29
|
-
sideOffset = 4,
|
|
30
|
-
keepMounted = false,
|
|
31
|
-
container,
|
|
32
|
-
...props
|
|
33
|
-
}: PopoverContentProps) {
|
|
34
|
-
return (
|
|
35
|
-
<PopoverPrimitive.Portal keepMounted={keepMounted} container={container}>
|
|
36
|
-
<PopoverPrimitive.Positioner
|
|
37
|
-
align={align}
|
|
38
|
-
alignOffset={alignOffset}
|
|
39
|
-
disableAnchorTracking={disableAnchorTracking}
|
|
40
|
-
positionMethod={positionMethod}
|
|
41
|
-
side={side}
|
|
42
|
-
sideOffset={sideOffset}
|
|
43
|
-
className="isolate z-50"
|
|
44
|
-
>
|
|
45
|
-
<PopoverPrimitive.Popup
|
|
46
|
-
data-slot="popover-content"
|
|
47
|
-
className={cn(
|
|
48
|
-
'z-50 flex w-72 origin-(--transform-origin) flex-col gap-3 rounded-lg bg-popover p-3 text-sm text-popover-foreground shadow-md outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
49
|
-
className
|
|
50
|
-
)}
|
|
51
|
-
{...props}
|
|
52
|
-
/>
|
|
53
|
-
</PopoverPrimitive.Positioner>
|
|
54
|
-
</PopoverPrimitive.Portal>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function PopoverHeader({ className, ...props }: ComponentProps<'div'>) {
|
|
59
|
-
return (
|
|
60
|
-
<div
|
|
61
|
-
data-slot="popover-header"
|
|
62
|
-
className={cn('flex flex-col gap-0.5 text-sm', className)}
|
|
63
|
-
{...props}
|
|
64
|
-
/>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function PopoverTitle({ className, ...props }: PopoverPrimitive.Title.Props) {
|
|
69
|
-
return (
|
|
70
|
-
<PopoverPrimitive.Title
|
|
71
|
-
data-slot="popover-title"
|
|
72
|
-
className={cn('font-medium', className)}
|
|
73
|
-
{...props}
|
|
74
|
-
/>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function PopoverDescription({ className, ...props }: PopoverPrimitive.Description.Props) {
|
|
79
|
-
return (
|
|
80
|
-
<PopoverPrimitive.Description
|
|
81
|
-
data-slot="popover-description"
|
|
82
|
-
className={cn('text-muted-foreground', className)}
|
|
83
|
-
{...props}
|
|
84
|
-
/>
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export { Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger }
|
|
1
|
+
export * from '@/ui-components/popover'
|
|
@@ -1,40 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/client/lib/cn'
|
|
4
|
-
|
|
5
|
-
function ResizablePanelGroup({ className, ...props }: ResizablePrimitive.GroupProps) {
|
|
6
|
-
return (
|
|
7
|
-
<ResizablePrimitive.Group
|
|
8
|
-
data-slot="resizable-panel-group"
|
|
9
|
-
className={cn('flex h-full w-full aria-[orientation=vertical]:flex-col', className)}
|
|
10
|
-
{...props}
|
|
11
|
-
/>
|
|
12
|
-
)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
|
|
16
|
-
return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function ResizableHandle({
|
|
20
|
-
withHandle,
|
|
21
|
-
className,
|
|
22
|
-
...props
|
|
23
|
-
}: ResizablePrimitive.SeparatorProps & {
|
|
24
|
-
withHandle?: boolean
|
|
25
|
-
}) {
|
|
26
|
-
return (
|
|
27
|
-
<ResizablePrimitive.Separator
|
|
28
|
-
data-slot="resizable-handle"
|
|
29
|
-
className={cn(
|
|
30
|
-
'relative flex w-0 items-center justify-center ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-0 aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90',
|
|
31
|
-
className
|
|
32
|
-
)}
|
|
33
|
-
{...props}
|
|
34
|
-
>
|
|
35
|
-
{withHandle && <div className="flex h-6 w-1 shrink-0 rounded-lg bg-border" />}
|
|
36
|
-
</ResizablePrimitive.Separator>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { ResizableHandle, ResizablePanel, ResizablePanelGroup }
|
|
1
|
+
export * from '@/ui-components/resizable'
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {
|
|
4
|
-
return (
|
|
5
|
-
<div
|
|
6
|
-
data-slot="skeleton"
|
|
7
|
-
className={cn('animate-pulse rounded-lg bg-muted', className)}
|
|
8
|
-
{...props}
|
|
9
|
-
/>
|
|
10
|
-
)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { Skeleton }
|
|
1
|
+
export * from '@/ui-components/skeleton'
|
|
@@ -1,70 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Slider as SliderPrimitive } from '@base-ui/react/slider'
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/client/lib/cn'
|
|
6
|
-
|
|
7
|
-
function Slider({
|
|
8
|
-
children,
|
|
9
|
-
className,
|
|
10
|
-
defaultValue,
|
|
11
|
-
value,
|
|
12
|
-
min = 0,
|
|
13
|
-
max = 100,
|
|
14
|
-
...props
|
|
15
|
-
}: SliderPrimitive.Root.Props) {
|
|
16
|
-
const [animationReady, setAnimationReady] = useState(false)
|
|
17
|
-
const _values = Array.isArray(value)
|
|
18
|
-
? value
|
|
19
|
-
: Array.isArray(defaultValue)
|
|
20
|
-
? defaultValue
|
|
21
|
-
: [min, max]
|
|
22
|
-
|
|
23
|
-
// Let Base UI measure the initial positions before transitions are enabled.
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
const frame = requestAnimationFrame(() => setAnimationReady(true))
|
|
26
|
-
return () => cancelAnimationFrame(frame)
|
|
27
|
-
}, [])
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<SliderPrimitive.Root
|
|
31
|
-
className={cn('data-horizontal:w-full data-vertical:h-full', className)}
|
|
32
|
-
data-slot="slider"
|
|
33
|
-
defaultValue={defaultValue}
|
|
34
|
-
value={value}
|
|
35
|
-
min={min}
|
|
36
|
-
max={max}
|
|
37
|
-
thumbAlignment="edge"
|
|
38
|
-
{...props}
|
|
39
|
-
>
|
|
40
|
-
<SliderPrimitive.Control className="relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col">
|
|
41
|
-
<SliderPrimitive.Track
|
|
42
|
-
data-slot="slider-track"
|
|
43
|
-
className="relative grow overflow-hidden rounded-full bg-muted select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1"
|
|
44
|
-
>
|
|
45
|
-
<SliderPrimitive.Indicator
|
|
46
|
-
data-slot="slider-range"
|
|
47
|
-
className={cn(
|
|
48
|
-
'bg-primary select-none data-horizontal:h-full data-vertical:w-full',
|
|
49
|
-
animationReady && 'transition-[width] duration-150 ease-in-out'
|
|
50
|
-
)}
|
|
51
|
-
/>
|
|
52
|
-
</SliderPrimitive.Track>
|
|
53
|
-
{children}
|
|
54
|
-
{Array.from({ length: _values.length }, (_, index) => (
|
|
55
|
-
<SliderPrimitive.Thumb
|
|
56
|
-
data-slot="slider-thumb"
|
|
57
|
-
key={index}
|
|
58
|
-
className={cn(
|
|
59
|
-
'relative block size-3 shrink-0 cursor-ew-resize rounded-full border border-ring bg-white ring-ring/50 select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50',
|
|
60
|
-
animationReady &&
|
|
61
|
-
'transition-[inset-inline-start,color,box-shadow] duration-150 ease-in-out'
|
|
62
|
-
)}
|
|
63
|
-
/>
|
|
64
|
-
))}
|
|
65
|
-
</SliderPrimitive.Control>
|
|
66
|
-
</SliderPrimitive.Root>
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { Slider }
|
|
1
|
+
export * from '@/ui-components/slider'
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/client/lib/cn'
|
|
4
|
-
|
|
5
|
-
function Spinner({ className, ...props }: React.ComponentProps<typeof IconLoader2>) {
|
|
6
|
-
return (
|
|
7
|
-
<IconLoader2
|
|
8
|
-
data-slot="spinner"
|
|
9
|
-
role="status"
|
|
10
|
-
aria-label="Loading"
|
|
11
|
-
className={cn('size-4 animate-spin', className)}
|
|
12
|
-
stroke={1.75}
|
|
13
|
-
{...props}
|
|
14
|
-
/>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { Spinner }
|
|
1
|
+
export * from '@/ui-components/spinner'
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { cn } from '@/client/lib/cn'
|
|
4
|
-
|
|
5
|
-
function Switch({ className, ...props }: SwitchPrimitive.Root.Props) {
|
|
6
|
-
return (
|
|
7
|
-
<SwitchPrimitive.Root
|
|
8
|
-
data-slot="switch"
|
|
9
|
-
className={cn(
|
|
10
|
-
'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent shadow-xs transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-checked:bg-primary data-unchecked:bg-input',
|
|
11
|
-
className
|
|
12
|
-
)}
|
|
13
|
-
{...props}
|
|
14
|
-
>
|
|
15
|
-
<SwitchPrimitive.Thumb
|
|
16
|
-
data-slot="switch-thumb"
|
|
17
|
-
className="pointer-events-none block size-4 rounded-full bg-background shadow-sm ring-0 transition-transform data-checked:translate-x-4 data-unchecked:translate-x-0.5"
|
|
18
|
-
/>
|
|
19
|
-
</SwitchPrimitive.Root>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { Switch }
|
|
1
|
+
export * from '@/ui-components/switch'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/ui-components/tabs'
|