@gridui/resizable 0.0.0-stage → 0.0.0

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 CHANGED
@@ -1,3 +1,29 @@
1
- # Temporary Holding Version
1
+ # @gridui/resizable
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Two independently scrolling regions separated by a keyboard and pointer resizer. Resizable owns its separator; surrounding Grid regions continue to own outer seams.
4
+
5
+ ```tsx
6
+ import "@gridui/theme/styles.css";
7
+ import "@gridui/resizable/styles.css";
8
+ import { Resizable } from "@gridui/resizable";
9
+
10
+ <Resizable
11
+ label="Resize navigation and document"
12
+ first={<Navigation />}
13
+ second={<Document />}
14
+ defaultSize={30}
15
+ minSize={15}
16
+ maxSize={60}
17
+ style={{ height: 400 }}
18
+ />;
19
+ ```
20
+
21
+ `orientation="horizontal"` places the first region at inline start and the second at inline end. `vertical` places them above and below. Supply a height for vertical layouts. Regions have zero minimum size and own overflow so wide content cannot force the separator outside its container.
22
+
23
+ `size`, `defaultSize` (50), `minSize` (10), `maxSize` (90), and `step` (1) are percentages of the space remaining after the separator. Bounds must be finite, ordered, and within 0–100. The second region receives the remaining percentage. Values outside updated bounds render at the nearest bound. Native div props and `ref` reach the root; the component owns its grid tracks.
24
+
25
+ Use `size`/`onSizeChange` for controlled state, or `defaultSize` for local state. A controlled consumer can reject changes without the panels moving. There is no persistence or automatic collapse. `disabled` removes the separator from the tab order and prevents resizing.
26
+
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
+
29
+ See [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-layout/resizable/.changeset/history).
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Resizable
4
+ * @namespace Root
5
+ * @description Index
6
+ */
7
+ export type { ResizableProps } from "./resizable/resizable";
8
+ export { Resizable } from "./resizable/resizable";
package/dist/index.js ADDED
@@ -0,0 +1,215 @@
1
+ // src/resizable/size.ts
2
+ var constrainSize = (size, min, max) => {
3
+ if (!Number.isFinite(size) || !Number.isFinite(min) || !Number.isFinite(max) || min < 0 || max > 100 || min > max) {
4
+ throw new RangeError("Resizable requires finite percentages and 0 <= minSize <= maxSize <= 100.");
5
+ }
6
+ return Math.min(max, Math.max(min, size));
7
+ };
8
+ var pointerSize = (size, delta, extent, reverse, min, max) => {
9
+ return constrainSize(extent > 0 ? size + delta / extent * 100 * (reverse ? -1 : 1) : size, min, max);
10
+ };
11
+ var keyboardSize = (key, size, step, horizontal, reverse, min, max) => {
12
+ if (key === "Home") {
13
+ return min;
14
+ }
15
+ if (key === "End") {
16
+ return max;
17
+ }
18
+ const positive = horizontal ? "ArrowRight" : "ArrowDown";
19
+ const negative = horizontal ? "ArrowLeft" : "ArrowUp";
20
+ if (key !== positive && key !== negative) {
21
+ return null;
22
+ }
23
+ return constrainSize(size + (key === positive ? 1 : -1) * (horizontal && reverse ? -1 : 1) * step, min, max);
24
+ };
25
+
26
+ // src/resizable/resizable.tsx
27
+ import { isComposingKeyEvent, listenForDragCancellation } from "@gridui/interaction";
28
+ import { cn } from "@gridui/style-utils";
29
+ import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
30
+ import { jsx, jsxs } from "react/jsx-runtime";
31
+ var Resizable = (props) => {
32
+ const {
33
+ first,
34
+ second,
35
+ label,
36
+ orientation = "horizontal",
37
+ size,
38
+ defaultSize = 50,
39
+ minSize = 10,
40
+ maxSize = 90,
41
+ step = 1,
42
+ disabled = false,
43
+ onSizeChange,
44
+ className,
45
+ style,
46
+ ...restProps
47
+ } = props;
48
+ const [
49
+ local,
50
+ setLocal
51
+ ] = useState(defaultSize);
52
+ const drag = useRef(null);
53
+ const separator = useRef(null);
54
+ const firstId = useId();
55
+ const secondId = useId();
56
+ const current = constrainSize(size ?? local, minSize, maxSize);
57
+ if (!Number.isFinite(step) || step <= 0) {
58
+ throw new RangeError("Resizable step must be a positive finite percentage.");
59
+ }
60
+ const horizontal = orientation === "horizontal";
61
+ const update = (next) => {
62
+ if (disabled) {
63
+ return;
64
+ }
65
+ if (size === void 0) {
66
+ setLocal(next);
67
+ }
68
+ if (next !== current) {
69
+ onSizeChange?.(next);
70
+ }
71
+ };
72
+ const cancel = () => {
73
+ const active = drag.current;
74
+ if (!active) {
75
+ return;
76
+ }
77
+ drag.current = null;
78
+ active.cleanup();
79
+ const next = constrainSize(active.size, minSize, maxSize);
80
+ if (size === void 0) {
81
+ setLocal(next);
82
+ }
83
+ if (next !== current) {
84
+ onSizeChange?.(next);
85
+ }
86
+ if (active.element.hasPointerCapture(active.pointerId)) {
87
+ active.element.releasePointerCapture(active.pointerId);
88
+ }
89
+ };
90
+ const cancelRef = useRef(cancel);
91
+ cancelRef.current = cancel;
92
+ useEffect(() => {
93
+ return () => {
94
+ cancelRef.current();
95
+ };
96
+ }, []);
97
+ useLayoutEffect(() => {
98
+ if (disabled || drag.current && drag.current.horizontal !== horizontal) {
99
+ cancel();
100
+ }
101
+ });
102
+ const tracks = `minmax(0, ${current}fr) var(--gridui-resizable-handle-size, 12px) minmax(0, ${100 - current}fr)`;
103
+ return /* @__PURE__ */ jsxs(
104
+ "div",
105
+ {
106
+ ...restProps,
107
+ className: cn("gridui-resizable", className),
108
+ "data-orientation": orientation,
109
+ style: {
110
+ ...style,
111
+ ...horizontal ? { gridTemplateColumns: tracks } : { gridTemplateRows: tracks }
112
+ },
113
+ children: [
114
+ /* @__PURE__ */ jsx(
115
+ "div",
116
+ {
117
+ id: firstId,
118
+ className: "gridui-resizable-panel",
119
+ children: first
120
+ }
121
+ ),
122
+ /* @__PURE__ */ jsx(
123
+ "div",
124
+ {
125
+ ref: separator,
126
+ role: "separator",
127
+ "aria-label": label,
128
+ "aria-controls": `${firstId} ${secondId}`,
129
+ "aria-orientation": horizontal ? "vertical" : "horizontal",
130
+ "aria-valuemin": minSize,
131
+ "aria-valuemax": maxSize,
132
+ "aria-valuenow": Math.round(current * 100) / 100,
133
+ "aria-valuetext": `${Math.round(current)}%`,
134
+ "aria-disabled": disabled || void 0,
135
+ tabIndex: disabled ? -1 : 0,
136
+ className: "gridui-resizable-handle",
137
+ onKeyDown: (event) => {
138
+ if (disabled || event.defaultPrevented || isComposingKeyEvent(event.nativeEvent)) {
139
+ return;
140
+ }
141
+ const reverse = getComputedStyle(event.currentTarget).direction === "rtl";
142
+ const next = keyboardSize(event.key, current, step * (event.shiftKey ? 10 : 1), horizontal, reverse, minSize, maxSize);
143
+ if (next !== null) {
144
+ event.preventDefault();
145
+ update(next);
146
+ }
147
+ },
148
+ onPointerDown: (event) => {
149
+ if (disabled || event.button !== 0 || !event.isPrimary || drag.current) {
150
+ return;
151
+ }
152
+ const handle = event.currentTarget;
153
+ const bounds = handle.parentElement?.getBoundingClientRect();
154
+ if (!bounds) {
155
+ return;
156
+ }
157
+ const handleBounds = handle.getBoundingClientRect();
158
+ drag.current = {
159
+ pointerId: event.pointerId,
160
+ start: horizontal ? event.clientX : event.clientY,
161
+ size: current,
162
+ extent: horizontal ? bounds.width - handleBounds.width : bounds.height - handleBounds.height,
163
+ reverse: horizontal && getComputedStyle(handle).direction === "rtl",
164
+ horizontal,
165
+ element: handle,
166
+ cleanup: listenForDragCancellation(handle, () => {
167
+ cancelRef.current();
168
+ })
169
+ };
170
+ handle.focus();
171
+ handle.setPointerCapture(event.pointerId);
172
+ event.preventDefault();
173
+ },
174
+ onPointerMove: (event) => {
175
+ const active = drag.current;
176
+ if (!active || active.pointerId !== event.pointerId) {
177
+ return;
178
+ }
179
+ const coordinate = horizontal ? event.clientX : event.clientY;
180
+ update(pointerSize(active.size, coordinate - active.start, active.extent, active.reverse, minSize, maxSize));
181
+ },
182
+ onPointerUp: (event) => {
183
+ if (drag.current?.pointerId === event.pointerId) {
184
+ const active = drag.current;
185
+ drag.current = null;
186
+ active.cleanup();
187
+ if (event.currentTarget.hasPointerCapture(event.pointerId)) {
188
+ event.currentTarget.releasePointerCapture(event.pointerId);
189
+ }
190
+ }
191
+ },
192
+ onPointerCancel: (event) => {
193
+ if (drag.current?.pointerId === event.pointerId) {
194
+ cancel();
195
+ }
196
+ },
197
+ onLostPointerCapture: cancel
198
+ }
199
+ ),
200
+ /* @__PURE__ */ jsx(
201
+ "div",
202
+ {
203
+ id: secondId,
204
+ className: "gridui-resizable-panel",
205
+ children: second
206
+ }
207
+ )
208
+ ]
209
+ }
210
+ );
211
+ };
212
+ export {
213
+ Resizable
214
+ };
215
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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, listenForDragCancellation } from \"@gridui/interaction\";\nimport { cn } from \"@gridui/style-utils\";\nimport { type ComponentPropsWithRef, type FC, type ReactNode, useEffect, useId, useLayoutEffect, useRef, 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 pointerId: number;\n readonly start: number;\n readonly size: number;\n readonly extent: number;\n readonly reverse: boolean;\n readonly horizontal: boolean;\n readonly element: HTMLDivElement;\n readonly cleanup: () => void;\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 drag = useRef<Drag | null>(null);\n const separator = useRef<HTMLDivElement>(null);\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 cancel = () => {\n const active = drag.current;\n if (!active) {\n return;\n }\n drag.current = null;\n active.cleanup();\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 if (active.element.hasPointerCapture(active.pointerId)) {\n active.element.releasePointerCapture(active.pointerId);\n }\n };\n const cancelRef = useRef(cancel);\n cancelRef.current = cancel;\n useEffect(() => {\n return () => {\n cancelRef.current();\n };\n }, []);\n useLayoutEffect(() => {\n if (disabled || (drag.current && drag.current.horizontal !== horizontal)) {\n 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 className=\"gridui-resizable-panel\"\n >\n {first}\n </div>\n <div\n ref={separator}\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 || event.button !== 0 || !event.isPrimary || drag.current) {\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 drag.current = {\n pointerId: event.pointerId,\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 element: handle,\n cleanup: listenForDragCancellation(handle, () => {\n cancelRef.current();\n }),\n };\n handle.focus();\n handle.setPointerCapture(event.pointerId);\n event.preventDefault();\n }}\n onPointerMove={(event) => {\n const active = drag.current;\n if (!active || active.pointerId !== event.pointerId) {\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 if (drag.current?.pointerId === event.pointerId) {\n const active = drag.current;\n drag.current = null;\n active.cleanup();\n if (event.currentTarget.hasPointerCapture(event.pointerId)) {\n event.currentTarget.releasePointerCapture(event.pointerId);\n }\n }\n }}\n onPointerCancel={(event) => {\n if (drag.current?.pointerId === event.pointerId) {\n cancel();\n }\n }}\n onLostPointerCapture={cancel}\n />\n <div\n id={secondId}\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,UAAU,KAAK,KAAK,MAAM,KAAK,GAAG;AACvG;AAEO,IAAM,eAAe,CAAC,KAAa,MAAc,MAAc,YAAqB,SAAkB,KAAa,QAA+B;AACrJ,MAA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,UAAU;AACtB,oBAAM,SAAS,KAAK;AACpB,kBAAI,CAAC,UAAU,OAAO,cAAc,MAAM,WAAW;AACjD;AAAA,cACJ;AACA,oBAAM,aAAa,aAAa,MAAM,UAAU,MAAM;AACtD,qBAAO,YAAY,OAAO,MAAM,aAAa,OAAO,OAAO,OAAO,QAAQ,OAAO,SAAS,SAAS,OAAO,CAAC;AAAA,YAC/G;AAAA,YACA,aAAa,CAAC,UAAU;AACpB,kBAAI,KAAK,SAAS,cAAc,MAAM,WAAW;AAC7C,sBAAM,SAAS,KAAK;AACpB,qBAAK,UAAU;AACf,uBAAO,QAAQ;AACf,oBAAI,MAAM,cAAc,kBAAkB,MAAM,SAAS,GAAG;AACxD,wBAAM,cAAc,sBAAsB,MAAM,SAAS;AAAA,gBAC7D;AAAA,cACJ;AAAA,YACJ;AAAA,YACA,iBAAiB,CAAC,UAAU;AACxB,kBAAI,KAAK,SAAS,cAAc,MAAM,WAAW;AAC7C,uBAAO;AAAA,cACX;AAAA,YACJ;AAAA,YACA,sBAAsB;AAAA;AAAA,QAC1B;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACG,IAAI;AAAA,YACJ,WAAU;AAAA,YAET;AAAA;AAAA,QACL;AAAA;AAAA;AAAA,EACJ;AACJ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Resizable
4
+ * @namespace Resizable
5
+ * @description Resizable
6
+ */
7
+ import { type ComponentPropsWithRef, type FC, type ReactNode } from "react";
8
+ export type ResizableProps = Omit<ComponentPropsWithRef<"div">, "children" | "onChange"> & {
9
+ readonly first: ReactNode;
10
+ readonly second: ReactNode;
11
+ readonly label: string;
12
+ readonly orientation?: "horizontal" | "vertical";
13
+ readonly size?: number;
14
+ readonly defaultSize?: number;
15
+ readonly minSize?: number;
16
+ readonly maxSize?: number;
17
+ readonly step?: number;
18
+ readonly disabled?: boolean;
19
+ readonly onSizeChange?: (size: number) => void;
20
+ };
21
+ export declare const Resizable: FC<ResizableProps>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Resizable
4
+ * @namespace Resizable
5
+ * @description Size
6
+ */
7
+ export declare const constrainSize: (size: number, min: number, max: number) => number;
8
+ export declare const pointerSize: (size: number, delta: number, extent: number, reverse: boolean, min: number, max: number) => number;
9
+ export declare const keyboardSize: (key: string, size: number, step: number, horizontal: boolean, reverse: boolean, min: number, max: number) => number | null;
@@ -0,0 +1,48 @@
1
+ /*! tailwindcss v4.3.4 | MIT License | https://tailwindcss.com */
2
+ @layer theme, base, components, utilities;
3
+ @layer utilities;
4
+ @layer components {
5
+ .gridui-resizable {
6
+ display: grid;
7
+ min-inline-size: 0;
8
+ min-block-size: 0;
9
+ isolation: isolate;
10
+ }
11
+ .gridui-resizable-panel {
12
+ min-inline-size: 0;
13
+ min-block-size: 0;
14
+ overflow: auto;
15
+ }
16
+ .gridui-resizable-handle {
17
+ position: relative;
18
+ touch-action: none;
19
+ user-select: none;
20
+ cursor: col-resize;
21
+ outline-offset: calc(-1 * var(--gridui-focus-width));
22
+ }
23
+ .gridui-resizable-handle::before {
24
+ position: absolute;
25
+ inset-block: 0;
26
+ inset-inline-start: 50%;
27
+ border-inline-start: 1px solid var(--gridui-border);
28
+ content: "";
29
+ }
30
+ .gridui-resizable[data-orientation="vertical"] > .gridui-resizable-handle {
31
+ cursor: row-resize;
32
+ }
33
+ .gridui-resizable[data-orientation="vertical"] > .gridui-resizable-handle::before {
34
+ inset-inline: 0;
35
+ inset-block-start: 50%;
36
+ border-block-start: 1px solid var(--gridui-border);
37
+ border-inline-start: 0;
38
+ }
39
+ .gridui-resizable-handle[aria-disabled="true"] {
40
+ cursor: default;
41
+ touch-action: auto;
42
+ }
43
+ @media (pointer: coarse) {
44
+ .gridui-resizable {
45
+ --gridui-resizable-handle-size: 24px;
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "name": "@gridui/resizable",
4
+ "version": "0.0.0",
5
+ "category": "layout",
6
+ "description": "GridUI React resizable",
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
+ "documentation": [
9
+ "README.md"
10
+ ],
11
+ "exports": [
12
+ {
13
+ "name": "Resizable",
14
+ "kind": "component",
15
+ "importPath": "@gridui/resizable"
16
+ },
17
+ {
18
+ "name": "ResizableProps",
19
+ "kind": "type",
20
+ "importPath": "@gridui/resizable"
21
+ }
22
+ ],
23
+ "styles": [
24
+ "@gridui/theme/styles.css",
25
+ "@gridui/resizable/styles.css"
26
+ ],
27
+ "examples": [
28
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-layout/resizable/stories/resizable.stories.tsx"
29
+ ]
30
+ }
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@gridui/resizable",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.0.0",
4
+ "description": "GridUI React resizable",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "README.md",
10
+ "docs"
11
+ ],
12
+ "sideEffects": [
13
+ "**/*.css"
14
+ ],
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ },
20
+ "./styles.css": "./dist/styles.css"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "peerDependencies": {
26
+ "react": "^19.2.0",
27
+ "react-dom": "^19.2.0"
28
+ },
29
+ "dependencies": {
30
+ "@gridui/interaction": "^1.1.2",
31
+ "@gridui/style-utils": "^2.2.0",
32
+ "@gridui/theme": "^2.5.1"
33
+ },
34
+ "devDependencies": {
35
+ "@gridui-internal/configuration": "0.0.0-internal",
36
+ "@jest/globals": "30.5.2",
37
+ "@storybook/react-vite": "10.6.5",
38
+ "@types/jest": "30.0.0",
39
+ "@types/node": "26.6.6",
40
+ "@types/react": "19.3.0",
41
+ "@types/react-dom": "19.3.0",
42
+ "jest": "30.5.2",
43
+ "react": "19.3.1",
44
+ "react-dom": "19.3.1",
45
+ "typescript": "6.0.3"
46
+ },
47
+ "scripts": {
48
+ "build": "node ../../scripts/compilation/package.ts",
49
+ "compile": "tsc --project tsconfig.json",
50
+ "test": "jest",
51
+ "coverage": "jest --coverage"
52
+ }
6
53
  }