@dxos/react-ui-dnd 0.8.4-main.b97322e → 0.8.4-main.bcb3aa67d6
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/dist/lib/browser/index.mjs +73 -110
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +73 -110
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/ResizeHandle.d.ts +2 -2
- package/dist/types/src/components/ResizeHandle.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +0 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/sizeStyle.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -15
- package/src/components/ResizeHandle.tsx +12 -47
- package/src/util/index.ts +0 -1
- package/src/util/sizeStyle.ts +5 -1
- package/dist/types/src/util/rem.d.ts +0 -2
- package/dist/types/src/util/rem.d.ts.map +0 -1
- package/src/util/rem.ts +0 -5
package/package.json
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-dnd",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.bcb3aa67d6",
|
|
4
4
|
"description": "Drag and drop components.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
|
-
"sideEffects":
|
|
13
|
+
"sideEffects": false,
|
|
10
14
|
"type": "module",
|
|
11
15
|
"exports": {
|
|
12
16
|
".": {
|
|
17
|
+
"source": "./src/index.ts",
|
|
13
18
|
"types": "./dist/types/src/index.d.ts",
|
|
14
19
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
20
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
@@ -24,24 +29,23 @@
|
|
|
24
29
|
"src"
|
|
25
30
|
],
|
|
26
31
|
"dependencies": {
|
|
27
|
-
"@atlaskit/pragmatic-drag-and-drop": "
|
|
28
|
-
"@preact-signals/safe-react": "^0.9.0",
|
|
32
|
+
"@atlaskit/pragmatic-drag-and-drop": "1.7.7",
|
|
29
33
|
"@radix-ui/react-use-controllable-state": "1.1.0"
|
|
30
34
|
},
|
|
31
35
|
"devDependencies": {
|
|
32
|
-
"@types/react": "~
|
|
33
|
-
"@types/react-dom": "~
|
|
34
|
-
"react": "~
|
|
35
|
-
"react-dom": "~
|
|
36
|
-
"vite": "
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/react-ui
|
|
36
|
+
"@types/react": "~19.2.7",
|
|
37
|
+
"@types/react-dom": "~19.2.3",
|
|
38
|
+
"react": "~19.2.3",
|
|
39
|
+
"react-dom": "~19.2.3",
|
|
40
|
+
"vite": "^7.1.11",
|
|
41
|
+
"@dxos/ui-theme": "0.8.4-main.bcb3aa67d6",
|
|
42
|
+
"@dxos/react-ui": "0.8.4-main.bcb3aa67d6"
|
|
39
43
|
},
|
|
40
44
|
"peerDependencies": {
|
|
41
|
-
"react": "~
|
|
42
|
-
"react-dom": "~
|
|
43
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
44
|
-
"@dxos/
|
|
45
|
+
"react": "~19.2.3",
|
|
46
|
+
"react-dom": "~19.2.3",
|
|
47
|
+
"@dxos/react-ui": "0.8.4-main.bcb3aa67d6",
|
|
48
|
+
"@dxos/ui-theme": "0.8.4-main.bcb3aa67d6"
|
|
45
49
|
},
|
|
46
50
|
"publishConfig": {
|
|
47
51
|
"access": "public"
|
|
@@ -10,10 +10,11 @@ import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
|
10
10
|
import React, { useLayoutEffect, useRef } from 'react';
|
|
11
11
|
|
|
12
12
|
import { type ThemedClassName, useElevationContext } from '@dxos/react-ui';
|
|
13
|
-
import { mx, surfaceZIndex } from '@dxos/
|
|
13
|
+
import { mx, surfaceZIndex } from '@dxos/ui-theme';
|
|
14
14
|
|
|
15
|
-
import { type
|
|
16
|
-
|
|
15
|
+
import { type Side, type Size } from '../types';
|
|
16
|
+
|
|
17
|
+
const REM = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
17
18
|
|
|
18
19
|
const measureSubject = (element: HTMLButtonElement, fallbackSize: number): { width: number; height: number } => {
|
|
19
20
|
const stackItemElement = element.closest('[data-dx-resize-subject]');
|
|
@@ -33,7 +34,7 @@ const getNextSize = (
|
|
|
33
34
|
Math.max(
|
|
34
35
|
minSize,
|
|
35
36
|
startSize +
|
|
36
|
-
((location.current.input[client] - location.initial.input[client]) / REM) * (side.endsWith('
|
|
37
|
+
((location.current.input[client] - location.initial.input[client]) / REM) * (side.endsWith('start') ? -1 : 1),
|
|
37
38
|
),
|
|
38
39
|
);
|
|
39
40
|
};
|
|
@@ -63,14 +64,14 @@ export const ResizeHandle = ({
|
|
|
63
64
|
iconPosition = 'start',
|
|
64
65
|
defaultSize,
|
|
65
66
|
fallbackSize,
|
|
66
|
-
size:
|
|
67
|
+
size: sizeProp,
|
|
67
68
|
minSize,
|
|
68
69
|
maxSize,
|
|
69
70
|
onSizeChange,
|
|
70
71
|
}: ResizeHandleProps) => {
|
|
71
72
|
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
72
73
|
const [size = 'min-content', setSize] = useControllableState({
|
|
73
|
-
prop:
|
|
74
|
+
prop: sizeProp,
|
|
74
75
|
defaultProp: defaultSize,
|
|
75
76
|
onChange: onSizeChange,
|
|
76
77
|
});
|
|
@@ -132,11 +133,11 @@ export const ResizeHandle = ({
|
|
|
132
133
|
ref={buttonRef}
|
|
133
134
|
data-side={side}
|
|
134
135
|
className={mx(
|
|
135
|
-
'group absolute flex focus-visible:outline-
|
|
136
|
+
'group absolute flex focus-visible:outline-hidden',
|
|
136
137
|
surfaceZIndex({ elevation, level: 'tooltip' }),
|
|
137
138
|
orientation === 'horizontal'
|
|
138
|
-
? 'cursor-col-resize
|
|
139
|
-
: 'cursor-row-resize
|
|
139
|
+
? 'cursor-col-resize w-4 inset-y-0 data-[side=inline-end]:end-0 data-[side=inline-end]:before:end-0 data-[side=inline-start]:start-0 data-[side=inline-start]:before:start-0 border-b-0! before:inset-y-0 before:w-1'
|
|
140
|
+
: 'cursor-row-resize h-4 inset-x-0 data-[side=block-end]:bottom-0 data-[side=block-end]:before:bottom-0 data-[side=block-start]:top-0 data-[side=block-start]:before:top-0 border-x-0! before:inset-x-0 before:h-1',
|
|
140
141
|
orientation === 'horizontal'
|
|
141
142
|
? iconPosition === 'end'
|
|
142
143
|
? 'align-end'
|
|
@@ -149,45 +150,9 @@ export const ResizeHandle = ({
|
|
|
149
150
|
? 'justify-center'
|
|
150
151
|
: 'justify-start',
|
|
151
152
|
'before:transition-opacity before:duration-100 before:ease-in-out before:opacity-0 hover:before:opacity-100 focus-visible:before:opacity-100 active:before:opacity-100',
|
|
152
|
-
'before:absolute before:block before:bg-
|
|
153
|
+
'before:absolute before:block before:bg-neutral-focus-indicator',
|
|
153
154
|
classNames,
|
|
154
155
|
)}
|
|
155
|
-
|
|
156
|
-
<div
|
|
157
|
-
role='none'
|
|
158
|
-
data-side={side}
|
|
159
|
-
className={mx(
|
|
160
|
-
'grid place-items-center group-hover:opacity-0 group-focus-visible:opacity-0 group-active:opacity-0',
|
|
161
|
-
orientation === 'horizontal' ? 'bs-[--rail-size] is-4' : 'is-[--rail-size] bs-4',
|
|
162
|
-
)}
|
|
163
|
-
>
|
|
164
|
-
<DragHandleSignifier side={side} />
|
|
165
|
-
</div>
|
|
166
|
-
</button>
|
|
167
|
-
);
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const DragHandleSignifier = ({ side }: Pick<ResizeHandleProps, 'side'>) => {
|
|
171
|
-
return (
|
|
172
|
-
<svg
|
|
173
|
-
xmlns='http://www.w3.org/2000/svg'
|
|
174
|
-
viewBox='0 0 256 256'
|
|
175
|
-
fill='currentColor'
|
|
176
|
-
className={mx(
|
|
177
|
-
'shrink-0 bs-4 is-4 text-unAccent',
|
|
178
|
-
side === 'block-end'
|
|
179
|
-
? 'rotate-90'
|
|
180
|
-
: side === 'block-start'
|
|
181
|
-
? '-rotate-90'
|
|
182
|
-
: side === 'inline-start' && 'rotate-180',
|
|
183
|
-
)}
|
|
184
|
-
>
|
|
185
|
-
{/* two pips: <path d='M256,120c-8.8,0-16-7.2-16-16v-56c0-8.8,7.2-16,16-16v88Z' />
|
|
186
|
-
<path d='M256,232c-8.8,0-16-7.2-16-16v-56c0-8.8,7.2-16,16-16v88Z' /> */}
|
|
187
|
-
<path d='M256,64c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z' />
|
|
188
|
-
<path d='M256,120c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z' />
|
|
189
|
-
<path d='M256,176c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z' />
|
|
190
|
-
<path d='M256,232c-8.8,0-16-7.2-16-16s7.2-16,16-16v32Z' />
|
|
191
|
-
</svg>
|
|
156
|
+
/>
|
|
192
157
|
);
|
|
193
158
|
};
|
package/src/util/index.ts
CHANGED
package/src/util/sizeStyle.ts
CHANGED
|
@@ -17,6 +17,10 @@ export const sizeStyle = (
|
|
|
17
17
|
case 'block-start':
|
|
18
18
|
case 'block-end':
|
|
19
19
|
sizeProperty = 'blockSize';
|
|
20
|
+
break;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
[sizeProperty]: size === 'min-content' ? (calcSize ? 'var(--dx-calc-min)' : 'min-content') : `${size}rem`,
|
|
25
|
+
};
|
|
22
26
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rem.d.ts","sourceRoot":"","sources":["../../../../src/util/rem.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,GAAG,QAAkE,CAAC"}
|