@puzzle-ui/ui 0.1.0 → 0.3.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.
Files changed (25) hide show
  1. package/README.md +81 -0
  2. package/dist/components/layout/resizable-panels/index.cjs +226 -0
  3. package/dist/components/layout/resizable-panels/index.cjs.map +1 -0
  4. package/dist/components/layout/resizable-panels/index.d.cts +59 -0
  5. package/dist/components/layout/resizable-panels/index.d.ts +59 -0
  6. package/dist/components/layout/resizable-panels/index.js +224 -0
  7. package/dist/components/layout/resizable-panels/index.js.map +1 -0
  8. package/dist/components/layout/resizable-panels/resizable-panels.css +121 -0
  9. package/dist/components/layout/resizable-panels/resizable-panels.utils.cjs +107 -0
  10. package/dist/components/layout/resizable-panels/resizable-panels.utils.cjs.map +1 -0
  11. package/dist/components/layout/resizable-panels/resizable-panels.utils.js +105 -0
  12. package/dist/components/layout/resizable-panels/resizable-panels.utils.js.map +1 -0
  13. package/dist/components/overlays/dropdown-menu/dropdown-menu-content.cjs +13 -1
  14. package/dist/components/overlays/dropdown-menu/dropdown-menu-content.cjs.map +1 -1
  15. package/dist/components/overlays/dropdown-menu/dropdown-menu-content.js +13 -1
  16. package/dist/components/overlays/dropdown-menu/dropdown-menu-content.js.map +1 -1
  17. package/dist/components/overlays/popout/index.cjs +7 -1
  18. package/dist/components/overlays/popout/index.cjs.map +1 -1
  19. package/dist/components/overlays/popout/index.js +8 -3
  20. package/dist/components/overlays/popout/index.js.map +1 -1
  21. package/dist/index.cjs +51 -47
  22. package/dist/index.d.cts +2 -1
  23. package/dist/index.d.ts +2 -1
  24. package/dist/index.js +2 -1
  25. package/package.json +6 -6
package/README.md CHANGED
@@ -1,5 +1,79 @@
1
1
  # @puzzle-ui/ui
2
2
 
