panelui-web 0.10.0 → 0.11.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/dist/components/alert/index.d.ts +15 -8
- package/dist/components/alert/index.js +65 -18
- package/dist/components/alert-dialog/index.d.ts +9 -3
- package/dist/components/alert-dialog/index.js +23 -7
- package/dist/components/avatar/index.d.ts +9 -3
- package/dist/components/avatar/index.js +34 -10
- package/dist/components/badge/index.d.ts +57 -0
- package/dist/components/badge/index.js +61 -0
- package/dist/components/bar-picker/index.d.ts +8 -1
- package/dist/components/bar-picker/index.js +35 -26
- package/dist/components/button/index.d.ts +68 -46
- package/dist/components/button/index.js +38 -2
- package/dist/components/button-group/index.d.ts +11 -5
- package/dist/components/button-group/index.js +31 -7
- package/dist/components/canvas/index.d.ts +9 -3
- package/dist/components/canvas/index.js +53 -25
- package/dist/components/card/index.d.ts +13 -7
- package/dist/components/card/index.js +45 -17
- package/dist/components/checkbox/index.d.ts +73 -0
- package/dist/components/checkbox/index.js +100 -0
- package/dist/components/chip/index.d.ts +79 -0
- package/dist/components/chip/index.js +112 -0
- package/dist/components/choice-cards/index.d.ts +11 -5
- package/dist/components/choice-cards/index.js +25 -6
- package/dist/components/command-dock/index.d.ts +16 -9
- package/dist/components/command-dock/index.js +76 -19
- package/dist/components/day-grid/index.d.ts +12 -6
- package/dist/components/day-grid/index.js +71 -27
- package/dist/components/dialog/index.d.ts +19 -12
- package/dist/components/dialog/index.js +84 -25
- package/dist/components/feedback/index.d.ts +20 -13
- package/dist/components/feedback/index.js +83 -27
- package/dist/components/field/index.d.ts +85 -0
- package/dist/components/field/index.js +90 -0
- package/dist/components/flow/index.d.ts +21 -14
- package/dist/components/flow/index.js +56 -20
- package/dist/components/frame/index.d.ts +17 -11
- package/dist/components/frame/index.js +73 -22
- package/dist/components/input/index.d.ts +9 -24
- package/dist/components/input/index.js +53 -6
- package/dist/components/inspector/index.d.ts +69 -63
- package/dist/components/inspector/index.js +31 -9
- package/dist/components/kpi/index.d.ts +20 -14
- package/dist/components/kpi/index.js +111 -36
- package/dist/components/label/index.d.ts +10 -4
- package/dist/components/label/index.js +39 -9
- package/dist/components/lane-board/index.d.ts +15 -9
- package/dist/components/lane-board/index.js +97 -57
- package/dist/components/menu/index.d.ts +10 -4
- package/dist/components/menu/index.js +28 -10
- package/dist/components/message/index.d.ts +15 -9
- package/dist/components/message/index.js +71 -19
- package/dist/components/not-found/index.d.ts +10 -4
- package/dist/components/not-found/index.js +48 -12
- package/dist/components/planet/index.d.ts +11 -5
- package/dist/components/planet/index.js +73 -20
- package/dist/components/prompt/index.d.ts +30 -23
- package/dist/components/prompt/index.js +148 -52
- package/dist/components/radio-group/index.d.ts +124 -0
- package/dist/components/radio-group/index.js +216 -0
- package/dist/components/range-meter/index.d.ts +9 -3
- package/dist/components/range-meter/index.js +61 -27
- package/dist/components/rolling-number/index.d.ts +8 -1
- package/dist/components/rolling-number/index.js +15 -6
- package/dist/components/select/index.d.ts +7 -1
- package/dist/components/select/index.js +13 -4
- package/dist/components/sheet/index.d.ts +8 -2
- package/dist/components/sheet/index.js +27 -15
- package/dist/components/slider/index.d.ts +11 -4
- package/dist/components/slider/index.js +30 -10
- package/dist/components/soundwave/index.d.ts +8 -2
- package/dist/components/soundwave/index.js +26 -6
- package/dist/components/stat/index.d.ts +13 -7
- package/dist/components/stat/index.js +45 -15
- package/dist/components/table/index.d.ts +128 -0
- package/dist/components/table/index.js +145 -0
- package/dist/components/tabs/index.d.ts +7 -1
- package/dist/components/tabs/index.js +8 -2
- package/dist/components/textarea/index.d.ts +0 -23
- package/dist/components/textarea/index.js +22 -5
- package/dist/components/tilt-card/index.d.ts +9 -3
- package/dist/components/tilt-card/index.js +28 -8
- package/dist/components/timeline/index.d.ts +20 -13
- package/dist/components/timeline/index.js +166 -59
- package/dist/components/toast/dither-text.d.ts +13 -0
- package/dist/components/toast/dither-text.js +143 -0
- package/dist/components/toast/dither.d.ts +29 -0
- package/dist/components/toast/dither.js +153 -0
- package/dist/components/toast/index.d.ts +108 -0
- package/dist/components/toast/index.js +225 -0
- package/dist/components/toolbar/index.d.ts +9 -3
- package/dist/components/toolbar/index.js +23 -6
- package/dist/components/workbench/index.d.ts +50 -43
- package/dist/components/workbench/index.js +77 -20
- package/dist/components/xy-pad/index.d.ts +9 -3
- package/dist/components/xy-pad/index.js +13 -2
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/package.json +1 -1
|
@@ -34,34 +34,41 @@
|
|
|
34
34
|
* counts is the workbench's own, not the window's, so it works in a pane.
|
|
35
35
|
*/
|
|
36
36
|
import { type ComponentProps, type ReactNode } from 'react';
|
|
37
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
38
|
+
import type * as ReactTypes from 'react';
|
|
39
|
+
import type { ElementType as RenderElementType } from 'react';
|
|
40
|
+
/** Draws a part as another element, or composes it with a component: `render={<a href="/" />}`. */
|
|
41
|
+
type RenderProp<Tag extends RenderElementType> = {
|
|
42
|
+
render?: useRender.ComponentProps<Tag>['render'];
|
|
43
|
+
};
|
|
37
44
|
declare const workbenchVariants: import("tailwind-variants").TVReturnType<{
|
|
38
45
|
[key: string]: {
|
|
39
|
-
[key: string]: import("tailwind-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
bar?: import("tailwind-
|
|
43
|
-
resize?: import("tailwind-
|
|
44
|
-
trigger?: import("tailwind-
|
|
45
|
-
inspector?: import("tailwind-
|
|
46
|
-
timeline?: import("tailwind-
|
|
47
|
-
sidebar?: import("tailwind-
|
|
48
|
-
artboard?: import("tailwind-
|
|
49
|
-
sheetBody?: import("tailwind-
|
|
46
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
47
|
+
canvas?: import("tailwind-variants").ClassValue;
|
|
48
|
+
root?: import("tailwind-variants").ClassValue;
|
|
49
|
+
bar?: import("tailwind-variants").ClassValue;
|
|
50
|
+
resize?: import("tailwind-variants").ClassValue;
|
|
51
|
+
trigger?: import("tailwind-variants").ClassValue;
|
|
52
|
+
inspector?: import("tailwind-variants").ClassValue;
|
|
53
|
+
timeline?: import("tailwind-variants").ClassValue;
|
|
54
|
+
sidebar?: import("tailwind-variants").ClassValue;
|
|
55
|
+
artboard?: import("tailwind-variants").ClassValue;
|
|
56
|
+
sheetBody?: import("tailwind-variants").ClassValue;
|
|
50
57
|
};
|
|
51
58
|
};
|
|
52
59
|
} | {
|
|
53
60
|
[x: string]: {
|
|
54
|
-
[x: string]: import("tailwind-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
bar?: import("tailwind-
|
|
58
|
-
resize?: import("tailwind-
|
|
59
|
-
trigger?: import("tailwind-
|
|
60
|
-
inspector?: import("tailwind-
|
|
61
|
-
timeline?: import("tailwind-
|
|
62
|
-
sidebar?: import("tailwind-
|
|
63
|
-
artboard?: import("tailwind-
|
|
64
|
-
sheetBody?: import("tailwind-
|
|
61
|
+
[x: string]: import("tailwind-variants").ClassValue | {
|
|
62
|
+
canvas?: import("tailwind-variants").ClassValue;
|
|
63
|
+
root?: import("tailwind-variants").ClassValue;
|
|
64
|
+
bar?: import("tailwind-variants").ClassValue;
|
|
65
|
+
resize?: import("tailwind-variants").ClassValue;
|
|
66
|
+
trigger?: import("tailwind-variants").ClassValue;
|
|
67
|
+
inspector?: import("tailwind-variants").ClassValue;
|
|
68
|
+
timeline?: import("tailwind-variants").ClassValue;
|
|
69
|
+
sidebar?: import("tailwind-variants").ClassValue;
|
|
70
|
+
artboard?: import("tailwind-variants").ClassValue;
|
|
71
|
+
sheetBody?: import("tailwind-variants").ClassValue;
|
|
65
72
|
};
|
|
66
73
|
};
|
|
67
74
|
} | {}, {
|
|
@@ -77,17 +84,17 @@ declare const workbenchVariants: import("tailwind-variants").TVReturnType<{
|
|
|
77
84
|
sheetBody: string[];
|
|
78
85
|
}, undefined, {
|
|
79
86
|
[key: string]: {
|
|
80
|
-
[key: string]: import("tailwind-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
bar?: import("tailwind-
|
|
84
|
-
resize?: import("tailwind-
|
|
85
|
-
trigger?: import("tailwind-
|
|
86
|
-
inspector?: import("tailwind-
|
|
87
|
-
timeline?: import("tailwind-
|
|
88
|
-
sidebar?: import("tailwind-
|
|
89
|
-
artboard?: import("tailwind-
|
|
90
|
-
sheetBody?: import("tailwind-
|
|
87
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
88
|
+
canvas?: import("tailwind-variants").ClassValue;
|
|
89
|
+
root?: import("tailwind-variants").ClassValue;
|
|
90
|
+
bar?: import("tailwind-variants").ClassValue;
|
|
91
|
+
resize?: import("tailwind-variants").ClassValue;
|
|
92
|
+
trigger?: import("tailwind-variants").ClassValue;
|
|
93
|
+
inspector?: import("tailwind-variants").ClassValue;
|
|
94
|
+
timeline?: import("tailwind-variants").ClassValue;
|
|
95
|
+
sidebar?: import("tailwind-variants").ClassValue;
|
|
96
|
+
artboard?: import("tailwind-variants").ClassValue;
|
|
97
|
+
sheetBody?: import("tailwind-variants").ClassValue;
|
|
91
98
|
};
|
|
92
99
|
};
|
|
93
100
|
} | {}, {
|
|
@@ -101,7 +108,7 @@ declare const workbenchVariants: import("tailwind-variants").TVReturnType<{
|
|
|
101
108
|
resize: string[];
|
|
102
109
|
trigger: string[];
|
|
103
110
|
sheetBody: string[];
|
|
104
|
-
}, import("tailwind-variants").
|
|
111
|
+
}, import("tailwind-variants").TVReturnTypeLike<unknown, {
|
|
105
112
|
root: string[];
|
|
106
113
|
sidebar: string[];
|
|
107
114
|
canvas: string[];
|
|
@@ -112,7 +119,7 @@ declare const workbenchVariants: import("tailwind-variants").TVReturnType<{
|
|
|
112
119
|
resize: string[];
|
|
113
120
|
trigger: string[];
|
|
114
121
|
sheetBody: string[];
|
|
115
|
-
}
|
|
122
|
+
}>>;
|
|
116
123
|
/**
|
|
117
124
|
* The workbench's state, for controls of your own: a focus button in the
|
|
118
125
|
* toolbar, a button that opens the inspector on a narrow screen.
|
|
@@ -143,28 +150,28 @@ export interface WorkbenchProps extends ComponentProps<'div'> {
|
|
|
143
150
|
defaultTimelineHeight?: number;
|
|
144
151
|
}
|
|
145
152
|
/** The editor's frame. Give it a height, such as `h-[640px]` or `h-dvh`. */
|
|
146
|
-
declare function WorkbenchRoot({ focus: focusProp, defaultFocus, onFocusChange, focusShortcut, compactBelow, inspectorWidth, sidebarWidth, defaultTimelineHeight, className, style, children, ...props }: WorkbenchProps):
|
|
153
|
+
declare function WorkbenchRoot({ focus: focusProp, defaultFocus, onFocusChange, focusShortcut, compactBelow, inspectorWidth, sidebarWidth, defaultTimelineHeight, className, style, children, ...props }: WorkbenchProps): ReactTypes.JSX.Element;
|
|
147
154
|
declare namespace WorkbenchRoot {
|
|
148
155
|
var displayName: string;
|
|
149
156
|
}
|
|
150
157
|
export interface WorkbenchBarProps extends ComponentProps<'div'> {
|
|
151
158
|
}
|
|
152
159
|
/** The strip floating at the top of the canvas, for a toolbar. */
|
|
153
|
-
declare function WorkbenchBar({ className, ...props }: WorkbenchBarProps):
|
|
160
|
+
declare function WorkbenchBar({ className, render, ...props }: WorkbenchBarProps & RenderProp<'div'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
154
161
|
declare namespace WorkbenchBar {
|
|
155
162
|
var displayName: string;
|
|
156
163
|
}
|
|
157
164
|
export interface WorkbenchSidebarProps extends ComponentProps<'aside'> {
|
|
158
165
|
}
|
|
159
166
|
/** A column before the canvas, for layers, pages or assets. It is hidden on a narrow screen and in focus. */
|
|
160
|
-
declare function WorkbenchSidebar({ className, ...props }: WorkbenchSidebarProps):
|
|
167
|
+
declare function WorkbenchSidebar({ className, render, ...props }: WorkbenchSidebarProps & RenderProp<'aside'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
161
168
|
declare namespace WorkbenchSidebar {
|
|
162
169
|
var displayName: string;
|
|
163
170
|
}
|
|
164
171
|
export interface WorkbenchCanvasProps extends ComponentProps<'div'> {
|
|
165
172
|
}
|
|
166
173
|
/** The stage in the middle: a field of dots with the work centred on it. */
|
|
167
|
-
declare function WorkbenchCanvas({ className, ...props }: WorkbenchCanvasProps):
|
|
174
|
+
declare function WorkbenchCanvas({ className, render, ...props }: WorkbenchCanvasProps & RenderProp<'div'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
168
175
|
declare namespace WorkbenchCanvas {
|
|
169
176
|
var displayName: string;
|
|
170
177
|
}
|
|
@@ -173,7 +180,7 @@ export interface WorkbenchArtboardProps extends ComponentProps<'div'> {
|
|
|
173
180
|
aspect?: string;
|
|
174
181
|
}
|
|
175
182
|
/** The work itself: as large as its shape fits on the canvas, clear of the floating bar. */
|
|
176
|
-
declare function WorkbenchArtboard({ aspect, className, style, ...props }: WorkbenchArtboardProps):
|
|
183
|
+
declare function WorkbenchArtboard({ aspect, className, style, render, ...props }: WorkbenchArtboardProps & RenderProp<'div'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
177
184
|
declare namespace WorkbenchArtboard {
|
|
178
185
|
var displayName: string;
|
|
179
186
|
}
|
|
@@ -186,7 +193,7 @@ export interface WorkbenchInspectorProps extends ComponentProps<'div'> {
|
|
|
186
193
|
* The column after the canvas, for an `Inspector`. On a narrow screen the
|
|
187
194
|
* same children open in a sheet from the side instead.
|
|
188
195
|
*/
|
|
189
|
-
declare function WorkbenchInspector({ title, className, children, ...props }: WorkbenchInspectorProps):
|
|
196
|
+
declare function WorkbenchInspector({ title, className, children, render, ...props }: WorkbenchInspectorProps & RenderProp<'div'>): ReactTypes.JSX.Element;
|
|
190
197
|
declare namespace WorkbenchInspector {
|
|
191
198
|
var displayName: string;
|
|
192
199
|
}
|
|
@@ -197,7 +204,7 @@ export interface WorkbenchInspectorTriggerProps extends ComponentProps<'button'>
|
|
|
197
204
|
* only there when the inspector is a sheet, so put it where it belongs on
|
|
198
205
|
* either size: in the bar, beside the tools.
|
|
199
206
|
*/
|
|
200
|
-
declare function WorkbenchInspectorTrigger({ className, children, onClick, ...props }: WorkbenchInspectorTriggerProps):
|
|
207
|
+
declare function WorkbenchInspectorTrigger({ className, children, onClick, render, ...props }: WorkbenchInspectorTriggerProps & RenderProp<'button'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>> | null;
|
|
201
208
|
declare namespace WorkbenchInspectorTrigger {
|
|
202
209
|
var displayName: string;
|
|
203
210
|
}
|
|
@@ -208,7 +215,7 @@ export interface WorkbenchTimelineProps extends ComponentProps<'div'> {
|
|
|
208
215
|
minHeight?: number;
|
|
209
216
|
}
|
|
210
217
|
/** The row under everything, for a `Timeline`. Its top edge drags to resize it. */
|
|
211
|
-
declare function WorkbenchTimeline({ resizable, minHeight, className, children, ...props }: WorkbenchTimelineProps):
|
|
218
|
+
declare function WorkbenchTimeline({ resizable, minHeight, className, children, render, ...props }: WorkbenchTimelineProps & RenderProp<'div'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
212
219
|
declare namespace WorkbenchTimeline {
|
|
213
220
|
var displayName: string;
|
|
214
221
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
/**
|
|
4
4
|
* Workbench — the frame of an editor: a canvas with the work on it, a
|
|
5
5
|
* toolbar floating over it, an inspector beside it and a timeline under it.
|
|
@@ -38,6 +38,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
38
38
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
39
39
|
import { tv } from 'tailwind-variants';
|
|
40
40
|
import { Sheet } from '../sheet/index.js';
|
|
41
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
42
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
41
43
|
const EASE = 'ease-[cubic-bezier(0.32,0.72,0,1)]';
|
|
42
44
|
const workbenchVariants = tv({
|
|
43
45
|
slots: {
|
|
@@ -153,7 +155,8 @@ function WorkbenchRoot({ focus: focusProp, defaultFocus = false, onFocusChange,
|
|
|
153
155
|
if (event.key !== '\\' || event.metaKey || event.ctrlKey || event.altKey || event.defaultPrevented)
|
|
154
156
|
return;
|
|
155
157
|
const target = event.target;
|
|
156
|
-
if (target instanceof Element &&
|
|
158
|
+
if (target instanceof Element &&
|
|
159
|
+
target.closest('input, textarea, select, [contenteditable=""], [contenteditable="true"]')) {
|
|
157
160
|
return;
|
|
158
161
|
}
|
|
159
162
|
event.preventDefault();
|
|
@@ -196,46 +199,79 @@ function usePresence(register) {
|
|
|
196
199
|
}, []);
|
|
197
200
|
}
|
|
198
201
|
/** The strip floating at the top of the canvas, for a toolbar. */
|
|
199
|
-
function WorkbenchBar({ className, ...props }) {
|
|
202
|
+
function WorkbenchBar({ className, render, ...props }) {
|
|
200
203
|
useWorkbenchContext('Workbench.Bar');
|
|
201
204
|
const slots = workbenchVariants();
|
|
202
|
-
return
|
|
205
|
+
return useRender({
|
|
206
|
+
defaultTagName: 'div',
|
|
207
|
+
render,
|
|
208
|
+
props: mergeProps({ 'data-slot': 'workbench-bar', className: slots.bar({ className }) }, props),
|
|
209
|
+
});
|
|
203
210
|
}
|
|
204
211
|
WorkbenchBar.displayName = 'Workbench.Bar';
|
|
205
212
|
/** A column before the canvas, for layers, pages or assets. It is hidden on a narrow screen and in focus. */
|
|
206
|
-
function WorkbenchSidebar({ className, ...props }) {
|
|
213
|
+
function WorkbenchSidebar({ className, render, ...props }) {
|
|
207
214
|
const workbench = useWorkbenchContext('Workbench.Sidebar');
|
|
208
215
|
usePresence(workbench.hasSidebar);
|
|
209
216
|
const slots = workbenchVariants();
|
|
210
|
-
return (
|
|
217
|
+
return useRender({
|
|
218
|
+
defaultTagName: 'aside',
|
|
219
|
+
render,
|
|
220
|
+
props: mergeProps({
|
|
221
|
+
'data-slot': 'workbench-sidebar',
|
|
222
|
+
inert: workbench.focus || workbench.compact || undefined,
|
|
223
|
+
className: slots.sidebar({ className }),
|
|
224
|
+
}, props),
|
|
225
|
+
});
|
|
211
226
|
}
|
|
212
227
|
WorkbenchSidebar.displayName = 'Workbench.Sidebar';
|
|
213
228
|
/** The stage in the middle: a field of dots with the work centred on it. */
|
|
214
|
-
function WorkbenchCanvas({ className, ...props }) {
|
|
229
|
+
function WorkbenchCanvas({ className, render, ...props }) {
|
|
215
230
|
useWorkbenchContext('Workbench.Canvas');
|
|
216
231
|
const slots = workbenchVariants();
|
|
217
|
-
return
|
|
232
|
+
return useRender({
|
|
233
|
+
defaultTagName: 'div',
|
|
234
|
+
render,
|
|
235
|
+
props: mergeProps({ 'data-slot': 'workbench-canvas', className: slots.canvas({ className }) }, props),
|
|
236
|
+
});
|
|
218
237
|
}
|
|
219
238
|
WorkbenchCanvas.displayName = 'Workbench.Canvas';
|
|
220
239
|
/** The work itself: as large as its shape fits on the canvas, clear of the floating bar. */
|
|
221
|
-
function WorkbenchArtboard({ aspect = '16 / 9', className, style, ...props }) {
|
|
240
|
+
function WorkbenchArtboard({ aspect = '16 / 9', className, style, render, ...props }) {
|
|
222
241
|
const slots = workbenchVariants();
|
|
223
242
|
const [wide, tall] = aspect.split('/').map((part) => Number(part.trim()) || 1);
|
|
224
|
-
return (
|
|
243
|
+
return useRender({
|
|
244
|
+
defaultTagName: 'div',
|
|
245
|
+
render,
|
|
246
|
+
props: mergeProps({
|
|
247
|
+
'data-slot': 'workbench-artboard',
|
|
248
|
+
className: slots.artboard({ className }),
|
|
249
|
+
style: { ...style, '--wb-aspect': aspect, '--wb-ratio': (wide ?? 1) / (tall ?? 1) },
|
|
250
|
+
}, props),
|
|
251
|
+
});
|
|
225
252
|
}
|
|
226
253
|
WorkbenchArtboard.displayName = 'Workbench.Artboard';
|
|
227
254
|
/**
|
|
228
255
|
* The column after the canvas, for an `Inspector`. On a narrow screen the
|
|
229
256
|
* same children open in a sheet from the side instead.
|
|
230
257
|
*/
|
|
231
|
-
function WorkbenchInspector({ title = 'Inspector', className, children, ...props }) {
|
|
258
|
+
function WorkbenchInspector({ title = 'Inspector', className, children, render, ...props }) {
|
|
232
259
|
const workbench = useWorkbenchContext('Workbench.Inspector');
|
|
233
260
|
usePresence(workbench.hasInspector);
|
|
234
261
|
const slots = workbenchVariants();
|
|
235
262
|
if (workbench.compact) {
|
|
236
263
|
return (_jsx(Sheet, { side: "right", open: workbench.inspectorOpen, onOpenChange: workbench.setInspectorOpen, children: _jsxs(Sheet.Content, { size: "full", children: [_jsx(Sheet.Header, { title: title }), _jsx("div", { "data-slot": "workbench-inspector", className: slots.sheetBody(), children: children })] }) }));
|
|
237
264
|
}
|
|
238
|
-
return (
|
|
265
|
+
return useRender({
|
|
266
|
+
defaultTagName: 'div',
|
|
267
|
+
render,
|
|
268
|
+
props: mergeProps({
|
|
269
|
+
'data-slot': 'workbench-inspector',
|
|
270
|
+
inert: workbench.focus || undefined,
|
|
271
|
+
className: slots.inspector({ className }),
|
|
272
|
+
children: _jsx(_Fragment, { children: children }),
|
|
273
|
+
}, props),
|
|
274
|
+
});
|
|
239
275
|
}
|
|
240
276
|
WorkbenchInspector.displayName = 'Workbench.Inspector';
|
|
241
277
|
/**
|
|
@@ -243,20 +279,32 @@ WorkbenchInspector.displayName = 'Workbench.Inspector';
|
|
|
243
279
|
* only there when the inspector is a sheet, so put it where it belongs on
|
|
244
280
|
* either size: in the bar, beside the tools.
|
|
245
281
|
*/
|
|
246
|
-
function WorkbenchInspectorTrigger({ className, children, onClick, ...props }) {
|
|
282
|
+
function WorkbenchInspectorTrigger({ className, children, onClick, render, ...props }) {
|
|
247
283
|
const workbench = useWorkbenchContext('Workbench.InspectorTrigger');
|
|
248
284
|
const slots = workbenchVariants();
|
|
249
285
|
if (!workbench.compact)
|
|
250
286
|
return null;
|
|
251
|
-
return (
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
287
|
+
return useRender({
|
|
288
|
+
defaultTagName: 'button',
|
|
289
|
+
render,
|
|
290
|
+
props: mergeProps({
|
|
291
|
+
type: 'button',
|
|
292
|
+
'data-slot': 'workbench-inspector-trigger',
|
|
293
|
+
'aria-label': 'Open inspector',
|
|
294
|
+
'aria-expanded': workbench.inspectorOpen,
|
|
295
|
+
className: slots.trigger({ className }),
|
|
296
|
+
onClick: (event) => {
|
|
297
|
+
onClick?.(event);
|
|
298
|
+
if (!event.defaultPrevented)
|
|
299
|
+
workbench.setInspectorOpen(true);
|
|
300
|
+
},
|
|
301
|
+
children: (_jsx(_Fragment, { children: children ?? (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [_jsx("path", { d: "M4 6h10M18 6h2M4 12h4M12 12h8M4 18h12M20 18h0" }), _jsx("circle", { cx: "16", cy: "6", r: "2" }), _jsx("circle", { cx: "10", cy: "12", r: "2" }), _jsx("circle", { cx: "18", cy: "18", r: "2" })] })) })),
|
|
302
|
+
}, props),
|
|
303
|
+
});
|
|
256
304
|
}
|
|
257
305
|
WorkbenchInspectorTrigger.displayName = 'Workbench.InspectorTrigger';
|
|
258
306
|
/** The row under everything, for a `Timeline`. Its top edge drags to resize it. */
|
|
259
|
-
function WorkbenchTimeline({ resizable = true, minHeight = 140, className, children, ...props }) {
|
|
307
|
+
function WorkbenchTimeline({ resizable = true, minHeight = 140, className, children, render, ...props }) {
|
|
260
308
|
const workbench = useWorkbenchContext('Workbench.Timeline');
|
|
261
309
|
usePresence(workbench.hasTimeline);
|
|
262
310
|
const slots = workbenchVariants();
|
|
@@ -291,7 +339,16 @@ function WorkbenchTimeline({ resizable = true, minHeight = 140, className, child
|
|
|
291
339
|
event.preventDefault();
|
|
292
340
|
workbench.setTimelineHeight(Math.min(Math.max(workbench.timelineHeight + by, minHeight), maxHeight()));
|
|
293
341
|
};
|
|
294
|
-
return (
|
|
342
|
+
return useRender({
|
|
343
|
+
defaultTagName: 'div',
|
|
344
|
+
render,
|
|
345
|
+
props: mergeProps({
|
|
346
|
+
'data-slot': 'workbench-timeline',
|
|
347
|
+
inert: workbench.focus || undefined,
|
|
348
|
+
className: slots.timeline({ className }),
|
|
349
|
+
children: (_jsxs(_Fragment, { children: [resizable ? (_jsx("div", { role: "separator", tabIndex: 0, "aria-orientation": "horizontal", "aria-label": "Timeline height", "aria-valuenow": workbench.timelineHeight, "aria-valuemin": minHeight, "data-slot": "workbench-resize", "data-active": active ? '' : undefined, className: slots.resize(), onPointerDown: drag, onKeyDown: keys })) : null, children] })),
|
|
350
|
+
}, props),
|
|
351
|
+
});
|
|
295
352
|
}
|
|
296
353
|
WorkbenchTimeline.displayName = 'Workbench.Timeline';
|
|
297
354
|
export const Workbench = Object.assign(WorkbenchRoot, {
|
|
@@ -28,6 +28,12 @@
|
|
|
28
28
|
* path matters as much as where it ends.
|
|
29
29
|
*/
|
|
30
30
|
import { type ComponentProps, type ReactNode } from 'react';
|
|
31
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
32
|
+
import type { ElementType as RenderElementType } from 'react';
|
|
33
|
+
/** Draws a part as another element, or composes it with a component: `render={<a href="/" />}`. */
|
|
34
|
+
type RenderProp<Tag extends RenderElementType> = {
|
|
35
|
+
render?: useRender.ComponentProps<Tag>['render'];
|
|
36
|
+
};
|
|
31
37
|
export type XYPadColor = 'primary' | 'info' | 'success' | 'warning' | 'destructive';
|
|
32
38
|
export interface XYPadPoint {
|
|
33
39
|
x: number;
|
|
@@ -93,7 +99,7 @@ declare const xyPadVariants: import("tailwind-variants").TVReturnType<{
|
|
|
93
99
|
bracket: string[];
|
|
94
100
|
value: string;
|
|
95
101
|
axisName: string;
|
|
96
|
-
}, import("tailwind-variants").
|
|
102
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
97
103
|
color: {
|
|
98
104
|
primary: {
|
|
99
105
|
root: string;
|
|
@@ -123,7 +129,7 @@ declare const xyPadVariants: import("tailwind-variants").TVReturnType<{
|
|
|
123
129
|
bracket: string[];
|
|
124
130
|
value: string;
|
|
125
131
|
axisName: string;
|
|
126
|
-
}
|
|
132
|
+
}>>;
|
|
127
133
|
export interface XYPadProps extends Omit<ComponentProps<'div'>, 'defaultValue' | 'onChange' | 'children'> {
|
|
128
134
|
/** Where the point is, when the caller holds it. */
|
|
129
135
|
value?: XYPadPoint;
|
|
@@ -170,7 +176,7 @@ declare namespace XYPadRoot {
|
|
|
170
176
|
export interface XYPadValueProps extends ComponentProps<'div'> {
|
|
171
177
|
}
|
|
172
178
|
/** The two values written out, under the field. */
|
|
173
|
-
declare function XYPadValue({ className, ...props }: XYPadValueProps): import("react").
|
|
179
|
+
declare function XYPadValue({ className, render, ...props }: XYPadValueProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
174
180
|
declare namespace XYPadValue {
|
|
175
181
|
var displayName: string;
|
|
176
182
|
}
|
|
@@ -31,6 +31,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
31
31
|
*/
|
|
32
32
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
33
33
|
import { tv } from 'tailwind-variants';
|
|
34
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
35
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
34
36
|
/** How many moves the trail remembers. */
|
|
35
37
|
const TRAIL = 28;
|
|
36
38
|
const xyPadVariants = tv({
|
|
@@ -264,12 +266,21 @@ function Dots({ columns, rows, size, at, className, }) {
|
|
|
264
266
|
return (_jsx("svg", { "aria-hidden": true, className: className, children: dots }));
|
|
265
267
|
}
|
|
266
268
|
/** The two values written out, under the field. */
|
|
267
|
-
function XYPadValue({ className, ...props }) {
|
|
269
|
+
function XYPadValue({ className, render, ...props }) {
|
|
268
270
|
const pad = useContext(PadContext);
|
|
269
271
|
if (!pad)
|
|
270
272
|
throw new Error('XYPad.Value must be used inside an <XYPad>.');
|
|
271
273
|
const slots = xyPadVariants();
|
|
272
|
-
return (
|
|
274
|
+
return useRender({
|
|
275
|
+
defaultTagName: 'div',
|
|
276
|
+
render,
|
|
277
|
+
props: mergeProps({
|
|
278
|
+
'aria-hidden': true,
|
|
279
|
+
'data-slot': 'xy-pad-value',
|
|
280
|
+
className: slots.value({ className }),
|
|
281
|
+
children: (_jsxs(_Fragment, { children: [_jsxs("span", { children: [_jsx("span", { className: slots.axisName(), children: "X" }), pad.write('x', pad.value.x)] }), _jsxs("span", { children: [_jsx("span", { className: slots.axisName(), children: "Y" }), pad.write('y', pad.value.y)] })] })),
|
|
282
|
+
}, props),
|
|
283
|
+
});
|
|
273
284
|
}
|
|
274
285
|
XYPadValue.displayName = 'XYPad.Value';
|
|
275
286
|
export const XYPad = Object.assign(XYPadRoot, {
|
package/dist/index.d.ts
CHANGED
|
@@ -39,3 +39,10 @@ export { ChoiceCards, ChoiceCardsItem, ChoiceCardsMedia, ChoiceCardsLabel, Choic
|
|
|
39
39
|
export { Inspector, InspectorRail, InspectorTab, InspectorRailSeparator, InspectorPanel, InspectorPage, InspectorSection, InspectorSectionTitle, InspectorSectionAction, InspectorSectionContent, InspectorSeparator, inspectorVariants, type InspectorProps, type InspectorRailProps, type InspectorTabProps, type InspectorRailSeparatorProps, type InspectorPanelProps, type InspectorPageProps, type InspectorSectionProps, type InspectorSectionTitleProps, type InspectorSectionActionProps, type InspectorSectionContentProps, type InspectorSeparatorProps, } from './components/inspector/index.js';
|
|
40
40
|
export { Timeline, TimelineHeader, TimelineTime, TimelineZoom, TimelineViewport, TimelineRuler, TimelineTrack, TimelineClip, TimelineClipLabel, TimelineWaveform, TimelinePlayhead, timelineVariants, useTimeline, formatTime, rulerStep, type TimelineProps, type TimelineColor, type TimelineClipVariant, type TimelineTrackSize, type TimelineHeaderProps, type TimelineTimeProps, type TimelineZoomProps, type TimelineViewportProps, type TimelineRulerProps, type TimelineTrackProps, type TimelineClipProps, type TimelineClipLabelProps, type TimelineWaveformProps, type TimelinePlayheadProps, } from './components/timeline/index.js';
|
|
41
41
|
export { Workbench, WorkbenchBar, WorkbenchSidebar, WorkbenchCanvas, WorkbenchArtboard, WorkbenchInspector, WorkbenchInspectorTrigger, WorkbenchTimeline, workbenchVariants, useWorkbench, type WorkbenchProps, type WorkbenchBarProps, type WorkbenchSidebarProps, type WorkbenchCanvasProps, type WorkbenchArtboardProps, type WorkbenchInspectorProps, type WorkbenchInspectorTriggerProps, type WorkbenchTimelineProps, } from './components/workbench/index.js';
|
|
42
|
+
export { Badge, type BadgeProps, type BadgeVariant, type BadgeSize } from './components/badge/index.js';
|
|
43
|
+
export { Chip, ChipGroup, type ChipProps, type ChipToggleProps, type ChipRemovableProps, type ChipGroupProps, type ChipSize, type ChipColor, } from './components/chip/index.js';
|
|
44
|
+
export { Checkbox, CheckboxGroup, type CheckboxProps, type CheckboxGroupProps, type CheckboxSize, type CheckboxColor, } from './components/checkbox/index.js';
|
|
45
|
+
export { RadioGroup, RadioGroupItem, Radio, RadioCard, RadioGroupCard, RadioGroupCardBody, RadioGroupCardTitle, RadioGroupCardDescription, RadioGroupCardAside, type RadioCardProps, type RadioCardAppearance, type RadioGroupProps, type RadioProps, type RadioSize, type RadioColor, } from './components/radio-group/index.js';
|
|
46
|
+
export { Field, FieldLabel, FieldDescription, FieldError, type FieldProps, type FieldLabelProps, type FieldDescriptionProps, type FieldErrorProps, } from './components/field/index.js';
|
|
47
|
+
export { Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption, type TableProps, type TableHeadProps, type TableCellProps, type TableDensity, type TableAlign, } from './components/table/index.js';
|
|
48
|
+
export { Toast, ToastProvider, useToast, createToaster, type ToastProviderProps, type ToastPosition, type ToastType, type ToastEffect, type ToastData, } from './components/toast/index.js';
|
package/dist/index.js
CHANGED
|
@@ -39,3 +39,10 @@ export { ChoiceCards, ChoiceCardsItem, ChoiceCardsMedia, ChoiceCardsLabel, Choic
|
|
|
39
39
|
export { Inspector, InspectorRail, InspectorTab, InspectorRailSeparator, InspectorPanel, InspectorPage, InspectorSection, InspectorSectionTitle, InspectorSectionAction, InspectorSectionContent, InspectorSeparator, inspectorVariants, } from './components/inspector/index.js';
|
|
40
40
|
export { Timeline, TimelineHeader, TimelineTime, TimelineZoom, TimelineViewport, TimelineRuler, TimelineTrack, TimelineClip, TimelineClipLabel, TimelineWaveform, TimelinePlayhead, timelineVariants, useTimeline, formatTime, rulerStep, } from './components/timeline/index.js';
|
|
41
41
|
export { Workbench, WorkbenchBar, WorkbenchSidebar, WorkbenchCanvas, WorkbenchArtboard, WorkbenchInspector, WorkbenchInspectorTrigger, WorkbenchTimeline, workbenchVariants, useWorkbench, } from './components/workbench/index.js';
|
|
42
|
+
export { Badge } from './components/badge/index.js';
|
|
43
|
+
export { Chip, ChipGroup, } from './components/chip/index.js';
|
|
44
|
+
export { Checkbox, CheckboxGroup, } from './components/checkbox/index.js';
|
|
45
|
+
export { RadioGroup, RadioGroupItem, Radio, RadioCard, RadioGroupCard, RadioGroupCardBody, RadioGroupCardTitle, RadioGroupCardDescription, RadioGroupCardAside, } from './components/radio-group/index.js';
|
|
46
|
+
export { Field, FieldLabel, FieldDescription, FieldError, } from './components/field/index.js';
|
|
47
|
+
export { Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption, } from './components/table/index.js';
|
|
48
|
+
export { Toast, ToastProvider, useToast, createToaster, } from './components/toast/index.js';
|