@vuer-ai/vuer-uikit 0.0.96 → 0.0.98
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 +106 -7
- package/cli/dial-cli.js +49 -7
- package/dist/SyncScroll/SyncScroll.cjs +10 -10
- package/dist/SyncScroll/SyncScroll.mjs +3 -3
- package/dist/SyncScroll/index.cjs +10 -10
- package/dist/SyncScroll/index.mjs +3 -3
- package/dist/chunk-3HEZVWRW.mjs +62 -0
- package/dist/chunk-4KWGGESI.cjs +494 -0
- package/dist/{chunk-CCMKL2OA.cjs → chunk-7GWDO25E.cjs} +2 -2
- package/dist/chunk-A5LCX2UQ.cjs +208 -0
- package/dist/chunk-BEJIZ56L.mjs +300 -0
- package/dist/chunk-C7VGRU3O.mjs +283 -0
- package/dist/{chunk-LONOMMFA.cjs → chunk-LJMNHTTG.cjs} +21 -21
- package/dist/chunk-O66RESRR.cjs +285 -0
- package/dist/{chunk-RINTUFYQ.cjs → chunk-RMK6W774.cjs} +24 -19
- package/dist/{chunk-BFQ2WL5U.mjs → chunk-TTYSYGVE.mjs} +2 -2
- package/dist/chunk-VA3PEYFM.mjs +489 -0
- package/dist/chunk-VBBJSIY7.cjs +308 -0
- package/dist/{chunk-AIINOWEH.mjs → chunk-W4JCKCW7.mjs} +5 -5
- package/dist/chunk-WWGF6TBZ.mjs +206 -0
- package/dist/chunk-ZGN4UEJR.cjs +679 -0
- package/dist/chunk-ZQLRMOUW.mjs +661 -0
- package/dist/dial/DialPanel.cjs +24 -24
- package/dist/dial/DialPanel.mjs +23 -23
- package/dist/dial/DialProvider.cjs +3 -3
- package/dist/dial/DialProvider.d.cts +1 -0
- package/dist/dial/DialProvider.d.ts +1 -0
- package/dist/dial/DialProvider.example.cjs +72 -0
- package/dist/dial/DialProvider.example.d.cts +7 -0
- package/dist/dial/DialProvider.example.d.ts +7 -0
- package/dist/dial/DialProvider.example.mjs +68 -0
- package/dist/dial/DialProvider.mjs +1 -1
- package/dist/dial/index.cjs +42 -42
- package/dist/dial/index.mjs +23 -23
- package/dist/dial/wrapped-inputs/ControlledInputs.cjs +27 -27
- package/dist/dial/wrapped-inputs/ControlledInputs.mjs +23 -23
- package/dist/dial/wrapped-inputs/DialInputs.cjs +34 -34
- package/dist/dial/wrapped-inputs/DialInputs.mjs +23 -23
- package/dist/dial/wrapped-inputs/DialVectorInput.cjs +24 -24
- package/dist/dial/wrapped-inputs/DialVectorInput.mjs +23 -23
- package/dist/dial/wrapped-inputs/index.cjs +39 -39
- package/dist/dial/wrapped-inputs/index.mjs +23 -23
- package/dist/highlight-cursor/cursor-provider.cjs +3 -3
- package/dist/highlight-cursor/cursor-provider.mjs +2 -2
- package/dist/highlight-cursor/enhanced-components.cjs +10 -10
- package/dist/highlight-cursor/enhanced-components.mjs +5 -5
- package/dist/highlight-cursor/index.cjs +16 -16
- package/dist/highlight-cursor/index.mjs +6 -6
- package/dist/hooks/index.cjs +5 -5
- package/dist/hooks/index.mjs +1 -1
- package/dist/index.cjs +190 -190
- package/dist/index.mjs +23 -23
- package/dist/ui/UIKitBadge.cjs +6 -6
- package/dist/ui/UIKitBadge.mjs +2 -2
- package/dist/ui/avatar.cjs +1 -1
- package/dist/ui/avatar.mjs +1 -1
- package/dist/ui/badge.cjs +1 -1
- package/dist/ui/badge.d.cts +1 -1
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/badge.mjs +1 -1
- package/dist/ui/button.cjs +1 -1
- package/dist/ui/button.mjs +1 -1
- package/dist/ui/card.cjs +1 -1
- package/dist/ui/card.mjs +1 -1
- package/dist/ui/checkbox.cjs +1 -1
- package/dist/ui/checkbox.mjs +1 -1
- package/dist/ui/collapsible.cjs +1 -1
- package/dist/ui/collapsible.mjs +1 -1
- package/dist/ui/drawer.cjs +1 -1
- package/dist/ui/drawer.mjs +1 -1
- package/dist/ui/dropdown.cjs +1 -1
- package/dist/ui/dropdown.mjs +1 -1
- package/dist/ui/index.cjs +107 -107
- package/dist/ui/index.mjs +17 -17
- package/dist/ui/inputs/color-input.cjs +1 -1
- package/dist/ui/inputs/color-input.mjs +1 -1
- package/dist/ui/inputs/index.cjs +11 -11
- package/dist/ui/inputs/index.mjs +3 -3
- package/dist/ui/inputs/input-numbers.cjs +1 -1
- package/dist/ui/inputs/input-numbers.mjs +1 -1
- package/dist/ui/inputs/input.cjs +1 -1
- package/dist/ui/inputs/input.d.cts +1 -1
- package/dist/ui/inputs/input.d.ts +1 -1
- package/dist/ui/inputs/input.mjs +1 -1
- package/dist/ui/inputs/number-inputs/CmInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/CmInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/DegInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/DegInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerDegInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerDegInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerRadInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/EulerRadInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/InchInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/InchInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/IntInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/IntInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/KVectorInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/KVectorInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/QuaternionInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/QuaternionInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/RadInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/RadInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/TimeInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/TimeInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/Vec3Input.cjs +1 -1
- package/dist/ui/inputs/number-inputs/Vec3Input.mjs +1 -1
- package/dist/ui/inputs/number-inputs/VectorInput.cjs +1 -1
- package/dist/ui/inputs/number-inputs/VectorInput.mjs +1 -1
- package/dist/ui/inputs/number-inputs/index.cjs +11 -11
- package/dist/ui/inputs/number-inputs/index.mjs +3 -3
- package/dist/ui/inputs/presets-input.cjs +1 -1
- package/dist/ui/inputs/presets-input.mjs +1 -1
- package/dist/ui/label.cjs +1 -1
- package/dist/ui/label.mjs +1 -1
- package/dist/ui/layout.cjs +1 -1
- package/dist/ui/layout.mjs +1 -1
- package/dist/ui/layouts/dock-layout/DockLayoutView.cjs +1 -1
- package/dist/ui/layouts/dock-layout/DockLayoutView.mjs +1 -1
- package/dist/ui/layouts/dock-layout/LayoutSlots.cjs +1 -1
- package/dist/ui/layouts/dock-layout/LayoutSlots.mjs +1 -1
- package/dist/ui/layouts/dock-layout/index.cjs +1 -1
- package/dist/ui/layouts/dock-layout/index.mjs +1 -1
- package/dist/ui/layouts/index.cjs +2 -2
- package/dist/ui/layouts/index.mjs +2 -2
- package/dist/ui/layouts/liquid-layout/LayoutSlots.cjs +1 -1
- package/dist/ui/layouts/liquid-layout/LayoutSlots.mjs +1 -1
- package/dist/ui/layouts/liquid-layout/LiquidLayoutView.cjs +1 -1
- package/dist/ui/layouts/liquid-layout/LiquidLayoutView.mjs +1 -1
- package/dist/ui/layouts/liquid-layout/index.cjs +1 -1
- package/dist/ui/layouts/liquid-layout/index.mjs +1 -1
- package/dist/ui/modal.cjs +1 -1
- package/dist/ui/modal.mjs +1 -1
- package/dist/ui/navigation.cjs +1 -1
- package/dist/ui/navigation.mjs +1 -1
- package/dist/ui/pagination.cjs +1 -1
- package/dist/ui/pagination.mjs +1 -1
- package/dist/ui/panel.cjs +1 -1
- package/dist/ui/panel.mjs +1 -1
- package/dist/ui/popover.cjs +1 -1
- package/dist/ui/popover.mjs +1 -1
- package/dist/ui/radio-group.cjs +1 -1
- package/dist/ui/radio-group.mjs +1 -1
- package/dist/ui/resizable.cjs +1 -1
- package/dist/ui/resizable.mjs +1 -1
- package/dist/ui/select.cjs +1 -1
- package/dist/ui/select.d.cts +1 -1
- package/dist/ui/select.d.ts +1 -1
- package/dist/ui/select.mjs +1 -1
- package/dist/ui/separator.cjs +1 -1
- package/dist/ui/separator.mjs +1 -1
- package/dist/ui/sheet.cjs +1 -1
- package/dist/ui/sheet.mjs +1 -1
- package/dist/ui/sidebar.cjs +26 -26
- package/dist/ui/sidebar.mjs +2 -2
- package/dist/ui/simple-tree-view.cjs +1 -1
- package/dist/ui/simple-tree-view.mjs +1 -1
- package/dist/ui/skeleton.cjs +1 -1
- package/dist/ui/skeleton.mjs +1 -1
- package/dist/ui/slider.cjs +1 -1
- package/dist/ui/slider.mjs +1 -1
- package/dist/ui/switch.cjs +1 -1
- package/dist/ui/switch.mjs +1 -1
- package/dist/ui/table.cjs +1 -1
- package/dist/ui/table.mjs +1 -1
- package/dist/ui/tabs.cjs +1 -1
- package/dist/ui/tabs.mjs +1 -1
- package/dist/ui/textarea.cjs +1 -1
- package/dist/ui/textarea.d.cts +1 -1
- package/dist/ui/textarea.d.ts +1 -1
- package/dist/ui/textarea.mjs +1 -1
- package/dist/ui/theme/ThemeToggles.cjs +1 -1
- package/dist/ui/theme/ThemeToggles.mjs +1 -1
- package/dist/ui/theme/index.cjs +1 -1
- package/dist/ui/theme/index.mjs +1 -1
- package/dist/ui/toggle-buttons.cjs +1 -1
- package/dist/ui/toggle-buttons.mjs +1 -1
- package/dist/ui/toggle-group.cjs +1 -1
- package/dist/ui/toggle-group.mjs +1 -1
- package/dist/ui/toggle.cjs +1 -1
- package/dist/ui/toggle.mjs +1 -1
- package/dist/ui/toolbar.cjs +1 -1
- package/dist/ui/toolbar.mjs +1 -1
- package/dist/ui/tooltip.cjs +1 -1
- package/dist/ui/tooltip.mjs +1 -1
- package/dist/ui/tree-view/TreeSearchBar.cjs +1 -1
- package/dist/ui/tree-view/TreeSearchBar.mjs +1 -1
- package/dist/ui/tree-view/TreeView.cjs +1 -1
- package/dist/ui/tree-view/TreeView.mjs +1 -1
- package/dist/ui/tree-view/index.cjs +6 -6
- package/dist/ui/tree-view/index.mjs +2 -2
- package/dist/ui/tree-view-legacy.cjs +9 -9
- package/dist/ui/tree-view-legacy.mjs +5 -5
- package/dist/ui/waterfall/CursorOverlay.cjs +1 -1
- package/dist/ui/waterfall/CursorOverlay.mjs +1 -1
- package/dist/ui/waterfall/TimelineEvent.cjs +1 -1
- package/dist/ui/waterfall/TimelineEvent.mjs +1 -1
- package/dist/ui/waterfall/TimelineProcessBar.cjs +1 -1
- package/dist/ui/waterfall/TimelineProcessBar.mjs +1 -1
- package/dist/ui/waterfall/Wedges.cjs +1 -1
- package/dist/ui/waterfall/Wedges.mjs +1 -1
- package/dist/ui/waterfall/index.cjs +8 -8
- package/dist/ui/waterfall/index.mjs +7 -7
- package/package.json +28 -2
- package/src/SyncScroll/README.md +283 -0
- package/src/SyncScroll/SyncScroll.tsx +361 -0
- package/src/SyncScroll/index.ts +22 -0
- package/src/SyncScroll/useSyncScroll.tsx +226 -0
- package/src/cli/dial-cli.ts +1133 -0
- package/src/dial/DialPanel.tsx +208 -0
- package/src/dial/DialProvider.example.tsx +80 -0
- package/src/dial/DialProvider.tsx +138 -0
- package/src/dial/index.ts +26 -0
- package/src/dial/wrapped-inputs/ControlledInputs.tsx +176 -0
- package/src/dial/wrapped-inputs/DialInputs.tsx +401 -0
- package/src/dial/wrapped-inputs/DialVectorInput.tsx +125 -0
- package/src/dial/wrapped-inputs/index.ts +25 -0
- package/src/highlight-cursor/cursor-context.tsx +23 -0
- package/src/highlight-cursor/cursor-provider.tsx +264 -0
- package/src/highlight-cursor/enhanced-components.tsx +16 -0
- package/src/highlight-cursor/index.ts +21 -0
- package/src/highlight-cursor/tabs-cursor-context.tsx +121 -0
- package/src/highlight-cursor/types.ts +40 -0
- package/src/highlight-cursor/with-cursor.tsx +144 -0
- package/src/hooks/clientOnly.tsx +54 -0
- package/src/hooks/cn.ts +33 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useDocument.tsx +18 -0
- package/src/hooks/useDragSelect.ts +116 -0
- package/src/hooks/useIsMobile.ts +35 -0
- package/src/hooks/useLocalStorage.ts +122 -0
- package/src/hooks/useLocation.tsx +95 -0
- package/src/hooks/useQueryParams.tsx +31 -0
- package/src/hooks/useWindow.tsx +18 -0
- package/src/index.css +5 -0
- package/src/index.ts +5 -0
- package/src/styles/.editorconfig +0 -0
- package/src/styles/theme.css +152 -0
- package/src/styles/toast.css +67 -0
- package/src/styles/variables.css +229 -0
- package/src/ui/UIKitBadge.tsx +171 -0
- package/src/ui/avatar.tsx +221 -0
- package/src/ui/badge.tsx +74 -0
- package/src/ui/button.tsx +143 -0
- package/src/ui/card.tsx +146 -0
- package/src/ui/checkbox.tsx +78 -0
- package/src/ui/collapsible.tsx +43 -0
- package/src/ui/drag-selectable/DragSelectProvider.tsx +178 -0
- package/src/ui/drag-selectable/createSelectable.tsx +43 -0
- package/src/ui/drag-selectable/index.ts +2 -0
- package/src/ui/drawer.tsx +137 -0
- package/src/ui/dropdown.tsx +707 -0
- package/src/ui/icons/MouseCursorIcons.tsx +39 -0
- package/src/ui/icons/cursor.tsx +38 -0
- package/src/ui/icons/index.ts +2 -0
- package/src/ui/index.ts +45 -0
- package/src/ui/inputs/color-input.tsx +61 -0
- package/src/ui/inputs/index.tsx +5 -0
- package/src/ui/inputs/input-numbers.tsx +394 -0
- package/src/ui/inputs/input.tsx +155 -0
- package/src/ui/inputs/number-inputs/CmInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/DegInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/EulerDegInput.tsx +14 -0
- package/src/ui/inputs/number-inputs/EulerInput.tsx +30 -0
- package/src/ui/inputs/number-inputs/EulerRadInput.tsx +14 -0
- package/src/ui/inputs/number-inputs/InchInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/IntInput.tsx +46 -0
- package/src/ui/inputs/number-inputs/KVectorInput.tsx +20 -0
- package/src/ui/inputs/number-inputs/QuaternionInput.tsx +27 -0
- package/src/ui/inputs/number-inputs/RadInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/TimeInput.tsx +26 -0
- package/src/ui/inputs/number-inputs/Vec3Input.tsx +26 -0
- package/src/ui/inputs/number-inputs/VectorInput.tsx +38 -0
- package/src/ui/inputs/number-inputs/index.ts +38 -0
- package/src/ui/inputs/presets-input.tsx +59 -0
- package/src/ui/label.tsx +35 -0
- package/src/ui/layout.tsx +43 -0
- package/src/ui/layouts/dock-layout/DockLayoutView.tsx +128 -0
- package/src/ui/layouts/dock-layout/LayoutSlots.tsx +85 -0
- package/src/ui/layouts/dock-layout/index.tsx +2 -0
- package/src/ui/layouts/index.ts +2 -0
- package/src/ui/layouts/liquid-layout/LayoutSlots.tsx +82 -0
- package/src/ui/layouts/liquid-layout/LiquidLayoutView.tsx +76 -0
- package/src/ui/layouts/liquid-layout/index.ts +1 -0
- package/src/ui/modal.tsx +211 -0
- package/src/ui/navigation.tsx +86 -0
- package/src/ui/pagination.tsx +129 -0
- package/src/ui/panel.tsx +146 -0
- package/src/ui/popover.tsx +112 -0
- package/src/ui/radio-group.tsx +63 -0
- package/src/ui/resizable.tsx +52 -0
- package/src/ui/select.tsx +365 -0
- package/src/ui/separator.tsx +26 -0
- package/src/ui/sheet.tsx +257 -0
- package/src/ui/sidebar.tsx +695 -0
- package/src/ui/simple-tree-view.tsx +604 -0
- package/src/ui/skeleton.tsx +15 -0
- package/src/ui/slider.tsx +204 -0
- package/src/ui/switch.tsx +45 -0
- package/src/ui/table.tsx +99 -0
- package/src/ui/tabs.tsx +192 -0
- package/src/ui/textarea.tsx +55 -0
- package/src/ui/theme/ThemeProvider.tsx +319 -0
- package/src/ui/theme/ThemeToggles.tsx +84 -0
- package/src/ui/theme/index.ts +21 -0
- package/src/ui/theme/themeScript.tsx +179 -0
- package/src/ui/theme/types.ts +61 -0
- package/src/ui/toast.tsx +30 -0
- package/src/ui/toggle-buttons.tsx +290 -0
- package/src/ui/toggle-group.tsx +236 -0
- package/src/ui/toggle.tsx +94 -0
- package/src/ui/toolbar.tsx +54 -0
- package/src/ui/tooltip.tsx +171 -0
- package/src/ui/tree-view/TreeSearchBar.tsx +88 -0
- package/src/ui/tree-view/TreeView.tsx +232 -0
- package/src/ui/tree-view/hooks.tsx +289 -0
- package/src/ui/tree-view/index.ts +4 -0
- package/src/ui/tree-view/types.ts +23 -0
- package/src/ui/tree-view-legacy.tsx +644 -0
- package/src/ui/version-badge.tsx +0 -0
- package/src/ui/waterfall/CursorOverlay.tsx +96 -0
- package/src/ui/waterfall/NavigationControls.tsx +42 -0
- package/src/ui/waterfall/Tick.tsx +51 -0
- package/src/ui/waterfall/TimeRuleEventDot.tsx +19 -0
- package/src/ui/waterfall/TimelineEvent.tsx +60 -0
- package/src/ui/waterfall/TimelineProcessBar.tsx +207 -0
- package/src/ui/waterfall/Wedges.tsx +67 -0
- package/src/ui/waterfall/WheelZoomContext.tsx +128 -0
- package/src/ui/waterfall/hooks/useTimelineState.tsx +134 -0
- package/src/ui/waterfall/hooks/useViewport.tsx +293 -0
- package/src/ui/waterfall/index.tsx +326 -0
- package/src/ui/waterfall/types.ts +20 -0
- package/src/ui/waterfall/utils.ts +91 -0
- package/dist/chunk-W2YAQV5N.mjs +0 -57
- package/dist/{chunk-QLCEHV4Q.mjs → chunk-2OZK5DY5.mjs} +2 -2
- package/dist/{chunk-Z35DNFRZ.cjs → chunk-7IS37C3P.cjs} +2 -2
- package/dist/{chunk-4AOAH77D.mjs → chunk-A2PCEL5S.mjs} +2 -2
- package/dist/{chunk-K4VD5PPY.mjs → chunk-BIUDC66P.mjs} +1 -1
- package/dist/{chunk-RKJR6RZU.cjs → chunk-OYNLQTHW.cjs} +1 -1
- package/dist/{chunk-VE3XLQLO.cjs → chunk-QUFZWF4E.cjs} +2 -2
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
2
|
+
import { ComponentProps, useEffect, useState } from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../hooks";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Provider for tooltip behavior; renders children during SSR to avoid mismatch.
|
|
8
|
+
*/
|
|
9
|
+
function TooltipProvider({
|
|
10
|
+
delayDuration = 0,
|
|
11
|
+
children,
|
|
12
|
+
...props
|
|
13
|
+
}: ComponentProps<typeof TooltipPrimitive.Provider>) {
|
|
14
|
+
const [isClient, setIsClient] = useState(false);
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setIsClient(true);
|
|
18
|
+
}, []);
|
|
19
|
+
|
|
20
|
+
// Don't render anything during SSR
|
|
21
|
+
if (!isClient) {
|
|
22
|
+
return <>{children}</>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<TooltipPrimitive.Provider
|
|
27
|
+
data-slot="tooltip-provider"
|
|
28
|
+
delayDuration={delayDuration}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
</TooltipPrimitive.Provider>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Wrapper root for a tooltip. Skips tooltip logic during SSR.
|
|
38
|
+
*/
|
|
39
|
+
function Tooltip({ children, ...props }: ComponentProps<typeof TooltipPrimitive.Root>) {
|
|
40
|
+
const [isClient, setIsClient] = useState(false);
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
setIsClient(true);
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
// During SSR, just render children without tooltip functionality
|
|
47
|
+
if (!isClient) {
|
|
48
|
+
return <>{children}</>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<TooltipProvider>
|
|
53
|
+
<TooltipPrimitive.Root data-slot="tooltip" {...props}>
|
|
54
|
+
{children}
|
|
55
|
+
</TooltipPrimitive.Root>
|
|
56
|
+
</TooltipProvider>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Element that triggers the tooltip.
|
|
62
|
+
*/
|
|
63
|
+
function TooltipTrigger({ ...props }: ComponentProps<typeof TooltipPrimitive.Trigger>) {
|
|
64
|
+
const [isClient, setIsClient] = useState(false);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
setIsClient(true);
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
// During SSR, just render children without tooltip functionality
|
|
71
|
+
if (!isClient) {
|
|
72
|
+
return <>{props.children}</>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Floating tooltip content panel.
|
|
80
|
+
*/
|
|
81
|
+
function TooltipContent({
|
|
82
|
+
className,
|
|
83
|
+
sideOffset = 0,
|
|
84
|
+
children,
|
|
85
|
+
side,
|
|
86
|
+
...props
|
|
87
|
+
}: ComponentProps<typeof TooltipPrimitive.Content>) {
|
|
88
|
+
const [isClient, setIsClient] = useState(false);
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
setIsClient(true);
|
|
92
|
+
}, []);
|
|
93
|
+
|
|
94
|
+
// During SSR, don't render tooltip content
|
|
95
|
+
if (!isClient) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const getLiquidBgClass = (side?: string) => {
|
|
100
|
+
switch (side) {
|
|
101
|
+
case "top":
|
|
102
|
+
return "liquid:liquid-bg-tooltip-top";
|
|
103
|
+
case "bottom":
|
|
104
|
+
return "liquid:liquid-bg-tooltip-bottom";
|
|
105
|
+
case "left":
|
|
106
|
+
return "liquid:liquid-bg-tooltip-left";
|
|
107
|
+
case "right":
|
|
108
|
+
return "liquid:liquid-bg-tooltip-right";
|
|
109
|
+
default:
|
|
110
|
+
return "liquid:liquid-bg-tooltip-content";
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<TooltipPrimitive.Portal>
|
|
116
|
+
<TooltipPrimitive.Content
|
|
117
|
+
data-slot="tooltip-content"
|
|
118
|
+
sideOffset={sideOffset}
|
|
119
|
+
side={side}
|
|
120
|
+
className={cn(
|
|
121
|
+
"bg-bg-primary",
|
|
122
|
+
getLiquidBgClass(side),
|
|
123
|
+
"text-text-primary",
|
|
124
|
+
"animate-in",
|
|
125
|
+
"text-uk-sm",
|
|
126
|
+
"leading-uk-sm",
|
|
127
|
+
"rounded-uk-md",
|
|
128
|
+
"px-lg",
|
|
129
|
+
"py-md",
|
|
130
|
+
"shadow-[0_4px_16px_0_var(--color-shadow-secondary)]",
|
|
131
|
+
"liquid:shadow-none",
|
|
132
|
+
"fade-in-0",
|
|
133
|
+
"zoom-in-95",
|
|
134
|
+
"data-[state=closed]:animate-out",
|
|
135
|
+
"data-[state=closed]:fade-out-0",
|
|
136
|
+
"data-[state=closed]:zoom-out-95",
|
|
137
|
+
"data-[side=bottom]:slide-in-from-top-2",
|
|
138
|
+
"data-[side=left]:slide-in-from-right-2",
|
|
139
|
+
"data-[side=right]:slide-in-from-left-2",
|
|
140
|
+
"data-[side=top]:slide-in-from-bottom-2",
|
|
141
|
+
"z-50",
|
|
142
|
+
"w-fit",
|
|
143
|
+
"origin-(--radix-tooltip-content-transform-origin)",
|
|
144
|
+
"text-balance",
|
|
145
|
+
className,
|
|
146
|
+
)}
|
|
147
|
+
{...props}
|
|
148
|
+
>
|
|
149
|
+
{children}
|
|
150
|
+
<TooltipPrimitive.Arrow asChild>
|
|
151
|
+
<div
|
|
152
|
+
className={cn(
|
|
153
|
+
"z-50",
|
|
154
|
+
"h-[9px] w-[15px]",
|
|
155
|
+
"border-none",
|
|
156
|
+
"bg-bg-primary",
|
|
157
|
+
"liquid:liquid-bg-tooltip-arrow",
|
|
158
|
+
"relative",
|
|
159
|
+
)}
|
|
160
|
+
style={{
|
|
161
|
+
clipPath: "polygon(50% 100%, 0% 0%, 100% 0%)",
|
|
162
|
+
borderRadius: "1px 1px 0 0",
|
|
163
|
+
}}
|
|
164
|
+
/>
|
|
165
|
+
</TooltipPrimitive.Arrow>
|
|
166
|
+
</TooltipPrimitive.Content>
|
|
167
|
+
</TooltipPrimitive.Portal>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { CaseSensitive, Regex, Search } from "lucide-react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../hooks";
|
|
5
|
+
import { InputRoot, InputSlot } from "../inputs/input";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../tooltip";
|
|
7
|
+
|
|
8
|
+
export type TreeSearchBarProps = {
|
|
9
|
+
searchQuery: string;
|
|
10
|
+
setSearchQuery: (query: string) => void;
|
|
11
|
+
isCaseSensitive: boolean;
|
|
12
|
+
setIsCaseSensitive: (value: boolean | ((prev: boolean) => boolean)) => void;
|
|
13
|
+
isRegex: boolean;
|
|
14
|
+
setIsRegex: (value: boolean | ((prev: boolean) => boolean)) => void;
|
|
15
|
+
isRegexValid: boolean;
|
|
16
|
+
searchResultsCount: number;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function TreeSearchBar({
|
|
21
|
+
searchQuery,
|
|
22
|
+
setSearchQuery,
|
|
23
|
+
isCaseSensitive,
|
|
24
|
+
setIsCaseSensitive,
|
|
25
|
+
isRegex,
|
|
26
|
+
setIsRegex,
|
|
27
|
+
isRegexValid,
|
|
28
|
+
searchResultsCount,
|
|
29
|
+
className,
|
|
30
|
+
}: TreeSearchBarProps) {
|
|
31
|
+
return (
|
|
32
|
+
<div className={cn("shrink-0", className)}>
|
|
33
|
+
<InputRoot
|
|
34
|
+
type="text"
|
|
35
|
+
placeholder="Search..."
|
|
36
|
+
size="sm"
|
|
37
|
+
className="flex-1"
|
|
38
|
+
inputClassName={cn(!isRegexValid && "text-red-500")}
|
|
39
|
+
value={searchQuery}
|
|
40
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setSearchQuery(e.target.value)}
|
|
41
|
+
>
|
|
42
|
+
<InputSlot side="left">
|
|
43
|
+
<Search className="text-text-secondary size-4 stroke-1" />
|
|
44
|
+
</InputSlot>
|
|
45
|
+
<InputSlot side="right">
|
|
46
|
+
<TooltipProvider delayDuration={200}>
|
|
47
|
+
<Tooltip>
|
|
48
|
+
<TooltipTrigger asChild>
|
|
49
|
+
<button
|
|
50
|
+
onClick={() => setIsCaseSensitive((prev) => !prev)}
|
|
51
|
+
className={cn(
|
|
52
|
+
"rounded-uk-sm mr-1 p-1",
|
|
53
|
+
isCaseSensitive ? "bg-shadow-secondary" : "",
|
|
54
|
+
)}
|
|
55
|
+
>
|
|
56
|
+
<CaseSensitive className="size-4" />
|
|
57
|
+
</button>
|
|
58
|
+
</TooltipTrigger>
|
|
59
|
+
<TooltipContent>
|
|
60
|
+
<p>Case Sensitive</p>
|
|
61
|
+
</TooltipContent>
|
|
62
|
+
</Tooltip>
|
|
63
|
+
<Tooltip>
|
|
64
|
+
<TooltipTrigger asChild>
|
|
65
|
+
<button
|
|
66
|
+
onClick={() => setIsRegex((prev) => !prev)}
|
|
67
|
+
className={cn("rounded-uk-sm p-1", isRegex && "bg-shadow-secondary")}
|
|
68
|
+
>
|
|
69
|
+
<Regex className="size-4" />
|
|
70
|
+
</button>
|
|
71
|
+
</TooltipTrigger>
|
|
72
|
+
<TooltipContent>
|
|
73
|
+
<p>Use Regular Expression</p>
|
|
74
|
+
</TooltipContent>
|
|
75
|
+
</Tooltip>
|
|
76
|
+
</TooltipProvider>
|
|
77
|
+
</InputSlot>
|
|
78
|
+
</InputRoot>
|
|
79
|
+
{searchQuery && isRegexValid && (
|
|
80
|
+
<div className="flex justify-end px-2 pb-1">
|
|
81
|
+
<span className="text-uk-xs text-text-secondary">
|
|
82
|
+
{searchResultsCount} result{searchResultsCount !== 1 ? "s" : ""}
|
|
83
|
+
</span>
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { ChevronDown } from "lucide-react";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
import { TreeDataItem, TreeDataItemWithMeta } from "./types";
|
|
5
|
+
import { cn } from "../../hooks";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Props for the view-only tree component
|
|
9
|
+
*/
|
|
10
|
+
export type TreeViewProps<T extends TreeDataItem> = {
|
|
11
|
+
data: TreeDataItemWithMeta<T>[];
|
|
12
|
+
getIcon: (item: T, expanded?: boolean) => ReactNode;
|
|
13
|
+
expandedItems?: Set<string>;
|
|
14
|
+
onToggleItem?: (id: string) => void;
|
|
15
|
+
onItemHover?: (id: string | null) => void;
|
|
16
|
+
hoveredId?: string | null;
|
|
17
|
+
isSelectable?: boolean;
|
|
18
|
+
selectedItemId?: string | null;
|
|
19
|
+
onSelectChange?: (id: string | null) => void;
|
|
20
|
+
hideExpand?: boolean;
|
|
21
|
+
hasDescendants?: (id: string) => boolean;
|
|
22
|
+
renderLabel?: (label: string, itemId: string) => ReactNode;
|
|
23
|
+
className?: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* TreeView component - a simple wrapper that maps over data.
|
|
28
|
+
* For more control, use TreeEntryItem directly.
|
|
29
|
+
* Wrap with SyncScroll if synchronized scrolling is needed.
|
|
30
|
+
*/
|
|
31
|
+
export function TreeView<T extends TreeDataItem>({
|
|
32
|
+
data,
|
|
33
|
+
getIcon,
|
|
34
|
+
expandedItems,
|
|
35
|
+
onToggleItem,
|
|
36
|
+
onItemHover,
|
|
37
|
+
hoveredId,
|
|
38
|
+
isSelectable = false,
|
|
39
|
+
selectedItemId,
|
|
40
|
+
onSelectChange,
|
|
41
|
+
hideExpand = false,
|
|
42
|
+
hasDescendants = () => false,
|
|
43
|
+
renderLabel = (label) => label,
|
|
44
|
+
className,
|
|
45
|
+
}: TreeViewProps<T>) {
|
|
46
|
+
return (
|
|
47
|
+
<div className={cn("flex-1 overflow-y-auto", className)}>
|
|
48
|
+
{data.map((item) => (
|
|
49
|
+
<TreeEntryItem
|
|
50
|
+
key={item.id}
|
|
51
|
+
item={item}
|
|
52
|
+
hoveredId={hoveredId}
|
|
53
|
+
onItemHover={onItemHover}
|
|
54
|
+
isSelectable={isSelectable}
|
|
55
|
+
selectedItemId={selectedItemId}
|
|
56
|
+
onSelectChange={onSelectChange}
|
|
57
|
+
expandedItems={expandedItems}
|
|
58
|
+
toggleItem={onToggleItem}
|
|
59
|
+
hideExpand={hideExpand}
|
|
60
|
+
hasDescendants={hasDescendants}
|
|
61
|
+
getIcon={getIcon}
|
|
62
|
+
renderLabel={renderLabel}
|
|
63
|
+
dataWithMeta={data}
|
|
64
|
+
/>
|
|
65
|
+
))}
|
|
66
|
+
</div>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Individual tree entry item component - can be used directly for custom implementations
|
|
72
|
+
*/
|
|
73
|
+
export function TreeEntryItem<T extends TreeDataItem>({
|
|
74
|
+
item,
|
|
75
|
+
hoveredId,
|
|
76
|
+
onItemHover,
|
|
77
|
+
isSelectable,
|
|
78
|
+
selectedItemId,
|
|
79
|
+
onSelectChange,
|
|
80
|
+
expandedItems,
|
|
81
|
+
toggleItem = () => {},
|
|
82
|
+
hideExpand = false,
|
|
83
|
+
hasDescendants = () => false,
|
|
84
|
+
getIcon = () => null,
|
|
85
|
+
renderLabel = (label) => label,
|
|
86
|
+
dataWithMeta = [],
|
|
87
|
+
}: {
|
|
88
|
+
item: TreeDataItemWithMeta<T>;
|
|
89
|
+
hoveredId?: string | null;
|
|
90
|
+
onItemHover?: (id: string | null) => void;
|
|
91
|
+
isSelectable?: boolean;
|
|
92
|
+
selectedItemId?: string | null;
|
|
93
|
+
onSelectChange?: (id: string | null) => void;
|
|
94
|
+
expandedItems?: Set<string>;
|
|
95
|
+
toggleItem?: (id: string) => void;
|
|
96
|
+
hideExpand?: boolean;
|
|
97
|
+
hasDescendants?: (id: string) => boolean;
|
|
98
|
+
getIcon?: (item: T, expanded?: boolean) => ReactNode;
|
|
99
|
+
renderLabel?: (label: string, itemId: string) => ReactNode;
|
|
100
|
+
dataWithMeta?: TreeDataItemWithMeta<T>[];
|
|
101
|
+
}) {
|
|
102
|
+
const handleItemSelect = () => {
|
|
103
|
+
if (!item.disable && isSelectable && onSelectChange) {
|
|
104
|
+
onSelectChange(selectedItemId === item.id ? null : item.id);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// Ensure we have the required metadata
|
|
109
|
+
const ancestors = item.ancestors || [];
|
|
110
|
+
const indent = item.indent || 0;
|
|
111
|
+
const isLast = item.isLast !== undefined ? item.isLast : false;
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<div
|
|
115
|
+
className={cn(
|
|
116
|
+
"group relative flex h-[32px] items-center",
|
|
117
|
+
isSelectable && "rounded-uk-md",
|
|
118
|
+
!item.disable && "cursor-pointer",
|
|
119
|
+
hoveredId === item.id && !item.disable && "bg-bg-secondary",
|
|
120
|
+
isSelectable && selectedItemId === item.id && "bg-brand-primary text-text-withbg",
|
|
121
|
+
)}
|
|
122
|
+
onMouseEnter={() => onItemHover?.(item.id)}
|
|
123
|
+
onMouseLeave={() => onItemHover?.(null)}
|
|
124
|
+
onClick={handleItemSelect}
|
|
125
|
+
>
|
|
126
|
+
{/* Guidelines */}
|
|
127
|
+
<div className="absolute top-0 left-[-0.28rem] z-0 flex h-full items-center">
|
|
128
|
+
{ancestors.map((ancestor, index) => {
|
|
129
|
+
const parentIsLast = dataWithMeta.find((d) => d.id === ancestor.id)?.isLast;
|
|
130
|
+
return (
|
|
131
|
+
<div
|
|
132
|
+
key={index}
|
|
133
|
+
className={cn(
|
|
134
|
+
"h-full w-[1.25rem]",
|
|
135
|
+
parentIsLast ? "" : "border-l",
|
|
136
|
+
"border-line-primary",
|
|
137
|
+
)}
|
|
138
|
+
/>
|
|
139
|
+
);
|
|
140
|
+
})}
|
|
141
|
+
{indent > 0 && (
|
|
142
|
+
<div className="relative h-full w-[1.24rem]">
|
|
143
|
+
<div
|
|
144
|
+
className={cn(
|
|
145
|
+
"absolute top-0 left-0 h-1/2 w-1/2 border-b border-l",
|
|
146
|
+
isLast ? "rounded-bl-md" : "",
|
|
147
|
+
"border-line-primary",
|
|
148
|
+
)}
|
|
149
|
+
/>
|
|
150
|
+
{!isLast && (
|
|
151
|
+
<div className="border-line-primary absolute top-1/2 left-0 h-1/2 w-1/2 border-l" />
|
|
152
|
+
)}
|
|
153
|
+
</div>
|
|
154
|
+
)}
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<div
|
|
158
|
+
className="text-uk-md z-10 flex w-full items-center justify-between gap-2 px-2 font-light whitespace-nowrap"
|
|
159
|
+
style={{ paddingLeft: `${indent * 1.25 + 0.5}rem` }}
|
|
160
|
+
>
|
|
161
|
+
<div className="flex min-w-0 flex-1 items-center gap-1">
|
|
162
|
+
{!hideExpand && hasDescendants(item.id) ? (
|
|
163
|
+
<>
|
|
164
|
+
<button
|
|
165
|
+
onClick={(e) => {
|
|
166
|
+
e.stopPropagation();
|
|
167
|
+
toggleItem(item.id);
|
|
168
|
+
}}
|
|
169
|
+
className="flex size-4 cursor-pointer items-center justify-center"
|
|
170
|
+
>
|
|
171
|
+
<ChevronDown
|
|
172
|
+
className={cn(
|
|
173
|
+
"size-4 transition-transform",
|
|
174
|
+
expandedItems && !expandedItems?.has(item.id) && "-rotate-90",
|
|
175
|
+
item.disable && "text-icon-tertiary",
|
|
176
|
+
)}
|
|
177
|
+
strokeWidth={1.5}
|
|
178
|
+
/>
|
|
179
|
+
</button>
|
|
180
|
+
<div
|
|
181
|
+
className={cn(
|
|
182
|
+
"flex size-4 items-center justify-center",
|
|
183
|
+
item.disable && "text-icon-tertiary",
|
|
184
|
+
)}
|
|
185
|
+
>
|
|
186
|
+
{getIcon(item, expandedItems?.has?.(item.id))}
|
|
187
|
+
</div>
|
|
188
|
+
</>
|
|
189
|
+
) : (
|
|
190
|
+
<div className="relative flex size-4 items-center justify-center">
|
|
191
|
+
{item.isCollapsible && (
|
|
192
|
+
<button
|
|
193
|
+
onClick={(e) => {
|
|
194
|
+
e.stopPropagation();
|
|
195
|
+
toggleItem(item.id);
|
|
196
|
+
}}
|
|
197
|
+
className="absolute z-20 flex cursor-pointer items-center justify-center opacity-0 transition-opacity group-hover:opacity-100"
|
|
198
|
+
>
|
|
199
|
+
<ChevronDown
|
|
200
|
+
className={cn(
|
|
201
|
+
"size-4 transition-transform",
|
|
202
|
+
expandedItems && !expandedItems?.has(item.id) && "-rotate-90",
|
|
203
|
+
item.disable && "text-icon-tertiary",
|
|
204
|
+
)}
|
|
205
|
+
strokeWidth={1.5}
|
|
206
|
+
/>
|
|
207
|
+
</button>
|
|
208
|
+
)}
|
|
209
|
+
<div
|
|
210
|
+
className={cn(
|
|
211
|
+
"cursor-pointer transition-opacity",
|
|
212
|
+
item.isCollapsible && "group-hover:opacity-0",
|
|
213
|
+
item.disable && "text-icon-tertiary",
|
|
214
|
+
)}
|
|
215
|
+
>
|
|
216
|
+
{getIcon(item, expandedItems?.has(item.id))}
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
)}
|
|
220
|
+
<span className={cn("truncate", item.disable && "text-text-tertiary")}>
|
|
221
|
+
{renderLabel(item.label, item.id)}
|
|
222
|
+
</span>
|
|
223
|
+
</div>
|
|
224
|
+
{item.actions && (
|
|
225
|
+
<div className="flex items-center gap-1" onClick={(e) => e.stopPropagation()}>
|
|
226
|
+
{item.actions}
|
|
227
|
+
</div>
|
|
228
|
+
)}
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
);
|
|
232
|
+
}
|