3
+ Composable React UI components for Puzzle: actions, forms, data display,
4
+ layout, navigation, overlays, typography, and utilities.
5
+
6
+ > Puzzle is under active development and is not ready for production use.
7
+ > APIs, styling, accessibility coverage, and framework compatibility may
8
+ > change. Use it for experimentation and evaluation.
9
+
10
+ ## Installation
11
+
12
+ Install the UI library and its theme provider:
13
+
14
+ ```sh
15
+ npm install @puzzle-ui/ui @puzzle-ui/theme
16
+ # or
17
+ bun add @puzzle-ui/ui @puzzle-ui/theme
18
+ # or
19
+ pnpm add @puzzle-ui/ui @puzzle-ui/theme
20
+ # or
21
+ yarn add @puzzle-ui/ui @puzzle-ui/theme
22
+ ```
23
+
24
+ Requires React and React DOM 19 (`^19.0.0`) and a bundler that supports CSS
25
+ imports, such as Vite. Consumers do not need Bun.
26
+
27
+ ## Usage
28
+
29
+ ```tsx
30
+ import { Theme } from "@puzzle-ui/theme";
31
+ import { Button } from "@puzzle-ui/ui";
32
+
33
+ export const App = () => (
34
+ <Theme>
35
+ <main>
36
+ <h1>Hello, Puzzle</h1>
37
+ <Button onClick={() => window.alert("Hello!")}>
38
+ Get started
39
+ </Button>
40
+ </main>
41
+ </Theme>
42
+ );
43
+ ```
44
+
45
+ `Theme` supplies the design tokens and global defaults. Component CSS is
46
+ imported automatically; no separate Puzzle stylesheet or Tailwind setup is
47
+ required. Customize colors, fonts, spacing, and other tokens through
48
+ [`@puzzle-ui/theme`](../theme/README.md).
49
+
50
+ ## Components and imports
51
+
52
+ Use named imports from `@puzzle-ui/ui`. Components include buttons, cards,
53
+ inputs, dialogs, tabs, navigation, layout primitives, and typography.
54
+ Internal component paths are not exported package entry points.
55
+
56
+ Browse the repository's
57
+ [component documentation](../../apps/site/content/docs/components/ui) for
58
+ examples, props, and accessibility guidance. Interactive components need a
59
+ client boundary in React Server Component applications.
60
+
61
+ The package ships ESM and CommonJS builds with matching TypeScript
62
+ declarations. Its CSS requires a CSS-aware bundler rather than bare Node.js.
63
+ Test your chosen components in your framework; compatibility is still being
64
+ evaluated.
65
+
66
+ ## Development
67
+
68
+ From an installed repository checkout:
69
+
70
+ ```sh
71
+ npm run build --workspace=@puzzle-ui/ui
72
+ ```
73
+
74
+ `prepack` rebuilds the package before packing or publishing. See the root
75
+ [publishing guide](../../README.md#publishing-packages).
76
+
3
77
  ## Tests
4
78
 
5
79
  Three layers, selected by file name and run by Vitest projects (see `vitest.config.ts`):
@@ -15,3 +89,10 @@ Three layers, selected by file name and run by Vitest projects (see `vitest.conf
15
89
  - **Browser**: behavior that needs real layout, computed styles, focus or pointer input.
16
90
 
17
91
  `bun run vitest` runs unit and component; `bun run test:all` runs everything. The first browser run needs `bunx playwright install chromium`.
92
+
93
+ Run these test commands from this package directory in a repository
94
+ checkout, after installing workspace dependencies.
95
+
96
+ ## License
97
+
98
+ MIT. See [LICENSE](../../LICENSE); the published license is at `dist/LICENSE`.
@@ -0,0 +1,226 @@
1
+ "use client";
2
+ const require_resizable_panels_utils = require("./resizable-panels.utils.cjs");
3
+ ;/* empty css */
4
+ let _puzzle_ui_core = require("@puzzle-ui/core");
5
+ let react = require("react");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ // src/components/layout/resizable-panels/index.tsx
8
+ const isResizablePanelElement = (child) => (0, react.isValidElement)(child) && child.type === ResizablePanel;
9
+ const isResizableHandleElement = (child) => (0, react.isValidElement)(child) && child.type === ResizableHandle;
10
+ const parsePixels = (value) => Number.parseFloat(value ?? "") || 0;
11
+ const getAvailableSize = (group, orientation) => {
12
+ const computedStyle = group.ownerDocument.defaultView?.getComputedStyle(group);
13
+ const isHorizontal = orientation === "horizontal";
14
+ const totalSize = isHorizontal ? group.clientWidth : group.clientHeight;
15
+ const paddingSize = computedStyle ? isHorizontal ? parsePixels(computedStyle.paddingLeft) + parsePixels(computedStyle.paddingRight) : parsePixels(computedStyle.paddingTop) + parsePixels(computedStyle.paddingBottom) : 0;
16
+ const handleSize = Array.from(group.children).reduce((total, child) => {
17
+ const element = child;
18
+ if (!element.hasAttribute("data-puzzle-resizable-handle")) return total;
19
+ const rect = element.getBoundingClientRect();
20
+ return total + (isHorizontal ? rect.width : rect.height);
21
+ }, 0);
22
+ return Math.max(0, totalSize - paddingSize - handleSize);
23
+ };
24
+ const getResizeDirection = (element, orientation) => {
25
+ if (orientation !== "horizontal") return 1;
26
+ return element.ownerDocument.defaultView?.getComputedStyle(element).direction === "rtl" ? -1 : 1;
27
+ };
28
+ const getPointerCoordinate = (event, orientation) => orientation === "horizontal" ? event.clientX : event.clientY;
29
+ const ResizablePanel = ({ id, minSize = 0, maxSize = 100, panelIndex = 0, panelSize = 1, panelId, className, style, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
30
+ ...props,
31
+ id: panelId ?? id,
32
+ className: (0, _puzzle_ui_core.cn)("puzzle-resizable-panels__panel", className),
33
+ style: {
34
+ ...style,
35
+ flex: `${panelSize} 1 0%`
36
+ },
37
+ "data-panel-index": panelIndex,
38
+ "data-panel-size": panelSize,
39
+ "data-panel-min-size": minSize,
40
+ "data-panel-max-size": maxSize
41
+ });
42
+ const ResizableHandle = ({ withGrip = false, disabled = false, handleIndex = -1, orientation = "horizontal", value, minValue, maxValue, panelIds, inheritedDisabled = false, onResizeStart, onResizeMove, onResizeEnd, onResizeKeyDown, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onLostPointerCapture, onKeyDown, className, children, tabIndex, "aria-label": ariaLabel, ...props }) => {
43
+ const isDisabled = disabled || inheritedDisabled;
44
+ const handlePointerDown = (event) => {
45
+ onPointerDown?.(event);
46
+ if (!event.defaultPrevented && !isDisabled) onResizeStart?.(event, handleIndex);
47
+ };
48
+ const handlePointerMove = (event) => {
49
+ onPointerMove?.(event);
50
+ if (!event.defaultPrevented && !isDisabled) onResizeMove?.(event, handleIndex);
51
+ };
52
+ const handlePointerUp = (event) => {
53
+ onResizeEnd?.(event, handleIndex);
54
+ onPointerUp?.(event);
55
+ };
56
+ const handlePointerCancel = (event) => {
57
+ onResizeEnd?.(event, handleIndex);
58
+ onPointerCancel?.(event);
59
+ };
60
+ const handleLostPointerCapture = (event) => {
61
+ onResizeEnd?.(event, handleIndex);
62
+ onLostPointerCapture?.(event);
63
+ };
64
+ const handleKeyDown = (event) => {
65
+ onKeyDown?.(event);
66
+ if (!event.defaultPrevented && !isDisabled) onResizeKeyDown?.(event, handleIndex);
67
+ };
68
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
69
+ ...props,
70
+ className: (0, _puzzle_ui_core.cn)("puzzle-resizable-panels__handle", className),
71
+ role: "separator",
72
+ tabIndex: isDisabled ? -1 : tabIndex ?? 0,
73
+ "aria-label": ariaLabel ?? "Resize panels",
74
+ "aria-orientation": orientation === "horizontal" ? "vertical" : "horizontal",
75
+ "aria-controls": panelIds?.join(" "),
76
+ "aria-valuenow": value,
77
+ "aria-valuemin": minValue,
78
+ "aria-valuemax": maxValue,
79
+ "aria-valuetext": value === void 0 ? void 0 : `${Math.round(value * 100) / 100}%`,
80
+ "aria-disabled": isDisabled || void 0,
81
+ "data-puzzle-resizable-handle": "",
82
+ "data-orientation": orientation,
83
+ "data-disabled": isDisabled ? "true" : void 0,
84
+ onPointerDown: handlePointerDown,
85
+ onPointerMove: handlePointerMove,
86
+ onPointerUp: handlePointerUp,
87
+ onPointerCancel: handlePointerCancel,
88
+ onLostPointerCapture: handleLostPointerCapture,
89
+ onKeyDown: handleKeyDown,
90
+ children: withGrip ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
91
+ className: "puzzle-resizable-panels__handle-grip",
92
+ "aria-hidden": "true"
93
+ }) : children
94
+ });
95
+ };
96
+ const ResizablePanelsRoot = ({ children, orientation = "horizontal", sizes, defaultSizes, onSizesChange, disabled = false, keyboardStep = 1, id, role, className, style, ref: forwardedRef, ...rootProps }) => {
97
+ const generatedId = (0, react.useId)();
98
+ const groupId = id ?? `puzzle-resizable-panels-${generatedId}`;
99
+ if (!Number.isFinite(keyboardStep) || keyboardStep <= 0) throw new RangeError("keyboardStep must be a positive finite number.");
100
+ const childrenArray = react.Children.toArray(children);
101
+ if (!(childrenArray.length >= 3 && childrenArray.length % 2 === 1 && childrenArray.every((child, index) => index % 2 === 0 ? isResizablePanelElement(child) : isResizableHandleElement(child)))) throw new Error("ResizablePanels requires alternating Panel and Handle children, starting and ending with a Panel. At least two panels are required.");
102
+ const panelElements = childrenArray.filter(isResizablePanelElement);
103
+ const panelCount = panelElements.length;
104
+ const panelConstraints = panelElements.map((panel) => ({
105
+ minSize: panel.props.minSize,
106
+ maxSize: panel.props.maxSize
107
+ }));
108
+ const panelIds = panelElements.map((panel, index) => panel.props.id ?? `${groupId}-panel-${index}`);
109
+ if (new Set(panelIds).size !== panelIds.length) throw new Error("ResizablePanels requires unique panel IDs.");
110
+ const [uncontrolledSizes, setUncontrolledSizes] = (0, react.useState)(() => require_resizable_panels_utils.normalizePanelSizes(sizes === void 0 ? defaultSizes : void 0, panelConstraints));
111
+ const layoutInput = sizes ?? (uncontrolledSizes.length === panelCount ? uncontrolledSizes : void 0);
112
+ const currentSizes = require_resizable_panels_utils.normalizePanelSizes(layoutInput, panelConstraints);
113
+ const [isResizing, setIsResizing] = (0, react.useState)(false);
114
+ const groupRef = (0, react.useRef)(null);
115
+ const pointerDragRef = (0, react.useRef)(null);
116
+ const updateSizes = (nextSizes) => {
117
+ const normalized = require_resizable_panels_utils.normalizePanelSizes(nextSizes, panelConstraints);
118
+ if (!normalized.some((size, index) => Math.abs(size - currentSizes[index]) > 1e-6)) return;
119
+ if (sizes === void 0) setUncontrolledSizes(normalized);
120
+ onSizesChange?.(normalized);
121
+ };
122
+ const handlePointerDown = (event, handleIndex) => {
123
+ const group = groupRef.current;
124
+ if (!group || disabled) return;
125
+ if (event.button !== 0 && event.pointerType !== "touch" && event.pointerType !== "pen") return;
126
+ const availableSize = getAvailableSize(group, orientation);
127
+ if (availableSize <= 0) return;
128
+ pointerDragRef.current = {
129
+ handleIndex,
130
+ pointerId: event.pointerId,
131
+ startCoordinate: getPointerCoordinate(event, orientation),
132
+ availableSize,
133
+ direction: getResizeDirection(group, orientation),
134
+ sizes: [...currentSizes]
135
+ };
136
+ try {
137
+ event.currentTarget.setPointerCapture(event.pointerId);
138
+ } catch {}
139
+ event.preventDefault();
140
+ setIsResizing(true);
141
+ };
142
+ const handlePointerMove = (event, handleIndex) => {
143
+ const drag = pointerDragRef.current;
144
+ if (!drag || drag.pointerId !== event.pointerId || drag.handleIndex !== handleIndex) return;
145
+ const delta = (getPointerCoordinate(event, orientation) - drag.startCoordinate) / drag.availableSize * 100 * drag.direction;
146
+ const nextSizes = require_resizable_panels_utils.resizePanelPair(drag.sizes, panelConstraints, handleIndex, delta);
147
+ event.preventDefault();
148
+ updateSizes(nextSizes);
149
+ };
150
+ const handlePointerEnd = (event, handleIndex) => {
151
+ const drag = pointerDragRef.current;
152
+ if (!drag || drag.pointerId !== event.pointerId || drag.handleIndex !== handleIndex) return;
153
+ pointerDragRef.current = null;
154
+ setIsResizing(false);
155
+ };
156
+ const handleKeyDown = (event, handleIndex) => {
157
+ if (disabled) return;
158
+ const currentSize = currentSizes[handleIndex];
159
+ const bounds = require_resizable_panels_utils.getPanelPairBounds(currentSizes, panelConstraints, handleIndex);
160
+ const group = groupRef.current;
161
+ const direction = group ? getResizeDirection(group, orientation) : 1;
162
+ const step = keyboardStep * (event.shiftKey ? 10 : 1);
163
+ let nextSize;
164
+ if (event.key === "Home") nextSize = bounds.minSize;
165
+ else if (event.key === "End") nextSize = bounds.maxSize;
166
+ else if (orientation === "horizontal") {
167
+ if (event.key === "ArrowRight") nextSize = currentSize + step * direction;
168
+ else if (event.key === "ArrowLeft") nextSize = currentSize - step * direction;
169
+ } else if (event.key === "ArrowDown") nextSize = currentSize + step;
170
+ else if (event.key === "ArrowUp") nextSize = currentSize - step;
171
+ if (nextSize === void 0) return;
172
+ event.preventDefault();
173
+ updateSizes(require_resizable_panels_utils.resizePanelPair(currentSizes, panelConstraints, handleIndex, nextSize - currentSize));
174
+ };
175
+ let panelIndex = 0;
176
+ const enhancedChildren = childrenArray.map((child) => {
177
+ if (isResizablePanelElement(child)) {
178
+ const index = panelIndex++;
179
+ return (0, react.cloneElement)(child, {
180
+ panelIndex: index,
181
+ panelSize: currentSizes[index],
182
+ panelId: panelIds[index]
183
+ });
184
+ }
185
+ const handleIndex = panelIndex - 1;
186
+ const bounds = require_resizable_panels_utils.getPanelPairBounds(currentSizes, panelConstraints, handleIndex);
187
+ return (0, react.cloneElement)(child, {
188
+ handleIndex,
189
+ orientation,
190
+ value: currentSizes[handleIndex],
191
+ minValue: bounds.minSize,
192
+ maxValue: bounds.maxSize,
193
+ panelIds: [panelIds[handleIndex], panelIds[handleIndex + 1]],
194
+ inheritedDisabled: disabled,
195
+ onResizeStart: handlePointerDown,
196
+ onResizeMove: handlePointerMove,
197
+ onResizeEnd: handlePointerEnd,
198
+ onResizeKeyDown: handleKeyDown
199
+ });
200
+ });
201
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
202
+ ...rootProps,
203
+ ref: (node) => {
204
+ groupRef.current = node;
205
+ if (typeof forwardedRef === "function") forwardedRef(node);
206
+ else if (forwardedRef) forwardedRef.current = node;
207
+ },
208
+ id: groupId,
209
+ role: role ?? "group",
210
+ className: (0, _puzzle_ui_core.cn)("puzzle-resizable-panels", className),
211
+ style,
212
+ "data-orientation": orientation,
213
+ "data-disabled": disabled ? "true" : void 0,
214
+ "data-resizing": isResizing ? "true" : void 0,
215
+ children: enhancedChildren
216
+ });
217
+ };
218
+ const ResizablePanels = Object.assign(ResizablePanelsRoot, {
219
+ Panel: ResizablePanel,
220
+ Handle: ResizableHandle
221
+ });
222
+ exports.ResizableHandle = ResizableHandle;
223
+ exports.ResizablePanel = ResizablePanel;
224
+ exports.ResizablePanels = ResizablePanels;
225
+
226
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["isValidElement","cn","useId","Children","useState","normalizePanelSizes","useRef","resizePanelPair","getPanelPairBounds","cloneElement"],"sources":["../../../../src/components/layout/resizable-panels/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@puzzle-ui/core\";\n\nimport {\n Children,\n cloneElement,\n isValidElement,\n useId,\n useRef,\n useState,\n type ComponentPropsWithRef,\n type KeyboardEvent as ReactKeyboardEvent,\n type PointerEvent as ReactPointerEvent,\n type ReactElement,\n type ReactNode,\n} from \"react\";\n\nimport {\n getPanelPairBounds,\n normalizePanelSizes,\n resizePanelPair,\n type PanelSizeConstraint,\n} from \"./resizable-panels.utils\";\n\nimport \"./resizable-panels.css\";\n\ntype ResizablePanelsOrientation = \"horizontal\" | \"vertical\";\n\ntype ResizablePanelsProps = Omit<ComponentPropsWithRef<\"div\">, \"children\"> & {\n /** Layout direction. Defaults to horizontal. */\n orientation?: ResizablePanelsOrientation;\n\n /** Controlled panel sizes, expressed as percentages. */\n sizes?: readonly number[];\n\n /** Initial panel sizes for uncontrolled usage. */\n defaultSizes?: readonly number[];\n\n /** Called whenever the panel layout changes. */\n onSizesChange?: (sizes: number[]) => void;\n\n /** Disables all resizing interactions. */\n disabled?: boolean;\n\n /** Percentage change per keyboard interaction. Defaults to 1. */\n keyboardStep?: number;\n\n /** Panels and handles that make up the group. */\n children: ReactNode;\n};\n\ntype ResizablePanelProps = ComponentPropsWithRef<\"div\"> & {\n /** Minimum panel size in percentages. Defaults to 0. */\n minSize?: number;\n\n /** Maximum panel size in percentages. Defaults to 100. */\n maxSize?: number;\n};\n\ntype ResizableHandleProps = ComponentPropsWithRef<\"div\"> & {\n /** Renders a visible grip inside the resize handle. */\n withGrip?: boolean;\n\n /** Disables resizing through this handle. */\n disabled?: boolean;\n};\n\ntype ResizePointerHandler = (\n event: ReactPointerEvent<HTMLDivElement>,\n handleIndex: number,\n) => void;\n\ntype ResizeKeyboardHandler = (\n event: ReactKeyboardEvent<HTMLDivElement>,\n handleIndex: number,\n) => void;\n\ntype InternalResizablePanelProps = {\n panelIndex?: number;\n panelSize?: number;\n panelId?: string;\n};\n\ntype InternalResizableHandleProps = {\n handleIndex?: number;\n orientation?: ResizablePanelsOrientation;\n value?: number;\n minValue?: number;\n maxValue?: number;\n panelIds?: [string, string];\n inheritedDisabled?: boolean;\n\n onResizeStart?: ResizePointerHandler;\n onResizeMove?: ResizePointerHandler;\n onResizeEnd?: ResizePointerHandler;\n onResizeKeyDown?: ResizeKeyboardHandler;\n};\n\ntype PointerDragState = {\n handleIndex: number;\n pointerId: number;\n startCoordinate: number;\n availableSize: number;\n direction: number;\n sizes: number[];\n};\n\nconst isResizablePanelElement = (\n child: ReactNode,\n): child is ReactElement<ResizablePanelProps> =>\n isValidElement(child) && child.type === ResizablePanel;\n\nconst isResizableHandleElement = (\n child: ReactNode,\n): child is ReactElement<ResizableHandleProps> =>\n isValidElement(child) && child.type === ResizableHandle;\n\nconst parsePixels = (value: string | undefined) =>\n Number.parseFloat(value ?? \"\") || 0;\n\nconst getAvailableSize = (\n group: HTMLDivElement,\n orientation: ResizablePanelsOrientation,\n) => {\n const computedStyle =\n group.ownerDocument.defaultView?.getComputedStyle(group);\n\n const isHorizontal = orientation === \"horizontal\";\n\n const totalSize = isHorizontal ? group.clientWidth : group.clientHeight;\n\n const paddingSize = computedStyle\n ? isHorizontal\n ? parsePixels(computedStyle.paddingLeft) +\n parsePixels(computedStyle.paddingRight)\n : parsePixels(computedStyle.paddingTop) +\n parsePixels(computedStyle.paddingBottom)\n : 0;\n\n const handleSize = Array.from(group.children).reduce((total, child) => {\n const element = child as HTMLElement;\n\n if (!element.hasAttribute(\"data-puzzle-resizable-handle\")) {\n return total;\n }\n\n const rect = element.getBoundingClientRect();\n\n return total + (isHorizontal ? rect.width : rect.height);\n }, 0);\n\n return Math.max(0, totalSize - paddingSize - handleSize);\n};\n\nconst getResizeDirection = (\n element: HTMLElement,\n orientation: ResizablePanelsOrientation,\n) => {\n if (orientation !== \"horizontal\") {\n return 1;\n }\n\n const direction =\n element.ownerDocument.defaultView?.getComputedStyle(element).direction;\n\n return direction === \"rtl\" ? -1 : 1;\n};\n\nconst getPointerCoordinate = (\n event: ReactPointerEvent<HTMLDivElement>,\n orientation: ResizablePanelsOrientation,\n) => (orientation === \"horizontal\" ? event.clientX : event.clientY);\n\nconst ResizablePanel = ({\n id,\n minSize = 0,\n maxSize = 100,\n panelIndex = 0,\n panelSize = 1,\n panelId,\n className,\n style,\n ...props\n}: ResizablePanelProps & InternalResizablePanelProps) => (\n <div\n {...props}\n id={panelId ?? id}\n className={cn(\"puzzle-resizable-panels__panel\", className)}\n style={{\n ...style,\n flex: `${panelSize} 1 0%`,\n }}\n data-panel-index={panelIndex}\n data-panel-size={panelSize}\n data-panel-min-size={minSize}\n data-panel-max-size={maxSize}\n />\n);\n\nconst ResizableHandle = ({\n withGrip = false,\n disabled = false,\n handleIndex = -1,\n orientation = \"horizontal\",\n value,\n minValue,\n maxValue,\n panelIds,\n inheritedDisabled = false,\n onResizeStart,\n onResizeMove,\n onResizeEnd,\n onResizeKeyDown,\n onPointerDown,\n onPointerMove,\n onPointerUp,\n onPointerCancel,\n onLostPointerCapture,\n onKeyDown,\n className,\n children,\n tabIndex,\n \"aria-label\": ariaLabel,\n ...props\n}: ResizableHandleProps & InternalResizableHandleProps) => {\n const isDisabled = disabled || inheritedDisabled;\n\n const handlePointerDown = (event: ReactPointerEvent<HTMLDivElement>) => {\n onPointerDown?.(event);\n\n if (!event.defaultPrevented && !isDisabled) {\n onResizeStart?.(event, handleIndex);\n }\n };\n\n const handlePointerMove = (event: ReactPointerEvent<HTMLDivElement>) => {\n onPointerMove?.(event);\n\n if (!event.defaultPrevented && !isDisabled) {\n onResizeMove?.(event, handleIndex);\n }\n };\n\n const handlePointerUp = (event: ReactPointerEvent<HTMLDivElement>) => {\n onResizeEnd?.(event, handleIndex);\n onPointerUp?.(event);\n };\n\n const handlePointerCancel = (event: ReactPointerEvent<HTMLDivElement>) => {\n onResizeEnd?.(event, handleIndex);\n onPointerCancel?.(event);\n };\n\n const handleLostPointerCapture = (\n event: ReactPointerEvent<HTMLDivElement>,\n ) => {\n onResizeEnd?.(event, handleIndex);\n onLostPointerCapture?.(event);\n };\n\n const handleKeyDown = (event: ReactKeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n\n if (!event.defaultPrevented && !isDisabled) {\n onResizeKeyDown?.(event, handleIndex);\n }\n };\n\n return (\n <div\n {...props}\n className={cn(\"puzzle-resizable-panels__handle\", className)}\n role=\"separator\"\n tabIndex={isDisabled ? -1 : (tabIndex ?? 0)}\n aria-label={ariaLabel ?? \"Resize panels\"}\n aria-orientation={\n orientation === \"horizontal\" ? \"vertical\" : \"horizontal\"\n }\n aria-controls={panelIds?.join(\" \")}\n aria-valuenow={value}\n aria-valuemin={minValue}\n aria-valuemax={maxValue}\n aria-valuetext={\n value === undefined ? undefined : `${Math.round(value * 100) / 100}%`\n }\n aria-disabled={isDisabled || undefined}\n data-puzzle-resizable-handle=\"\"\n data-orientation={orientation}\n data-disabled={isDisabled ? \"true\" : undefined}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onPointerUp={handlePointerUp}\n onPointerCancel={handlePointerCancel}\n onLostPointerCapture={handleLostPointerCapture}\n onKeyDown={handleKeyDown}\n >\n {withGrip ? (\n <span\n className=\"puzzle-resizable-panels__handle-grip\"\n aria-hidden=\"true\"\n />\n ) : (\n children\n )}\n </div>\n );\n};\n\nconst ResizablePanelsRoot = ({\n children,\n orientation = \"horizontal\",\n sizes,\n defaultSizes,\n onSizesChange,\n disabled = false,\n keyboardStep = 1,\n id,\n role,\n className,\n style,\n ref: forwardedRef,\n ...rootProps\n}: ResizablePanelsProps) => {\n const generatedId = useId();\n\n const groupId = id ?? `puzzle-resizable-panels-${generatedId}`;\n\n if (!Number.isFinite(keyboardStep) || keyboardStep <= 0) {\n throw new RangeError(\"keyboardStep must be a positive finite number.\");\n }\n\n const childrenArray = Children.toArray(children);\n\n const validChildren =\n childrenArray.length >= 3 &&\n childrenArray.length % 2 === 1 &&\n childrenArray.every((child, index) =>\n index % 2 === 0\n ? isResizablePanelElement(child)\n : isResizableHandleElement(child),\n );\n\n if (!validChildren) {\n throw new Error(\n \"ResizablePanels requires alternating Panel and Handle children, starting and ending with a Panel. At least two panels are required.\",\n );\n }\n\n const panelElements = childrenArray.filter(isResizablePanelElement);\n\n const panelCount = panelElements.length;\n\n const panelConstraints: PanelSizeConstraint[] = panelElements.map(\n (panel) => ({\n minSize: panel.props.minSize,\n maxSize: panel.props.maxSize,\n }),\n );\n\n const panelIds = panelElements.map(\n (panel, index) => panel.props.id ?? `${groupId}-panel-${index}`,\n );\n\n if (new Set(panelIds).size !== panelIds.length) {\n throw new Error(\"ResizablePanels requires unique panel IDs.\");\n }\n\n const [uncontrolledSizes, setUncontrolledSizes] = useState<number[]>(() =>\n normalizePanelSizes(\n sizes === undefined ? defaultSizes : undefined,\n panelConstraints,\n ),\n );\n\n const layoutInput =\n sizes ??\n (uncontrolledSizes.length === panelCount ? uncontrolledSizes : undefined);\n\n const currentSizes = normalizePanelSizes(layoutInput, panelConstraints);\n\n const [isResizing, setIsResizing] = useState(false);\n\n const groupRef = useRef<HTMLDivElement | null>(null);\n\n const pointerDragRef = useRef<PointerDragState | null>(null);\n\n const updateSizes = (nextSizes: readonly number[]) => {\n const normalized = normalizePanelSizes(nextSizes, panelConstraints);\n\n const hasChanged = normalized.some(\n (size, index) => Math.abs(size - currentSizes[index]) > 0.000001,\n );\n\n if (!hasChanged) {\n return;\n }\n\n if (sizes === undefined) {\n setUncontrolledSizes(normalized);\n }\n\n onSizesChange?.(normalized);\n };\n\n const handlePointerDown: ResizePointerHandler = (event, handleIndex) => {\n const group = groupRef.current;\n\n if (!group || disabled) {\n return;\n }\n\n if (\n event.button !== 0 &&\n event.pointerType !== \"touch\" &&\n event.pointerType !== \"pen\"\n ) {\n return;\n }\n\n const availableSize = getAvailableSize(group, orientation);\n\n if (availableSize <= 0) {\n return;\n }\n\n pointerDragRef.current = {\n handleIndex,\n pointerId: event.pointerId,\n startCoordinate: getPointerCoordinate(event, orientation),\n availableSize,\n direction: getResizeDirection(group, orientation),\n sizes: [...currentSizes],\n };\n\n try {\n event.currentTarget.setPointerCapture(event.pointerId);\n } catch {\n // Synthetic pointer events and detached elements may not\n // support pointer capture.\n }\n\n event.preventDefault();\n setIsResizing(true);\n };\n\n const handlePointerMove: ResizePointerHandler = (event, handleIndex) => {\n const drag = pointerDragRef.current;\n\n if (\n !drag ||\n drag.pointerId !== event.pointerId ||\n drag.handleIndex !== handleIndex\n ) {\n return;\n }\n\n const currentCoordinate = getPointerCoordinate(event, orientation);\n\n const delta =\n ((currentCoordinate - drag.startCoordinate) / drag.availableSize) *\n 100 *\n drag.direction;\n\n const nextSizes = resizePanelPair(\n drag.sizes,\n panelConstraints,\n handleIndex,\n delta,\n );\n\n event.preventDefault();\n updateSizes(nextSizes);\n };\n\n const handlePointerEnd: ResizePointerHandler = (event, handleIndex) => {\n const drag = pointerDragRef.current;\n\n if (\n !drag ||\n drag.pointerId !== event.pointerId ||\n drag.handleIndex !== handleIndex\n ) {\n return;\n }\n\n pointerDragRef.current = null;\n setIsResizing(false);\n };\n\n const handleKeyDown: ResizeKeyboardHandler = (event, handleIndex) => {\n if (disabled) {\n return;\n }\n\n const currentSize = currentSizes[handleIndex];\n\n const bounds = getPanelPairBounds(\n currentSizes,\n panelConstraints,\n handleIndex,\n );\n\n const group = groupRef.current;\n\n const direction = group ? getResizeDirection(group, orientation) : 1;\n\n const step = keyboardStep * (event.shiftKey ? 10 : 1);\n\n let nextSize: number | undefined;\n\n if (event.key === \"Home\") {\n nextSize = bounds.minSize;\n } else if (event.key === \"End\") {\n nextSize = bounds.maxSize;\n } else if (orientation === \"horizontal\") {\n if (event.key === \"ArrowRight\") {\n nextSize = currentSize + step * direction;\n } else if (event.key === \"ArrowLeft\") {\n nextSize = currentSize - step * direction;\n }\n } else {\n if (event.key === \"ArrowDown\") {\n nextSize = currentSize + step;\n } else if (event.key === \"ArrowUp\") {\n nextSize = currentSize - step;\n }\n }\n\n if (nextSize === undefined) {\n return;\n }\n\n event.preventDefault();\n\n updateSizes(\n resizePanelPair(\n currentSizes,\n panelConstraints,\n handleIndex,\n nextSize - currentSize,\n ),\n );\n };\n\n let panelIndex = 0;\n\n const enhancedChildren = childrenArray.map((child) => {\n if (isResizablePanelElement(child)) {\n const index = panelIndex++;\n\n return cloneElement(\n child as ReactElement<\n ResizablePanelProps & InternalResizablePanelProps\n >,\n {\n panelIndex: index,\n panelSize: currentSizes[index],\n panelId: panelIds[index],\n },\n );\n }\n\n const handleIndex = panelIndex - 1;\n\n const bounds = getPanelPairBounds(\n currentSizes,\n panelConstraints,\n handleIndex,\n );\n\n return cloneElement(\n child as ReactElement<\n ResizableHandleProps & InternalResizableHandleProps\n >,\n {\n handleIndex,\n orientation,\n value: currentSizes[handleIndex],\n minValue: bounds.minSize,\n maxValue: bounds.maxSize,\n panelIds: [panelIds[handleIndex], panelIds[handleIndex + 1]],\n inheritedDisabled: disabled,\n onResizeStart: handlePointerDown,\n onResizeMove: handlePointerMove,\n onResizeEnd: handlePointerEnd,\n onResizeKeyDown: handleKeyDown,\n },\n );\n });\n\n return (\n <div\n {...rootProps}\n ref={(node) => {\n groupRef.current = node;\n\n if (typeof forwardedRef === \"function\") {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n }}\n id={groupId}\n role={role ?? \"group\"}\n className={cn(\"puzzle-resizable-panels\", className)}\n style={style}\n data-orientation={orientation}\n data-disabled={disabled ? \"true\" : undefined}\n data-resizing={isResizing ? \"true\" : undefined}\n >\n {enhancedChildren}\n </div>\n );\n};\n\ntype ResizablePanelsComponent = typeof ResizablePanelsRoot & {\n Panel: typeof ResizablePanel;\n Handle: typeof ResizableHandle;\n};\n\nconst ResizablePanels = Object.assign(ResizablePanelsRoot, {\n Panel: ResizablePanel,\n Handle: ResizableHandle,\n}) as ResizablePanelsComponent;\n\nexport {\n ResizablePanels,\n ResizablePanel,\n ResizableHandle,\n type ResizablePanelsProps,\n type ResizablePanelProps,\n type ResizableHandleProps,\n type ResizablePanelsOrientation,\n};\n"],"mappings":";;;;;;;AA4GA,MAAM,2BACJ,WAAA,GAEAA,MAAAA,eAAAA,CAAe,KAAK,KAAK,MAAM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EAEA,QAAA,GAAOC,MAAAA,aAAAA,CACL,OAGA;GACE;GACA;GACA,OAAO,aAAa;GACpB,UAAU,OAAO;GACjB,UAAU,OAAO;GACjB,UAAU,CAAC,SAAS,cAAc,SAAS,cAAc,EAAE;GAC3D,mBAAmB;GACnB,eAAe;GACf,cAAc;GACd,aAAa;GACb,iBAAiB;EACnB,CACF;CACF,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACJ,MAAM,SAAS;GACb,SAAS,UAAU;GAEnB,IAAI,OAAO,iBAAiB,YAC1B,aAAa,IAAI;QACZ,IAAI,cACT,aAAa,UAAU;EAE3B;EACA,IAAI;EACJ,MAAM,QAAQ;EACd,YAAA,GAAWR,gBAAAA,GAAAA,CAAG,2BAA2B,SAAS;EAC3C;EACP,oBAAkB;EAClB,iBAAe,WAAW,SAAS,KAAA;EACnC,iBAAe,aAAa,SAAS,KAAA;EAEpC,UAAA;CACE,CAAA;AAET;AAOA,MAAM,kBAAkB,OAAO,OAAO,qBAAqB;CACzD,OAAO;CACP,QAAQ;AACV,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { ComponentPropsWithRef, KeyboardEvent, PointerEvent, ReactNode } from "react";
2
+ type ResizablePanelsOrientation = "horizontal" | "vertical";
3
+ type ResizablePanelsProps = Omit<ComponentPropsWithRef<"div">, "children"> & {
4
+ /** Layout direction. Defaults to horizontal. */
5
+ orientation?: ResizablePanelsOrientation;
6
+ /** Controlled panel sizes, expressed as percentages. */
7
+ sizes?: readonly number[];
8
+ /** Initial panel sizes for uncontrolled usage. */
9
+ defaultSizes?: readonly number[];
10
+ /** Called whenever the panel layout changes. */
11
+ onSizesChange?: (sizes: number[]) => void;
12
+ /** Disables all resizing interactions. */
13
+ disabled?: boolean;
14
+ /** Percentage change per keyboard interaction. Defaults to 1. */
15
+ keyboardStep?: number;
16
+ /** Panels and handles that make up the group. */
17
+ children: ReactNode;
18
+ };
19
+ type ResizablePanelProps = ComponentPropsWithRef<"div"> & {
20
+ /** Minimum panel size in percentages. Defaults to 0. */
21
+ minSize?: number;
22
+ /** Maximum panel size in percentages. Defaults to 100. */
23
+ maxSize?: number;
24
+ };
25
+ type ResizableHandleProps = ComponentPropsWithRef<"div"> & {
26
+ /** Renders a visible grip inside the resize handle. */
27
+ withGrip?: boolean;
28
+ /** Disables resizing through this handle. */
29
+ disabled?: boolean;
30
+ };
31
+ type ResizePointerHandler = (event: PointerEvent<HTMLDivElement>, handleIndex: number) => void;
32
+ type ResizeKeyboardHandler = (event: KeyboardEvent<HTMLDivElement>, handleIndex: number) => void;
33
+ type InternalResizablePanelProps = {
34
+ panelIndex?: number;
35
+ panelSize?: number;
36
+ panelId?: string;
37
+ };
38
+ type InternalResizableHandleProps = {
39
+ handleIndex?: number;
40
+ orientation?: ResizablePanelsOrientation;
41
+ value?: number;
42
+ minValue?: number;
43
+ maxValue?: number;
44
+ panelIds?: [string, string];
45
+ inheritedDisabled?: boolean;
46
+ onResizeStart?: ResizePointerHandler;
47
+ onResizeMove?: ResizePointerHandler;
48
+ onResizeEnd?: ResizePointerHandler;
49
+ onResizeKeyDown?: ResizeKeyboardHandler;
50
+ };
51
+ declare const ResizablePanel: ({ id, minSize, maxSize, panelIndex, panelSize, panelId, className, style, ...props }: ResizablePanelProps & InternalResizablePanelProps) => import("react").JSX.Element;
52
+ declare const ResizableHandle: ({ withGrip, disabled, handleIndex, orientation, value, minValue, maxValue, panelIds, inheritedDisabled, onResizeStart, onResizeMove, onResizeEnd, onResizeKeyDown, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onLostPointerCapture, onKeyDown, className, children, tabIndex, "aria-label": ariaLabel, ...props }: ResizableHandleProps & InternalResizableHandleProps) => import("react").JSX.Element;
53
+ declare const ResizablePanelsRoot: ({ children, orientation, sizes, defaultSizes, onSizesChange, disabled, keyboardStep, id, role, className, style, ref: forwardedRef, ...rootProps }: ResizablePanelsProps) => import("react").JSX.Element;
54
+ type ResizablePanelsComponent = typeof ResizablePanelsRoot & {
55
+ Panel: typeof ResizablePanel;
56
+ Handle: typeof ResizableHandle;
57
+ };
58
+ declare const ResizablePanels: ResizablePanelsComponent;
59
+ export { ResizableHandle, type ResizableHandleProps, ResizablePanel, type ResizablePanelProps, ResizablePanels, type ResizablePanelsOrientation, type ResizablePanelsProps };
@@ -0,0 +1,59 @@
1
+ import { ComponentPropsWithRef, KeyboardEvent, PointerEvent, ReactNode } from "react";
2
+ type ResizablePanelsOrientation = "horizontal" | "vertical";
3
+ type ResizablePanelsProps = Omit<ComponentPropsWithRef<"div">, "children"> & {
4
+ /** Layout direction. Defaults to horizontal. */
5
+ orientation?: ResizablePanelsOrientation;
6
+ /** Controlled panel sizes, expressed as percentages. */
7
+ sizes?: readonly number[];
8
+ /** Initial panel sizes for uncontrolled usage. */
9
+ defaultSizes?: readonly number[];
10
+ /** Called whenever the panel layout changes. */
11
+ onSizesChange?: (sizes: number[]) => void;
12
+ /** Disables all resizing interactions. */
13
+ disabled?: boolean;
14
+ /** Percentage change per keyboard interaction. Defaults to 1. */
15
+ keyboardStep?: number;
16
+ /** Panels and handles that make up the group. */
17
+ children: ReactNode;
18
+ };
19
+ type ResizablePanelProps = ComponentPropsWithRef<"div"> & {
20
+ /** Minimum panel size in percentages. Defaults to 0. */
21
+ minSize?: number;
22
+ /** Maximum panel size in percentages. Defaults to 100. */
23
+ maxSize?: number;
24
+ };
25
+ type ResizableHandleProps = ComponentPropsWithRef<"div"> & {
26
+ /** Renders a visible grip inside the resize handle. */
27
+ withGrip?: boolean;
28
+ /** Disables resizing through this handle. */
29
+ disabled?: boolean;
30
+ };
31
+ type ResizePointerHandler = (event: PointerEvent<HTMLDivElement>, handleIndex: number) => void;
32
+ type ResizeKeyboardHandler = (event: KeyboardEvent<HTMLDivElement>, handleIndex: number) => void;
33
+ type InternalResizablePanelProps = {
34
+ panelIndex?: number;
35
+ panelSize?: number;
36
+ panelId?: string;
37
+ };
38
+ type InternalResizableHandleProps = {
39
+ handleIndex?: number;
40
+ orientation?: ResizablePanelsOrientation;
41
+ value?: number;
42
+ minValue?: number;
43
+ maxValue?: number;
44
+ panelIds?: [string, string];
45
+ inheritedDisabled?: boolean;
46
+ onResizeStart?: ResizePointerHandler;
47
+ onResizeMove?: ResizePointerHandler;
48
+ onResizeEnd?: ResizePointerHandler;
49
+ onResizeKeyDown?: ResizeKeyboardHandler;
50
+ };
51
+ declare const ResizablePanel: ({ id, minSize, maxSize, panelIndex, panelSize, panelId, className, style, ...props }: ResizablePanelProps & InternalResizablePanelProps) => import("react").JSX.Element;
52
+ declare const ResizableHandle: ({ withGrip, disabled, handleIndex, orientation, value, minValue, maxValue, panelIds, inheritedDisabled, onResizeStart, onResizeMove, onResizeEnd, onResizeKeyDown, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onLostPointerCapture, onKeyDown, className, children, tabIndex, "aria-label": ariaLabel, ...props }: ResizableHandleProps & InternalResizableHandleProps) => import("react").JSX.Element;
53
+ declare const ResizablePanelsRoot: ({ children, orientation, sizes, defaultSizes, onSizesChange, disabled, keyboardStep, id, role, className, style, ref: forwardedRef, ...rootProps }: ResizablePanelsProps) => import("react").JSX.Element;
54
+ type ResizablePanelsComponent = typeof ResizablePanelsRoot & {
55
+ Panel: typeof ResizablePanel;
56
+ Handle: typeof ResizableHandle;
57
+ };
58
+ declare const ResizablePanels: ResizablePanelsComponent;
59
+ export { ResizableHandle, type ResizableHandleProps, ResizablePanel, type ResizablePanelProps, ResizablePanels, type ResizablePanelsOrientation, type ResizablePanelsProps };