@djangocfg/ui-core 2.1.40 → 2.1.41

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/ui-core",
3
- "version": "2.1.40",
3
+ "version": "2.1.41",
4
4
  "description": "Pure React UI component library without Next.js dependencies - for Electron, Vite, CRA apps",
5
5
  "keywords": [
6
6
  "ui-components",
@@ -102,7 +102,7 @@
102
102
  "vaul": "1.1.2"
103
103
  },
104
104
  "devDependencies": {
105
- "@djangocfg/typescript-config": "^2.1.40",
105
+ "@djangocfg/typescript-config": "^2.1.41",
106
106
  "@types/node": "^24.7.2",
107
107
  "@types/react": "^19.1.0",
108
108
  "@types/react-dom": "^19.1.0",
@@ -27,7 +27,7 @@ export { Skeleton } from './skeleton';
27
27
  export { AspectRatio } from './aspect-ratio';
28
28
  export { ScrollArea, ScrollBar } from './scroll-area';
29
29
  export type { ScrollAreaHandle, ScrollAreaProps } from './scroll-area';
30
- export { ResizableHandle, ResizablePanel, ResizablePanelGroup } from './resizable';
30
+ export { ResizableHandle, ResizablePanel, ResizablePanelGroup, useResizableDragging } from './resizable';
31
31
  export type { ResizableHandleProps } from './resizable';
32
32
  export { Sticky } from './sticky';
33
33
  export { Portal } from './portal';
@@ -5,11 +5,21 @@ import * as ResizablePrimitive from "react-resizable-panels"
5
5
  import { cn } from "../lib/utils"
6
6
  import { DragHandleDots2Icon } from "@radix-ui/react-icons"
7
7
 
8
+ // Context to share dragging state across panel group
9
+ const ResizableDraggingContext = React.createContext<{
10
+ isDragging: boolean
11
+ setIsDragging: (value: boolean) => void
12
+ }>({ isDragging: false, setIsDragging: () => {} })
13
+
14
+ // Hook to check if panel group is being resized
15
+ export const useResizableDragging = () => React.useContext(ResizableDraggingContext)
16
+
8
17
  const ResizablePanelGroup = ({
9
18
  className,
10
19
  ...props
11
20
  }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => {
12
21
  const [mounted, setMounted] = React.useState(false)
22
+ const [isDragging, setIsDragging] = React.useState(false)
13
23
 
14
24
  React.useEffect(() => {
15
25
  setMounted(true)
@@ -30,13 +40,16 @@ const ResizablePanelGroup = ({
30
40
  }
31
41
 
32
42
  return (
33
- <ResizablePrimitive.PanelGroup
34
- className={cn(
35
- "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
36
- className
37
- )}
38
- {...props}
39
- />
43
+ <ResizableDraggingContext.Provider value={{ isDragging, setIsDragging }}>
44
+ <ResizablePrimitive.PanelGroup
45
+ className={cn(
46
+ "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
47
+ className
48
+ )}
49
+ data-dragging={isDragging ? "true" : undefined}
50
+ {...props}
51
+ />
52
+ </ResizableDraggingContext.Provider>
40
53
  )
41
54
  }
42
55
 
@@ -94,14 +107,22 @@ const ResizableHandle = ({
94
107
  size = 'md',
95
108
  showIndicator = false,
96
109
  indicatorHeight = 32,
110
+ onDragging,
97
111
  ...props
98
112
  }: ResizableHandleProps) => {
99
113
  const [mounted, setMounted] = React.useState(false)
114
+ const { setIsDragging } = React.useContext(ResizableDraggingContext)
100
115
 
101
116
  React.useEffect(() => {
102
117
  setMounted(true)
103
118
  }, [])
104
119
 
120
+ // Handle drag state change - update context and call user callback
121
+ const handleDragging = React.useCallback((isDragging: boolean) => {
122
+ setIsDragging(isDragging)
123
+ onDragging?.(isDragging)
124
+ }, [setIsDragging, onDragging])
125
+
105
126
  // Size variants for hit area
106
127
  const sizeClasses = {
107
128
  sm: 'after:w-0.5',
@@ -129,6 +150,8 @@ const ResizableHandle = ({
129
150
  "w-px h-full",
130
151
  "hover:bg-primary/20 active:bg-primary/30",
131
152
  "transition-colors",
153
+ // Touch handling for better drag performance
154
+ "touch-none select-none",
132
155
  // Invisible hit area for easier dragging
133
156
  "after:absolute after:inset-y-0 after:left-1/2 after:-translate-x-1/2",
134
157
  sizeClasses[size],
@@ -140,6 +163,8 @@ const ResizableHandle = ({
140
163
  "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
141
164
  className
142
165
  )}
166
+ style={{ touchAction: 'none' }}
167
+ onDragging={handleDragging}
143
168
  {...props}
144
169
  >
145
170
  {/* Optional pill indicator */}