@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,39 @@
|
|
|
1
|
+
interface IconProps {
|
|
2
|
+
strokeWidth?: number;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export const MouseCursorIcon = ({ strokeWidth = 2.25 }: IconProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<svg
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
width="16"
|
|
10
|
+
height="16"
|
|
11
|
+
viewBox="0 0 24 24"
|
|
12
|
+
fill="none"
|
|
13
|
+
stroke="currentColor"
|
|
14
|
+
strokeWidth={strokeWidth}
|
|
15
|
+
strokeLinecap="round"
|
|
16
|
+
strokeLinejoin="round"
|
|
17
|
+
className="lucide lucide-mouse-pointer2-icon lucide-mouse-pointer-2"
|
|
18
|
+
>
|
|
19
|
+
<path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z" />
|
|
20
|
+
</svg>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const MouseCursorAltIcon = ({ strokeWidth = 2.25 }: IconProps) => {
|
|
25
|
+
return (
|
|
26
|
+
<svg
|
|
27
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
28
|
+
width="16"
|
|
29
|
+
height="16"
|
|
30
|
+
viewBox="0 0 24 24"
|
|
31
|
+
fill="currentColor"
|
|
32
|
+
stroke="currentColor"
|
|
33
|
+
strokeWidth={strokeWidth / 2}
|
|
34
|
+
className="lucide lucide-mouse-pointer2-icon lucide-mouse-pointer-2"
|
|
35
|
+
>
|
|
36
|
+
<path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z" />
|
|
37
|
+
</svg>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
interface IconProps {
|
|
2
|
+
strokeWidth?: number;
|
|
3
|
+
}
|
|
4
|
+
export const CursorFilledIcon = ({ strokeWidth = 2.25 }: IconProps) => {
|
|
5
|
+
return (
|
|
6
|
+
<svg
|
|
7
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
width="16"
|
|
9
|
+
height="16"
|
|
10
|
+
viewBox="0 0 24 24"
|
|
11
|
+
fill="currentColor"
|
|
12
|
+
stroke="currentColor"
|
|
13
|
+
strokeWidth={strokeWidth / 2}
|
|
14
|
+
className="lucide lucide-mouse-pointer2-icon lucide-mouse-pointer-2"
|
|
15
|
+
>
|
|
16
|
+
<path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z" />
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const CursorIcon = ({ strokeWidth = 2.25 }: IconProps) => {
|
|
22
|
+
return (
|
|
23
|
+
<svg
|
|
24
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
25
|
+
width="16"
|
|
26
|
+
height="16"
|
|
27
|
+
viewBox="0 0 24 24"
|
|
28
|
+
fill="none"
|
|
29
|
+
stroke="currentColor"
|
|
30
|
+
strokeWidth={strokeWidth}
|
|
31
|
+
strokeLinecap="round"
|
|
32
|
+
strokeLinejoin="round"
|
|
33
|
+
className="lucide lucide-mouse-pointer2-icon lucide-mouse-pointer-2"
|
|
34
|
+
>
|
|
35
|
+
<path d="M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z" />
|
|
36
|
+
</svg>
|
|
37
|
+
);
|
|
38
|
+
};
|
package/src/ui/index.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export * from "./waterfall";
|
|
2
|
+
export * from "./navigation";
|
|
3
|
+
export * from "./table";
|
|
4
|
+
export * from "./pagination";
|
|
5
|
+
export * from "./sidebar";
|
|
6
|
+
export * from "./drawer";
|
|
7
|
+
export * from "./tree-view";
|
|
8
|
+
export { TreeView as TreeViewLegacy } from "./tree-view-legacy";
|
|
9
|
+
export * from "./simple-tree-view";
|
|
10
|
+
export * from "./sheet";
|
|
11
|
+
export * from "./popover";
|
|
12
|
+
export * from "./avatar";
|
|
13
|
+
export * from "./tooltip";
|
|
14
|
+
export * from "./toast";
|
|
15
|
+
export * from "./textarea";
|
|
16
|
+
export * from "./dropdown";
|
|
17
|
+
export * from "./toggle";
|
|
18
|
+
export * from "./toggle-buttons";
|
|
19
|
+
export * from "./toggle-group";
|
|
20
|
+
export * from "./badge";
|
|
21
|
+
export * from "./radio-group";
|
|
22
|
+
export * from "./card";
|
|
23
|
+
export * from "./panel";
|
|
24
|
+
export * from "./toolbar";
|
|
25
|
+
export * from "./checkbox";
|
|
26
|
+
export * from "./switch";
|
|
27
|
+
export * from "./tabs";
|
|
28
|
+
export * from "./modal";
|
|
29
|
+
export * from "./button";
|
|
30
|
+
export * from "./collapsible";
|
|
31
|
+
export * from "./select";
|
|
32
|
+
export * from "./modal";
|
|
33
|
+
export * from "./tabs";
|
|
34
|
+
export * from "./slider";
|
|
35
|
+
export * from "./layout";
|
|
36
|
+
export * from "./label";
|
|
37
|
+
export * from "./UIKitBadge";
|
|
38
|
+
export * from "./resizable";
|
|
39
|
+
export * from "./inputs";
|
|
40
|
+
|
|
41
|
+
export * from "./layouts";
|
|
42
|
+
export * from "./theme";
|
|
43
|
+
export * from "./drag-selectable";
|
|
44
|
+
|
|
45
|
+
export * from "./icons";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ChangeEvent, forwardRef, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { InputRoot, InputRootProps, InputSlot } from "./input";
|
|
4
|
+
import { cn } from "../../hooks";
|
|
5
|
+
|
|
6
|
+
interface ColorInputProps extends Omit<InputRootProps, "type"> {
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const ColorInput = forwardRef<HTMLInputElement, ColorInputProps>(function ColorInput(
|
|
11
|
+
{ className, value, defaultValue, onChange, ...props },
|
|
12
|
+
ref,
|
|
13
|
+
) {
|
|
14
|
+
const [color, setColor] = useState(value || defaultValue || "ffffff");
|
|
15
|
+
return (
|
|
16
|
+
<div className="gap-sm flex">
|
|
17
|
+
<input
|
|
18
|
+
ref={ref}
|
|
19
|
+
type="color"
|
|
20
|
+
value={`#${color}`}
|
|
21
|
+
onChange={(e) => {
|
|
22
|
+
setColor(e.currentTarget.value.replace(/^#/, ""));
|
|
23
|
+
onChange?.(e);
|
|
24
|
+
}}
|
|
25
|
+
className={cn(
|
|
26
|
+
[
|
|
27
|
+
"h-6",
|
|
28
|
+
"w-6",
|
|
29
|
+
"flex-none",
|
|
30
|
+
"cursor-pointer",
|
|
31
|
+
"rounded-1",
|
|
32
|
+
"[appearance:none]",
|
|
33
|
+
"[&::-webkit-color-swatch-wrapper]:p-0",
|
|
34
|
+
"[&::-webkit-color-swatch]:border-line-primary",
|
|
35
|
+
"[&::-webkit-color-swatch]:rounded-lg",
|
|
36
|
+
"[&::-moz-color-swatch]:border-line-primary",
|
|
37
|
+
"[&::-moz-color-swatch]:rounded-lg",
|
|
38
|
+
],
|
|
39
|
+
className,
|
|
40
|
+
)}
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
<InputRoot
|
|
44
|
+
{...props}
|
|
45
|
+
size="sm"
|
|
46
|
+
type="text"
|
|
47
|
+
className="flex-1"
|
|
48
|
+
value={color}
|
|
49
|
+
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
50
|
+
setColor(e.currentTarget.value);
|
|
51
|
+
onChange?.(e);
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<InputSlot>#</InputSlot>
|
|
55
|
+
</InputRoot>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export { ColorInput };
|
|
61
|
+
export type { ColorInputProps };
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
ChangeEvent,
|
|
3
|
+
forwardRef,
|
|
4
|
+
MouseEvent as ReactMouseEvent,
|
|
5
|
+
ReactNode,
|
|
6
|
+
useCallback,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
} from "react";
|
|
10
|
+
|
|
11
|
+
import { InputRoot, InputRootProps, InputSlot } from "./input";
|
|
12
|
+
import { cn } from "../../hooks";
|
|
13
|
+
|
|
14
|
+
const getHoverElementAndIndex = (
|
|
15
|
+
element: Element | null,
|
|
16
|
+
inputs: Map<string, HTMLInputElement | null>,
|
|
17
|
+
) => {
|
|
18
|
+
if (!element) return null;
|
|
19
|
+
const container = element?.closest("[data-input]");
|
|
20
|
+
|
|
21
|
+
const currentInput = container?.querySelector("input");
|
|
22
|
+
|
|
23
|
+
if (!currentInput) return null;
|
|
24
|
+
|
|
25
|
+
return Array.from(inputs.values()).indexOf(currentInput);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// down y x none
|
|
29
|
+
const changeElementsHoverState = (
|
|
30
|
+
inputs: Map<string, HTMLInputElement | null>,
|
|
31
|
+
range: [number | null, number | null],
|
|
32
|
+
changed: "x" | "y" | "none",
|
|
33
|
+
) => {
|
|
34
|
+
const [first, last] = range;
|
|
35
|
+
Array.from(inputs.values()).forEach((input, i) => {
|
|
36
|
+
const container = input?.closest("[data-input]");
|
|
37
|
+
if (first === null || last === null) {
|
|
38
|
+
container?.setAttribute("data-hover", "none");
|
|
39
|
+
} else if (i >= Math.min(first, last) && i <= Math.max(first, last)) {
|
|
40
|
+
container?.setAttribute("data-hover", changed !== "none" ? changed : "down");
|
|
41
|
+
} else {
|
|
42
|
+
container?.setAttribute("data-hover", "none");
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export interface InputNumbersProps
|
|
48
|
+
extends Omit<InputRootProps, "prefix" | "suffix" | "value" | "onValueChange" | "step"> {
|
|
49
|
+
step?: number | number[];
|
|
50
|
+
value: number[];
|
|
51
|
+
prefix?: ReactNode[];
|
|
52
|
+
suffix?: ReactNode[];
|
|
53
|
+
onValuesChange?: (value: Array<number>) => void;
|
|
54
|
+
gridAutoFlow?: "column" | "row";
|
|
55
|
+
columns?: number;
|
|
56
|
+
rows?: number;
|
|
57
|
+
// Legacy props (deprecated)
|
|
58
|
+
layout?: "column" | "row";
|
|
59
|
+
columnMajor?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const InputNumbers = forwardRef<HTMLDivElement, InputNumbersProps>(function InputNumbers(
|
|
63
|
+
{
|
|
64
|
+
size,
|
|
65
|
+
side,
|
|
66
|
+
value,
|
|
67
|
+
onValuesChange,
|
|
68
|
+
prefix,
|
|
69
|
+
suffix,
|
|
70
|
+
step = 0.1,
|
|
71
|
+
gridAutoFlow,
|
|
72
|
+
columns,
|
|
73
|
+
rows,
|
|
74
|
+
layout = "column",
|
|
75
|
+
columnMajor = false,
|
|
76
|
+
},
|
|
77
|
+
ref,
|
|
78
|
+
) {
|
|
79
|
+
const inputs = useRef<Map<string, HTMLInputElement | null>>(new Map());
|
|
80
|
+
const selectRange = useRef<[number | null, number | null]>([null, null]);
|
|
81
|
+
const inputChange = useRef(false);
|
|
82
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
83
|
+
const [cursorState, setCursorState] = useState<"default" | "dragging-y" | "dragging-x">(
|
|
84
|
+
"default",
|
|
85
|
+
);
|
|
86
|
+
const dragDirection = useRef<"x" | "y" | "none">("none");
|
|
87
|
+
const dragStart = useRef<{ x: number; y: number }>({ x: 0, y: 0 });
|
|
88
|
+
const initialDragStart = useRef<{ x: number; y: number }>({ x: 0, y: 0 });
|
|
89
|
+
const accumulatedDelta = useRef(0);
|
|
90
|
+
|
|
91
|
+
const stopClick = useCallback(() => {
|
|
92
|
+
const stopClick = (e: Event) => {
|
|
93
|
+
e.stopPropagation();
|
|
94
|
+
e.preventDefault();
|
|
95
|
+
document.removeEventListener("click", stopClick, true);
|
|
96
|
+
};
|
|
97
|
+
document.addEventListener("click", stopClick, true);
|
|
98
|
+
}, []);
|
|
99
|
+
|
|
100
|
+
const handleMouseDown = useCallback((e: ReactMouseEvent) => {
|
|
101
|
+
if (e.button !== 0) return; // Only left mouse button
|
|
102
|
+
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
e.stopPropagation();
|
|
105
|
+
|
|
106
|
+
setIsDragging(true);
|
|
107
|
+
setCursorState("dragging-y"); // Start with ns-resize cursor
|
|
108
|
+
dragStart.current = { x: e.clientX, y: e.clientY };
|
|
109
|
+
initialDragStart.current = { x: e.clientX, y: e.clientY };
|
|
110
|
+
accumulatedDelta.current = 0;
|
|
111
|
+
inputChange.current = false;
|
|
112
|
+
dragDirection.current = "none";
|
|
113
|
+
|
|
114
|
+
selectRange.current[0] = getHoverElementAndIndex(
|
|
115
|
+
document.elementFromPoint(e.clientX, e.clientY),
|
|
116
|
+
inputs.current,
|
|
117
|
+
);
|
|
118
|
+
}, []);
|
|
119
|
+
|
|
120
|
+
const handleMouseMove = useCallback(
|
|
121
|
+
(e: MouseEvent) => {
|
|
122
|
+
if (!isDragging) return;
|
|
123
|
+
|
|
124
|
+
e.preventDefault();
|
|
125
|
+
e.stopPropagation();
|
|
126
|
+
|
|
127
|
+
const deltaX = e.clientX - dragStart.current.x;
|
|
128
|
+
|
|
129
|
+
// Determine drag direction - allow switching from Y to X when moving horizontally
|
|
130
|
+
const totalDeltaX = e.clientX - initialDragStart.current.x;
|
|
131
|
+
const totalDeltaY = e.clientY - initialDragStart.current.y;
|
|
132
|
+
|
|
133
|
+
if (dragDirection.current === "none") {
|
|
134
|
+
// Initial direction detection - prefer vertical first
|
|
135
|
+
if (Math.abs(totalDeltaY) > 2 || Math.abs(totalDeltaX) > 2) {
|
|
136
|
+
dragDirection.current = "y"; // Start with vertical
|
|
137
|
+
setCursorState("dragging-y");
|
|
138
|
+
|
|
139
|
+
Array.from(inputs.current.values()).forEach((input) => {
|
|
140
|
+
input?.blur();
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
} else if (dragDirection.current === "y" && Math.abs(totalDeltaX) > 5) {
|
|
144
|
+
// Allow switching from Y to X when significant horizontal movement
|
|
145
|
+
dragDirection.current = "x";
|
|
146
|
+
setCursorState("dragging-x");
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Handle horizontal dragging (value change)
|
|
150
|
+
if (dragDirection.current === "x") {
|
|
151
|
+
accumulatedDelta.current += deltaX / 2;
|
|
152
|
+
dragStart.current = { x: e.clientX, y: e.clientY };
|
|
153
|
+
|
|
154
|
+
// For horizontal dragging, ensure we have a valid range
|
|
155
|
+
if (selectRange.current[1] === null) {
|
|
156
|
+
selectRange.current[1] = selectRange.current[0];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (Math.abs(accumulatedDelta.current) >= (inputChange.current ? 1 : 5)) {
|
|
160
|
+
const multiplyStep = e.shiftKey ? 5 : e.altKey ? 1 / 5 : 1;
|
|
161
|
+
|
|
162
|
+
const newValue = value.map((v, i) => {
|
|
163
|
+
const [first, last] = selectRange.current;
|
|
164
|
+
if (first === null || last === null) {
|
|
165
|
+
return v;
|
|
166
|
+
} else if (i <= Math.max(first, last) && i >= Math.min(first, last)) {
|
|
167
|
+
const currentStep = Array.isArray(step) ? (step[i] ?? 0.1) : step;
|
|
168
|
+
return Number(
|
|
169
|
+
(
|
|
170
|
+
(v || 0) +
|
|
171
|
+
Math.floor(accumulatedDelta.current) * currentStep * multiplyStep
|
|
172
|
+
).toPrecision(6),
|
|
173
|
+
);
|
|
174
|
+
} else {
|
|
175
|
+
return v;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
onValuesChange?.(newValue);
|
|
179
|
+
accumulatedDelta.current = 0;
|
|
180
|
+
inputChange.current = true;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
changeElementsHoverState(inputs.current, selectRange.current, "x");
|
|
184
|
+
stopClick();
|
|
185
|
+
}
|
|
186
|
+
// Handle vertical dragging (selection)
|
|
187
|
+
else if (dragDirection.current === "y") {
|
|
188
|
+
const currentElement = document.elementFromPoint(e.clientX, e.clientY);
|
|
189
|
+
const currentIndex = getHoverElementAndIndex(currentElement, inputs.current);
|
|
190
|
+
selectRange.current[1] = currentIndex ?? selectRange.current[1];
|
|
191
|
+
|
|
192
|
+
changeElementsHoverState(inputs.current, selectRange.current, "y");
|
|
193
|
+
stopClick();
|
|
194
|
+
}
|
|
195
|
+
// Initial state - show ns-resize cursor
|
|
196
|
+
else {
|
|
197
|
+
dragStart.current = { x: e.clientX, y: e.clientY };
|
|
198
|
+
changeElementsHoverState(inputs.current, selectRange.current, "y");
|
|
199
|
+
stopClick();
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
[isDragging, value, onValuesChange, step, stopClick],
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
const handleMouseUp = useCallback(() => {
|
|
206
|
+
if (!isDragging) return;
|
|
207
|
+
|
|
208
|
+
setIsDragging(false);
|
|
209
|
+
setCursorState("default");
|
|
210
|
+
selectRange.current = [null, null];
|
|
211
|
+
inputChange.current = false;
|
|
212
|
+
dragDirection.current = "none";
|
|
213
|
+
changeElementsHoverState(inputs.current, selectRange.current, "none");
|
|
214
|
+
}, [isDragging]);
|
|
215
|
+
|
|
216
|
+
// Add global mouse event listeners
|
|
217
|
+
React.useEffect(() => {
|
|
218
|
+
if (isDragging) {
|
|
219
|
+
const handleGlobalMouseMove = (e: MouseEvent) => {
|
|
220
|
+
handleMouseMove(e);
|
|
221
|
+
};
|
|
222
|
+
const handleGlobalMouseUp = () => {
|
|
223
|
+
handleMouseUp();
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
document.addEventListener("mousemove", handleGlobalMouseMove);
|
|
227
|
+
document.addEventListener("mouseup", handleGlobalMouseUp);
|
|
228
|
+
|
|
229
|
+
return () => {
|
|
230
|
+
document.removeEventListener("mousemove", handleGlobalMouseMove);
|
|
231
|
+
document.removeEventListener("mouseup", handleGlobalMouseUp);
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
235
|
+
|
|
236
|
+
const valueChangeHandler = useCallback(
|
|
237
|
+
(index: number) => {
|
|
238
|
+
return (e: ChangeEvent<HTMLInputElement>) => {
|
|
239
|
+
const inputValue = e.target.value;
|
|
240
|
+
if (inputValue === "" || !isNaN(Number(inputValue))) {
|
|
241
|
+
const newValue = value.map((v, i) => {
|
|
242
|
+
if (i === index) {
|
|
243
|
+
return inputValue === "" ? ("" as unknown as number) : Number(inputValue);
|
|
244
|
+
}
|
|
245
|
+
return v;
|
|
246
|
+
});
|
|
247
|
+
onValuesChange?.(newValue);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
},
|
|
251
|
+
[onValuesChange, value],
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
const handleKeyDown = useCallback(
|
|
255
|
+
(index: number) => {
|
|
256
|
+
return (e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
257
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
258
|
+
e.preventDefault();
|
|
259
|
+
const direction = e.key === "ArrowUp" ? 1 : -1;
|
|
260
|
+
const currentValue = value[index] || 0;
|
|
261
|
+
const currentStep = Array.isArray(step) ? (step[index] ?? 0.1) : step;
|
|
262
|
+
const newValue = Number((currentValue + direction * currentStep).toPrecision(6));
|
|
263
|
+
|
|
264
|
+
const updatedValues = value.map((v, i) => {
|
|
265
|
+
if (i === index) {
|
|
266
|
+
return newValue;
|
|
267
|
+
}
|
|
268
|
+
return v;
|
|
269
|
+
});
|
|
270
|
+
onValuesChange?.(updatedValues);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
},
|
|
274
|
+
[value, onValuesChange, step],
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
if (value?.length === 0) {
|
|
278
|
+
throw new Error("`value` cannot be an empty array");
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Determine the actual grid flow mode
|
|
282
|
+
const actualGridAutoFlow = gridAutoFlow || layout || "row";
|
|
283
|
+
|
|
284
|
+
// Use grid layout if we have columns or rows specified, or if layout is 'row'
|
|
285
|
+
const useGrid = columns || rows || actualGridAutoFlow === "row" || layout === "row";
|
|
286
|
+
|
|
287
|
+
// Create inline styles for grid
|
|
288
|
+
const gridStyles: React.CSSProperties = {};
|
|
289
|
+
if (useGrid) {
|
|
290
|
+
gridStyles.display = "grid";
|
|
291
|
+
gridStyles.gridAutoFlow = actualGridAutoFlow;
|
|
292
|
+
|
|
293
|
+
if (columns) {
|
|
294
|
+
gridStyles.gridTemplateColumns = `repeat(${columns}, minmax(0, 1fr))`;
|
|
295
|
+
}
|
|
296
|
+
if (rows) {
|
|
297
|
+
gridStyles.gridTemplateRows = `repeat(${rows}, minmax(0, 1fr))`;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Legacy column-major support
|
|
301
|
+
if (columnMajor && layout === "row") {
|
|
302
|
+
gridStyles.gridAutoFlow = "column";
|
|
303
|
+
if (!rows && columns) {
|
|
304
|
+
gridStyles.gridTemplateRows = `repeat(${Math.ceil(value.length / columns)}, minmax(0, 1fr))`;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return (
|
|
310
|
+
<div
|
|
311
|
+
ref={ref}
|
|
312
|
+
onMouseDown={handleMouseDown}
|
|
313
|
+
className={cn([
|
|
314
|
+
"gap-xs touch-none select-none",
|
|
315
|
+
!useGrid && "flex flex-col",
|
|
316
|
+
cursorState === "default" && "cursor-crosshair",
|
|
317
|
+
cursorState === "dragging-y" && "cursor-ns-resize",
|
|
318
|
+
cursorState === "dragging-x" && "cursor-col-resize",
|
|
319
|
+
"data-[hover=down]:bg-bg-tertiary",
|
|
320
|
+
"data-[hover=x]:bg-bg-tertiary",
|
|
321
|
+
"data-[hover=y]:bg-bg-tertiary",
|
|
322
|
+
"data-[hover=x]:cursor-col-resize",
|
|
323
|
+
"data-[hover=y]:cursor-ns-resize",
|
|
324
|
+
])}
|
|
325
|
+
style={useGrid ? gridStyles : undefined}
|
|
326
|
+
>
|
|
327
|
+
{value.map((item, index) => (
|
|
328
|
+
<InputRoot
|
|
329
|
+
key={index}
|
|
330
|
+
ref={(r) => {
|
|
331
|
+
inputs.current.set(index.toString(), r);
|
|
332
|
+
return () => {
|
|
333
|
+
inputs.current.delete(index.toString());
|
|
334
|
+
};
|
|
335
|
+
}}
|
|
336
|
+
size={size}
|
|
337
|
+
side={side}
|
|
338
|
+
type="number"
|
|
339
|
+
step={Array.isArray(step) ? (step[index] ?? 0.1) : step}
|
|
340
|
+
value={item}
|
|
341
|
+
onClick={() => {
|
|
342
|
+
inputs.current.get(index.toString())?.focus();
|
|
343
|
+
}}
|
|
344
|
+
onChange={valueChangeHandler(index)}
|
|
345
|
+
onKeyDown={handleKeyDown(index)}
|
|
346
|
+
data-hover="none"
|
|
347
|
+
className={cn([
|
|
348
|
+
"group/number-input",
|
|
349
|
+
"cursor-text",
|
|
350
|
+
cursorState === "dragging-x" && [
|
|
351
|
+
"hover:!bg-bg-secondary",
|
|
352
|
+
"data-[hover=x]:hover:!bg-bg-tertiary",
|
|
353
|
+
],
|
|
354
|
+
"data-[hover=down]:bg-bg-tertiary",
|
|
355
|
+
"data-[hover=x]:bg-bg-tertiary",
|
|
356
|
+
"data-[hover=y]:bg-bg-tertiary",
|
|
357
|
+
"data-[hover=x]:cursor-col-resize",
|
|
358
|
+
"data-[hover=y]:cursor-ns-resize",
|
|
359
|
+
])}
|
|
360
|
+
inputClassName={cn([
|
|
361
|
+
"cursor-text",
|
|
362
|
+
"group-data-[hover=x]/number-input:cursor-col-resize",
|
|
363
|
+
"group-data-[hover=y]/number-input:cursor-ns-resize",
|
|
364
|
+
])}
|
|
365
|
+
>
|
|
366
|
+
{prefix?.[index] && (
|
|
367
|
+
<InputSlot
|
|
368
|
+
side="left"
|
|
369
|
+
className={cn(
|
|
370
|
+
"cursor-text",
|
|
371
|
+
"group-data-[hover=x]/number-input:cursor-col-resize",
|
|
372
|
+
"group-data-[hover=y]/number-input:cursor-ns-resize",
|
|
373
|
+
)}
|
|
374
|
+
>
|
|
375
|
+
{prefix[index]}
|
|
376
|
+
</InputSlot>
|
|
377
|
+
)}
|
|
378
|
+
{suffix?.[index] && (
|
|
379
|
+
<InputSlot
|
|
380
|
+
side="right"
|
|
381
|
+
className={cn(
|
|
382
|
+
"cursor-text",
|
|
383
|
+
"group-data-[hover=x]/number-input:cursor-col-resize",
|
|
384
|
+
"group-data-[hover=y]/number-input:cursor-ns-resize",
|
|
385
|
+
)}
|
|
386
|
+
>
|
|
387
|
+
{suffix[index]}
|
|
388
|
+
</InputSlot>
|
|
389
|
+
)}
|
|
390
|
+
</InputRoot>
|
|
391
|
+
))}
|
|
392
|
+
</div>
|
|
393
|
+
);
|
|
394
|
+
});
|