@gridui/resizable 1.0.2 → 1.0.4
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 -0
- package/dist/index.js +23 -51
- package/dist/index.js.map +2 -2
- package/docs/catalog.json +6 -2
- package/docs/reference/README.md +4 -0
- package/docs/reference/resizable.md +107 -0
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -27,3 +27,5 @@ Use `size`/`onSizeChange` for controlled state, or `defaultSize` for local state
|
|
|
27
27
|
The separator has a required `label`, a range, and relationships to both regions. Use the orientation's arrow keys to resize, Shift+Arrow for ten steps, or Home/End for the bounds. Horizontal arrows and drag movement respect inherited RTL; vertical movement does not reverse. Pointer capture continues the drag outside the handle. Escape, pointer cancellation, window blur, or an orientation change requests restoration of the pre-drag size. During a drag, Escape is consumed before an enclosing dialog can dismiss; the next Escape retains the dialog's normal behavior. Touch handles use a larger target. The separator does not submit or reset form state.
|
|
28
28
|
|
|
29
29
|
See [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-layout/resizable/.changeset/history).
|
|
30
|
+
|
|
31
|
+
[Component reference](docs/reference/README.md) contains focused API pages for each public component.
|
package/dist/index.js
CHANGED
|
@@ -24,10 +24,11 @@ var keyboardSize = (key, size, step, horizontal, reverse, min, max) => {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
// src/resizable/resizable.tsx
|
|
27
|
-
import { isComposingKeyEvent
|
|
27
|
+
import { isComposingKeyEvent } from "@gridui/interaction";
|
|
28
28
|
import { useInteractionOutline } from "@gridui/overlay";
|
|
29
|
+
import { usePointerDrag } from "@gridui/react-utils";
|
|
29
30
|
import { cn } from "@gridui/style-utils";
|
|
30
|
-
import {
|
|
31
|
+
import { useId, useLayoutEffect, useState } from "react";
|
|
31
32
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
32
33
|
var Resizable = (props) => {
|
|
33
34
|
const {
|
|
@@ -50,8 +51,6 @@ var Resizable = (props) => {
|
|
|
50
51
|
local,
|
|
51
52
|
setLocal
|
|
52
53
|
] = useState(defaultSize);
|
|
53
|
-
const drag = useRef(null);
|
|
54
|
-
const separator = useRef(null);
|
|
55
54
|
const firstRef = useInteractionOutline({});
|
|
56
55
|
const secondRef = useInteractionOutline({});
|
|
57
56
|
const firstId = useId();
|
|
@@ -72,13 +71,7 @@ var Resizable = (props) => {
|
|
|
72
71
|
onSizeChange?.(next);
|
|
73
72
|
}
|
|
74
73
|
};
|
|
75
|
-
const
|
|
76
|
-
const active = drag.current;
|
|
77
|
-
if (!active) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
drag.current = null;
|
|
81
|
-
active.cleanup();
|
|
74
|
+
const drag = usePointerDrag((active) => {
|
|
82
75
|
const next = constrainSize(active.size, minSize, maxSize);
|
|
83
76
|
if (size === void 0) {
|
|
84
77
|
setLocal(next);
|
|
@@ -86,20 +79,11 @@ var Resizable = (props) => {
|
|
|
86
79
|
if (next !== current) {
|
|
87
80
|
onSizeChange?.(next);
|
|
88
81
|
}
|
|
89
|
-
|
|
90
|
-
active.element.releasePointerCapture(active.pointerId);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const cancelRef = useRef(cancel);
|
|
94
|
-
cancelRef.current = cancel;
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
return () => {
|
|
97
|
-
cancelRef.current();
|
|
98
|
-
};
|
|
99
|
-
}, []);
|
|
82
|
+
});
|
|
100
83
|
useLayoutEffect(() => {
|
|
101
|
-
|
|
102
|
-
|
|
84
|
+
const active = drag.get();
|
|
85
|
+
if (disabled || active && active.horizontal !== horizontal) {
|
|
86
|
+
drag.cancel();
|
|
103
87
|
}
|
|
104
88
|
});
|
|
105
89
|
const tracks = `minmax(0, ${current}fr) var(--gridui-resizable-handle-size, 12px) minmax(0, ${100 - current}fr)`;
|
|
@@ -126,7 +110,6 @@ var Resizable = (props) => {
|
|
|
126
110
|
/* @__PURE__ */ jsx(
|
|
127
111
|
"div",
|
|
128
112
|
{
|
|
129
|
-
ref: separator,
|
|
130
113
|
role: "separator",
|
|
131
114
|
"aria-label": label,
|
|
132
115
|
"aria-controls": `${firstId} ${secondId}`,
|
|
@@ -150,7 +133,7 @@ var Resizable = (props) => {
|
|
|
150
133
|
}
|
|
151
134
|
},
|
|
152
135
|
onPointerDown: (event) => {
|
|
153
|
-
if (disabled
|
|
136
|
+
if (disabled) {
|
|
154
137
|
return;
|
|
155
138
|
}
|
|
156
139
|
const handle = event.currentTarget;
|
|
@@ -159,46 +142,35 @@ var Resizable = (props) => {
|
|
|
159
142
|
return;
|
|
160
143
|
}
|
|
161
144
|
const handleBounds = handle.getBoundingClientRect();
|
|
162
|
-
drag.
|
|
163
|
-
pointerId: event.pointerId,
|
|
145
|
+
const started = drag.start(event, {
|
|
164
146
|
start: horizontal ? event.clientX : event.clientY,
|
|
165
147
|
size: current,
|
|
166
148
|
extent: horizontal ? bounds.width - handleBounds.width : bounds.height - handleBounds.height,
|
|
167
149
|
reverse: horizontal && getComputedStyle(handle).direction === "rtl",
|
|
168
|
-
horizontal
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
handle.focus();
|
|
175
|
-
handle.setPointerCapture(event.pointerId);
|
|
176
|
-
event.preventDefault();
|
|
150
|
+
horizontal
|
|
151
|
+
});
|
|
152
|
+
if (started) {
|
|
153
|
+
handle.focus();
|
|
154
|
+
event.preventDefault();
|
|
155
|
+
}
|
|
177
156
|
},
|
|
178
157
|
onPointerMove: (event) => {
|
|
179
|
-
const active = drag.
|
|
180
|
-
if (!active
|
|
158
|
+
const active = drag.get(event.pointerId);
|
|
159
|
+
if (!active) {
|
|
181
160
|
return;
|
|
182
161
|
}
|
|
183
162
|
const coordinate = horizontal ? event.clientX : event.clientY;
|
|
184
163
|
update(pointerSize(active.size, coordinate - active.start, active.extent, active.reverse, minSize, maxSize));
|
|
185
164
|
},
|
|
186
165
|
onPointerUp: (event) => {
|
|
187
|
-
|
|
188
|
-
const active = drag.current;
|
|
189
|
-
drag.current = null;
|
|
190
|
-
active.cleanup();
|
|
191
|
-
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
192
|
-
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
166
|
+
drag.finish(event.pointerId);
|
|
195
167
|
},
|
|
196
168
|
onPointerCancel: (event) => {
|
|
197
|
-
|
|
198
|
-
cancel();
|
|
199
|
-
}
|
|
169
|
+
drag.cancel(event.pointerId);
|
|
200
170
|
},
|
|
201
|
-
onLostPointerCapture:
|
|
171
|
+
onLostPointerCapture: (event) => {
|
|
172
|
+
drag.cancel(event.pointerId);
|
|
173
|
+
}
|
|
202
174
|
}
|
|
203
175
|
),
|
|
204
176
|
/* @__PURE__ */ jsx(
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/resizable/size.ts", "../src/resizable/resizable.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * @author WMXPY\n * @package Resizable\n * @namespace Resizable\n * @description Size\n */\n\nexport const constrainSize = (size: number, min: number, max: number): number => {\n if (!Number.isFinite(size) || !Number.isFinite(min) || !Number.isFinite(max) || min < 0 || max > 100 || min > max) {\n throw new RangeError(\"Resizable requires finite percentages and 0 <= minSize <= maxSize <= 100.\");\n }\n return Math.min(max, Math.max(min, size));\n};\n\nexport const pointerSize = (size: number, delta: number, extent: number, reverse: boolean, min: number, max: number): number => {\n return constrainSize(extent > 0 ? size + delta / extent * 100 * (reverse ? -1 : 1) : size, min, max);\n};\n\nexport const keyboardSize = (key: string, size: number, step: number, horizontal: boolean, reverse: boolean, min: number, max: number): number | null => {\n if (key === \"Home\") {\n return min;\n }\n if (key === \"End\") {\n return max;\n }\n const positive = horizontal ? \"ArrowRight\" : \"ArrowDown\";\n const negative = horizontal ? \"ArrowLeft\" : \"ArrowUp\";\n if (key !== positive && key !== negative) {\n return null;\n }\n return constrainSize(size + (key === positive ? 1 : -1) * (horizontal && reverse ? -1 : 1) * step, min, max);\n};\n", "/**\n * @author WMXPY\n * @package Resizable\n * @namespace Resizable\n * @description Resizable\n */\n\nimport { constrainSize, keyboardSize, pointerSize } from \"./size\";\nimport { isComposingKeyEvent
|
|
5
|
-
"mappings": ";AAOO,IAAM,gBAAgB,CAAC,MAAc,KAAa,QAAwB;AAC7E,MAAI,CAAC,OAAO,SAAS,IAAI,KAAK,CAAC,OAAO,SAAS,GAAG,KAAK,CAAC,OAAO,SAAS,GAAG,KAAK,MAAM,KAAK,MAAM,OAAO,MAAM,KAAK;AAC/G,UAAM,IAAI,WAAW,2EAA2E;AAAA,EACpG;AACA,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,IAAI,CAAC;AAC5C;AAEO,IAAM,cAAc,CAAC,MAAc,OAAe,QAAgB,SAAkB,KAAa,QAAwB;AAC5H,SAAO,cAAc,SAAS,IAAI,OAAO,QAAQ,SAAS,OAAO,UAAU,KAAK,KAAK,MAAM,KAAK,GAAG;AACvG;AAEO,IAAM,eAAe,CAAC,KAAa,MAAc,MAAc,YAAqB,SAAkB,KAAa,QAA+B;AACrJ,MAAI,QAAQ,QAAQ;AAChB,WAAO;AAAA,EACX;AACA,MAAI,QAAQ,OAAO;AACf,WAAO;AAAA,EACX;AACA,QAAM,WAAW,aAAa,eAAe;AAC7C,QAAM,WAAW,aAAa,cAAc;AAC5C,MAAI,QAAQ,YAAY,QAAQ,UAAU;AACtC,WAAO;AAAA,EACX;AACA,SAAO,cAAc,QAAQ,QAAQ,WAAW,IAAI,OAAO,cAAc,UAAU,KAAK,KAAK,MAAM,KAAK,GAAG;AAC/G;;;ACvBA,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Resizable\n * @namespace Resizable\n * @description Size\n */\n\nexport const constrainSize = (size: number, min: number, max: number): number => {\n if (!Number.isFinite(size) || !Number.isFinite(min) || !Number.isFinite(max) || min < 0 || max > 100 || min > max) {\n throw new RangeError(\"Resizable requires finite percentages and 0 <= minSize <= maxSize <= 100.\");\n }\n return Math.min(max, Math.max(min, size));\n};\n\nexport const pointerSize = (size: number, delta: number, extent: number, reverse: boolean, min: number, max: number): number => {\n return constrainSize(extent > 0 ? size + delta / extent * 100 * (reverse ? -1 : 1) : size, min, max);\n};\n\nexport const keyboardSize = (key: string, size: number, step: number, horizontal: boolean, reverse: boolean, min: number, max: number): number | null => {\n if (key === \"Home\") {\n return min;\n }\n if (key === \"End\") {\n return max;\n }\n const positive = horizontal ? \"ArrowRight\" : \"ArrowDown\";\n const negative = horizontal ? \"ArrowLeft\" : \"ArrowUp\";\n if (key !== positive && key !== negative) {\n return null;\n }\n return constrainSize(size + (key === positive ? 1 : -1) * (horizontal && reverse ? -1 : 1) * step, min, max);\n};\n", "/**\n * @author WMXPY\n * @package Resizable\n * @namespace Resizable\n * @description Resizable\n */\n\nimport { constrainSize, keyboardSize, pointerSize } from \"./size\";\nimport { isComposingKeyEvent } from \"@gridui/interaction\";\nimport { useInteractionOutline } from \"@gridui/overlay\";\nimport { usePointerDrag } from \"@gridui/react-utils\";\nimport { cn } from \"@gridui/style-utils\";\nimport { type ComponentPropsWithRef, type FC, type ReactNode, useId, useLayoutEffect, useState } from \"react\";\n\nexport type ResizableProps = Omit<ComponentPropsWithRef<\"div\">, \"children\" | \"onChange\"> & {\n readonly first: ReactNode;\n readonly second: ReactNode;\n readonly label: string;\n readonly orientation?: \"horizontal\" | \"vertical\";\n readonly size?: number;\n readonly defaultSize?: number;\n readonly minSize?: number;\n readonly maxSize?: number;\n readonly step?: number;\n readonly disabled?: boolean;\n readonly onSizeChange?: (size: number) => void;\n};\n\ntype Drag = {\n readonly start: number;\n readonly size: number;\n readonly extent: number;\n readonly reverse: boolean;\n readonly horizontal: boolean;\n};\n\nexport const Resizable: FC<ResizableProps> = (props: ResizableProps) => {\n const { first, second, label, orientation = \"horizontal\", size, defaultSize = 50, minSize = 10, maxSize = 90,\n step = 1, disabled = false, onSizeChange, className, style, ...restProps } = props;\n const [\n local,\n setLocal,\n ] = useState(defaultSize);\n const firstRef = useInteractionOutline<HTMLDivElement>({});\n const secondRef = useInteractionOutline<HTMLDivElement>({});\n const firstId = useId();\n const secondId = useId();\n const current = constrainSize(size ?? local, minSize, maxSize);\n if (!Number.isFinite(step) || step <= 0) {\n throw new RangeError(\"Resizable step must be a positive finite percentage.\");\n }\n const horizontal = orientation === \"horizontal\";\n const update = (next: number) => {\n if (disabled) {\n return;\n }\n if (size === undefined) {\n setLocal(next);\n }\n if (next !== current) {\n onSizeChange?.(next);\n }\n };\n const drag = usePointerDrag<Drag>((active) => {\n const next = constrainSize(active.size, minSize, maxSize);\n if (size === undefined) {\n setLocal(next);\n }\n if (next !== current) {\n onSizeChange?.(next);\n }\n });\n useLayoutEffect(() => {\n const active = drag.get();\n if (disabled || (active && active.horizontal !== horizontal)) {\n drag.cancel();\n }\n });\n const tracks = `minmax(0, ${current}fr) var(--gridui-resizable-handle-size, 12px) minmax(0, ${100 - current}fr)`;\n return (<div\n {...restProps}\n className={cn(\"gridui-resizable\", className)}\n data-orientation={orientation}\n style={{\n ...style,\n ...(horizontal ? { gridTemplateColumns: tracks } : { gridTemplateRows: tracks }),\n }}\n >\n <div\n id={firstId}\n ref={firstRef}\n className=\"gridui-resizable-panel\"\n >\n {first}\n </div>\n <div\n role=\"separator\"\n aria-label={label}\n aria-controls={`${firstId} ${secondId}`}\n aria-orientation={horizontal ? \"vertical\" : \"horizontal\"}\n aria-valuemin={minSize}\n aria-valuemax={maxSize}\n aria-valuenow={Math.round(current * 100) / 100}\n aria-valuetext={`${Math.round(current)}%`}\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? -1 : 0}\n className=\"gridui-resizable-handle\"\n onKeyDown={(event) => {\n if (disabled || event.defaultPrevented || isComposingKeyEvent(event.nativeEvent)) {\n return;\n }\n const reverse = getComputedStyle(event.currentTarget).direction === \"rtl\";\n const next = keyboardSize(event.key, current, step * (event.shiftKey ? 10 : 1), horizontal, reverse, minSize, maxSize);\n if (next !== null) {\n event.preventDefault();\n update(next);\n }\n }}\n onPointerDown={(event) => {\n if (disabled) {\n return;\n }\n const handle = event.currentTarget;\n const bounds = handle.parentElement?.getBoundingClientRect();\n if (!bounds) {\n return;\n }\n const handleBounds = handle.getBoundingClientRect();\n const started = drag.start(event, {\n start: horizontal ? event.clientX : event.clientY,\n size: current,\n extent: horizontal ? bounds.width - handleBounds.width : bounds.height - handleBounds.height,\n reverse: horizontal && getComputedStyle(handle).direction === \"rtl\",\n horizontal,\n });\n if (started) {\n handle.focus();\n event.preventDefault();\n }\n }}\n onPointerMove={(event) => {\n const active = drag.get(event.pointerId);\n if (!active) {\n return;\n }\n const coordinate = horizontal ? event.clientX : event.clientY;\n update(pointerSize(active.size, coordinate - active.start, active.extent, active.reverse, minSize, maxSize));\n }}\n onPointerUp={(event) => {\n drag.finish(event.pointerId);\n }}\n onPointerCancel={(event) => {\n drag.cancel(event.pointerId);\n }}\n onLostPointerCapture={(event) => {\n drag.cancel(event.pointerId);\n }}\n />\n <div\n id={secondId}\n ref={secondRef}\n className=\"gridui-resizable-panel\"\n >\n {second}\n </div>\n </div>);\n};\n"],
|
|
5
|
+
"mappings": ";AAOO,IAAM,gBAAgB,CAAC,MAAc,KAAa,QAAwB;AAC7E,MAAI,CAAC,OAAO,SAAS,IAAI,KAAK,CAAC,OAAO,SAAS,GAAG,KAAK,CAAC,OAAO,SAAS,GAAG,KAAK,MAAM,KAAK,MAAM,OAAO,MAAM,KAAK;AAC/G,UAAM,IAAI,WAAW,2EAA2E;AAAA,EACpG;AACA,SAAO,KAAK,IAAI,KAAK,KAAK,IAAI,KAAK,IAAI,CAAC;AAC5C;AAEO,IAAM,cAAc,CAAC,MAAc,OAAe,QAAgB,SAAkB,KAAa,QAAwB;AAC5H,SAAO,cAAc,SAAS,IAAI,OAAO,QAAQ,SAAS,OAAO,U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SAAS;AAAA,YAC/B;AAAA,YACA,iBAAiB,CAAC,UAAU;AACxB,mBAAK,OAAO,MAAM,SAAS;AAAA,YAC/B;AAAA,YACA,sBAAsB,CAAC,UAAU;AAC7B,mBAAK,OAAO,MAAM,SAAS;AAAA,YAC/B;AAAA;AAAA,QACJ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACG,IAAI;AAAA,YACJ,KAAK;AAAA,YACL,WAAU;AAAA,YAET;AAAA;AAAA,QACL;AAAA;AAAA;AAAA,EACJ;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/docs/catalog.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/resizable",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.4",
|
|
5
5
|
"category": "layout",
|
|
6
6
|
"description": "GridUI React resizable",
|
|
7
7
|
"usage": "Two independently scrolling regions separated by a keyboard and pointer resizer. Resizable owns its separator; surrounding Grid regions continue to own outer seams.",
|
|
8
8
|
"documentation": [
|
|
9
|
-
"README.md"
|
|
9
|
+
"README.md",
|
|
10
|
+
"docs/reference/README.md",
|
|
11
|
+
"docs/reference/resizable.md"
|
|
10
12
|
],
|
|
11
13
|
"exports": [
|
|
12
14
|
{
|
|
@@ -26,6 +28,8 @@
|
|
|
26
28
|
"@gridui/resizable/styles.css"
|
|
27
29
|
],
|
|
28
30
|
"examples": [
|
|
31
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-layout/resizable/stories/getting-started.mdx",
|
|
32
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-layout/resizable/stories/regions.mdx",
|
|
29
33
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-layout/resizable/stories/resizable.stories.tsx"
|
|
30
34
|
]
|
|
31
35
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
|
|
2
|
+
# Resizable
|
|
3
|
+
|
|
4
|
+
Divides content into two panels with a movable separator. Use it when users need to adjust how much space each panel receives.
|
|
5
|
+
|
|
6
|
+
Import from ``@gridui/resizable`` and load Theme before this family's stylesheet.
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Resizable } from "@gridui/resizable";
|
|
10
|
+
import "@gridui/theme/styles.css";
|
|
11
|
+
import "@gridui/resizable/styles.css";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-layout/resizable/README.md) for shared behavior and stylesheet dependencies.
|
|
15
|
+
|
|
16
|
+
The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-layout/resizable/stories/resizable.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
|
+
|
|
22
|
+
### onFocus
|
|
23
|
+
|
|
24
|
+
``(event: FocusEvent<HTMLDivElement, Element>): void`` · Optional
|
|
25
|
+
|
|
26
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
27
|
+
|
|
28
|
+
### onBlur
|
|
29
|
+
|
|
30
|
+
``(event: FocusEvent<HTMLDivElement, Element>): void`` · Optional
|
|
31
|
+
|
|
32
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
33
|
+
|
|
34
|
+
### onSubmit
|
|
35
|
+
|
|
36
|
+
``(event: SubmitEvent<HTMLDivElement>): void`` · Optional
|
|
37
|
+
|
|
38
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
39
|
+
|
|
40
|
+
### onClick
|
|
41
|
+
|
|
42
|
+
``(event: MouseEvent<HTMLDivElement, MouseEvent>): void`` · Optional
|
|
43
|
+
|
|
44
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
45
|
+
|
|
46
|
+
### first
|
|
47
|
+
|
|
48
|
+
``ReactNode`` · Required
|
|
49
|
+
|
|
50
|
+
### second
|
|
51
|
+
|
|
52
|
+
``ReactNode`` · Required
|
|
53
|
+
|
|
54
|
+
### label
|
|
55
|
+
|
|
56
|
+
``string`` · Required
|
|
57
|
+
|
|
58
|
+
### orientation
|
|
59
|
+
|
|
60
|
+
``"vertical" | "horizontal" | undefined`` · Optional
|
|
61
|
+
|
|
62
|
+
Default: ``"horizontal"``
|
|
63
|
+
|
|
64
|
+
### size
|
|
65
|
+
|
|
66
|
+
``number | undefined`` · Optional
|
|
67
|
+
|
|
68
|
+
Component size preset.
|
|
69
|
+
|
|
70
|
+
### defaultSize
|
|
71
|
+
|
|
72
|
+
``number | undefined`` · Optional
|
|
73
|
+
|
|
74
|
+
Default: ``50``
|
|
75
|
+
|
|
76
|
+
### minSize
|
|
77
|
+
|
|
78
|
+
``number | undefined`` · Optional
|
|
79
|
+
|
|
80
|
+
Default: ``10``
|
|
81
|
+
|
|
82
|
+
### maxSize
|
|
83
|
+
|
|
84
|
+
``number | undefined`` · Optional
|
|
85
|
+
|
|
86
|
+
Default: ``90``
|
|
87
|
+
|
|
88
|
+
### step
|
|
89
|
+
|
|
90
|
+
``number | undefined`` · Optional
|
|
91
|
+
|
|
92
|
+
Default: ``1``
|
|
93
|
+
|
|
94
|
+
### disabled
|
|
95
|
+
|
|
96
|
+
``boolean | undefined`` · Optional
|
|
97
|
+
|
|
98
|
+
Default: ``false``
|
|
99
|
+
|
|
100
|
+
Prevents interaction when enabled.
|
|
101
|
+
|
|
102
|
+
### onSizeChange
|
|
103
|
+
|
|
104
|
+
``(size: number): void`` · Optional
|
|
105
|
+
|
|
106
|
+
Called when the corresponding interaction occurs; inspect the arguments in Actions.
|
|
107
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/resizable",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "GridUI React resizable",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@gridui/interaction": "^1.2.1",
|
|
31
|
-
"@gridui/overlay": "^2.
|
|
32
|
-
"@gridui/
|
|
33
|
-
"@gridui/
|
|
31
|
+
"@gridui/overlay": "^2.1.0",
|
|
32
|
+
"@gridui/react-utils": "^1.0.0",
|
|
33
|
+
"@gridui/style-utils": "^4.0.0",
|
|
34
|
+
"@gridui/theme": "^2.5.4"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@gridui-internal/configuration": "0.0.0-internal",
|