panelui-web 0.10.1 → 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 +76 -24
- 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
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Input — a single line to type into.
|
|
5
|
+
*
|
|
6
|
+
* ```tsx
|
|
7
|
+
* <Input placeholder="you@example.com" type="email" />
|
|
8
|
+
*
|
|
9
|
+
* <Input.Group>
|
|
10
|
+
* <Input.Addon><SearchIcon /></Input.Addon>
|
|
11
|
+
* <Input placeholder="Search" />
|
|
12
|
+
* <Input.Addon align="end"><kbd>⌘K</kbd></Input.Addon>
|
|
13
|
+
* </Input.Group>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* ## The group owns the box
|
|
17
|
+
*
|
|
18
|
+
* On its own, the input draws its border, background and focus ring. Inside
|
|
19
|
+
* `Input.Group`, it drops all three and the group draws them around the input
|
|
20
|
+
* and its addons together, so an icon or a unit reads as part of the field and
|
|
21
|
+
* the ring goes round the whole of it. Pressing an addon that is not a button
|
|
22
|
+
* moves focus into the input.
|
|
23
|
+
*
|
|
24
|
+
* ## Inside a Field
|
|
25
|
+
*
|
|
26
|
+
* Put in a `Field`, the input takes the field's label, description and error
|
|
27
|
+
* without ids passed by hand, and turns invalid when the field does.
|
|
28
|
+
*/
|
|
29
|
+
import { Input as BaseInput } from '@base-ui/react/input';
|
|
3
30
|
import { tv } from 'tailwind-variants';
|
|
31
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
32
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
33
|
const inputVariants = tv({
|
|
5
34
|
slots: {
|
|
6
35
|
input: [
|
|
@@ -54,17 +83,26 @@ const inputVariants = tv({
|
|
|
54
83
|
defaultVariants: { size: 'md', align: 'start' },
|
|
55
84
|
});
|
|
56
85
|
/** A single-line field. Every attribute of `<input>` passes through. */
|
|
57
|
-
function InputRoot({ size, className, type = 'text', ...props }) {
|
|
58
|
-
return (_jsx(
|
|
86
|
+
function InputRoot({ size, className, type = 'text', ref, ...props }) {
|
|
87
|
+
return (_jsx(BaseInput, { type: type, "data-slot": "input", ref: ref, className: inputVariants({ size }).input({ className }), ...props }));
|
|
59
88
|
}
|
|
60
89
|
InputRoot.displayName = 'Input';
|
|
61
90
|
/** Draws one box round an input and its addons. */
|
|
62
|
-
function InputGroup({ size, className, ...props }) {
|
|
63
|
-
return (
|
|
91
|
+
function InputGroup({ size, className, render, ...props }) {
|
|
92
|
+
return useRender({
|
|
93
|
+
defaultTagName: 'div',
|
|
94
|
+
render,
|
|
95
|
+
props: mergeProps({
|
|
96
|
+
role: 'group',
|
|
97
|
+
'data-slot': 'input-group',
|
|
98
|
+
'data-size': size ?? 'md',
|
|
99
|
+
className: inputVariants({ size }).group({ className }),
|
|
100
|
+
}, props),
|
|
101
|
+
});
|
|
64
102
|
}
|
|
65
103
|
InputGroup.displayName = 'Input.Group';
|
|
66
104
|
/** An icon, unit, shortcut or button beside the input, inside its box. */
|
|
67
|
-
function InputAddon({ align, className, onMouseDown, ...props }) {
|
|
105
|
+
function InputAddon({ align, className, onMouseDown, render, ...props }) {
|
|
68
106
|
// A press on the addon's own surface is a press on the field. A button or
|
|
69
107
|
// link inside it is left to do what it does.
|
|
70
108
|
const focusField = (event) => {
|
|
@@ -79,7 +117,16 @@ function InputAddon({ align, className, onMouseDown, ...props }) {
|
|
|
79
117
|
event.preventDefault();
|
|
80
118
|
input.focus();
|
|
81
119
|
};
|
|
82
|
-
return (
|
|
120
|
+
return useRender({
|
|
121
|
+
defaultTagName: 'div',
|
|
122
|
+
render,
|
|
123
|
+
props: mergeProps({
|
|
124
|
+
'data-slot': 'input-addon',
|
|
125
|
+
'data-align': align ?? 'start',
|
|
126
|
+
className: inputVariants({ align }).addon({ className }),
|
|
127
|
+
onMouseDown: focusField,
|
|
128
|
+
}, props),
|
|
129
|
+
});
|
|
83
130
|
}
|
|
84
131
|
InputAddon.displayName = 'Input.Addon';
|
|
85
132
|
export const Input = Object.assign(InputRoot, {
|
|
@@ -1,49 +1,55 @@
|
|
|
1
1
|
import { Tabs } from '@base-ui/react/tabs';
|
|
2
2
|
import { type ComponentProps, type ReactNode } from 'react';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import type { ElementType as RenderElementType } from 'react';
|
|
5
|
+
/** Draws a part as another element, or composes it with a component: `render={<a href="/" />}`. */
|
|
6
|
+
type RenderProp<Tag extends RenderElementType> = {
|
|
7
|
+
render?: useRender.ComponentProps<Tag>['render'];
|
|
8
|
+
};
|
|
3
9
|
declare const inspectorVariants: import("tailwind-variants").TVReturnType<{
|
|
4
10
|
[key: string]: {
|
|
5
|
-
[key: string]: import("tailwind-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
content?: import("tailwind-
|
|
10
|
-
scrollbar?: import("tailwind-
|
|
11
|
-
separator?: import("tailwind-
|
|
12
|
-
tab?: import("tailwind-
|
|
13
|
-
tooltip?: import("tailwind-
|
|
14
|
-
page?: import("tailwind-
|
|
15
|
-
viewport?: import("tailwind-
|
|
16
|
-
panel?: import("tailwind-
|
|
17
|
-
thumb?: import("tailwind-
|
|
18
|
-
chevron?: import("tailwind-
|
|
19
|
-
sectionTitle?: import("tailwind-
|
|
20
|
-
railSeparator?: import("tailwind-
|
|
21
|
-
sectionAction?: import("tailwind-
|
|
22
|
-
rail?: import("tailwind-
|
|
23
|
-
sectionContent?: import("tailwind-
|
|
11
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
12
|
+
section?: import("tailwind-variants").ClassValue;
|
|
13
|
+
marker?: import("tailwind-variants").ClassValue;
|
|
14
|
+
root?: import("tailwind-variants").ClassValue;
|
|
15
|
+
content?: import("tailwind-variants").ClassValue;
|
|
16
|
+
scrollbar?: import("tailwind-variants").ClassValue;
|
|
17
|
+
separator?: import("tailwind-variants").ClassValue;
|
|
18
|
+
tab?: import("tailwind-variants").ClassValue;
|
|
19
|
+
tooltip?: import("tailwind-variants").ClassValue;
|
|
20
|
+
page?: import("tailwind-variants").ClassValue;
|
|
21
|
+
viewport?: import("tailwind-variants").ClassValue;
|
|
22
|
+
panel?: import("tailwind-variants").ClassValue;
|
|
23
|
+
thumb?: import("tailwind-variants").ClassValue;
|
|
24
|
+
chevron?: import("tailwind-variants").ClassValue;
|
|
25
|
+
sectionTitle?: import("tailwind-variants").ClassValue;
|
|
26
|
+
railSeparator?: import("tailwind-variants").ClassValue;
|
|
27
|
+
sectionAction?: import("tailwind-variants").ClassValue;
|
|
28
|
+
rail?: import("tailwind-variants").ClassValue;
|
|
29
|
+
sectionContent?: import("tailwind-variants").ClassValue;
|
|
24
30
|
};
|
|
25
31
|
};
|
|
26
32
|
} | {
|
|
27
33
|
[x: string]: {
|
|
28
|
-
[x: string]: import("tailwind-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
content?: import("tailwind-
|
|
33
|
-
scrollbar?: import("tailwind-
|
|
34
|
-
separator?: import("tailwind-
|
|
35
|
-
tab?: import("tailwind-
|
|
36
|
-
tooltip?: import("tailwind-
|
|
37
|
-
page?: import("tailwind-
|
|
38
|
-
viewport?: import("tailwind-
|
|
39
|
-
panel?: import("tailwind-
|
|
40
|
-
thumb?: import("tailwind-
|
|
41
|
-
chevron?: import("tailwind-
|
|
42
|
-
sectionTitle?: import("tailwind-
|
|
43
|
-
railSeparator?: import("tailwind-
|
|
44
|
-
sectionAction?: import("tailwind-
|
|
45
|
-
rail?: import("tailwind-
|
|
46
|
-
sectionContent?: import("tailwind-
|
|
34
|
+
[x: string]: import("tailwind-variants").ClassValue | {
|
|
35
|
+
section?: import("tailwind-variants").ClassValue;
|
|
36
|
+
marker?: import("tailwind-variants").ClassValue;
|
|
37
|
+
root?: import("tailwind-variants").ClassValue;
|
|
38
|
+
content?: import("tailwind-variants").ClassValue;
|
|
39
|
+
scrollbar?: import("tailwind-variants").ClassValue;
|
|
40
|
+
separator?: import("tailwind-variants").ClassValue;
|
|
41
|
+
tab?: import("tailwind-variants").ClassValue;
|
|
42
|
+
tooltip?: import("tailwind-variants").ClassValue;
|
|
43
|
+
page?: import("tailwind-variants").ClassValue;
|
|
44
|
+
viewport?: import("tailwind-variants").ClassValue;
|
|
45
|
+
panel?: import("tailwind-variants").ClassValue;
|
|
46
|
+
thumb?: import("tailwind-variants").ClassValue;
|
|
47
|
+
chevron?: import("tailwind-variants").ClassValue;
|
|
48
|
+
sectionTitle?: import("tailwind-variants").ClassValue;
|
|
49
|
+
railSeparator?: import("tailwind-variants").ClassValue;
|
|
50
|
+
sectionAction?: import("tailwind-variants").ClassValue;
|
|
51
|
+
rail?: import("tailwind-variants").ClassValue;
|
|
52
|
+
sectionContent?: import("tailwind-variants").ClassValue;
|
|
47
53
|
};
|
|
48
54
|
};
|
|
49
55
|
} | {}, {
|
|
@@ -67,25 +73,25 @@ declare const inspectorVariants: import("tailwind-variants").TVReturnType<{
|
|
|
67
73
|
separator: string;
|
|
68
74
|
}, undefined, {
|
|
69
75
|
[key: string]: {
|
|
70
|
-
[key: string]: import("tailwind-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
content?: import("tailwind-
|
|
75
|
-
scrollbar?: import("tailwind-
|
|
76
|
-
separator?: import("tailwind-
|
|
77
|
-
tab?: import("tailwind-
|
|
78
|
-
tooltip?: import("tailwind-
|
|
79
|
-
page?: import("tailwind-
|
|
80
|
-
viewport?: import("tailwind-
|
|
81
|
-
panel?: import("tailwind-
|
|
82
|
-
thumb?: import("tailwind-
|
|
83
|
-
chevron?: import("tailwind-
|
|
84
|
-
sectionTitle?: import("tailwind-
|
|
85
|
-
railSeparator?: import("tailwind-
|
|
86
|
-
sectionAction?: import("tailwind-
|
|
87
|
-
rail?: import("tailwind-
|
|
88
|
-
sectionContent?: import("tailwind-
|
|
76
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
77
|
+
section?: import("tailwind-variants").ClassValue;
|
|
78
|
+
marker?: import("tailwind-variants").ClassValue;
|
|
79
|
+
root?: import("tailwind-variants").ClassValue;
|
|
80
|
+
content?: import("tailwind-variants").ClassValue;
|
|
81
|
+
scrollbar?: import("tailwind-variants").ClassValue;
|
|
82
|
+
separator?: import("tailwind-variants").ClassValue;
|
|
83
|
+
tab?: import("tailwind-variants").ClassValue;
|
|
84
|
+
tooltip?: import("tailwind-variants").ClassValue;
|
|
85
|
+
page?: import("tailwind-variants").ClassValue;
|
|
86
|
+
viewport?: import("tailwind-variants").ClassValue;
|
|
87
|
+
panel?: import("tailwind-variants").ClassValue;
|
|
88
|
+
thumb?: import("tailwind-variants").ClassValue;
|
|
89
|
+
chevron?: import("tailwind-variants").ClassValue;
|
|
90
|
+
sectionTitle?: import("tailwind-variants").ClassValue;
|
|
91
|
+
railSeparator?: import("tailwind-variants").ClassValue;
|
|
92
|
+
sectionAction?: import("tailwind-variants").ClassValue;
|
|
93
|
+
rail?: import("tailwind-variants").ClassValue;
|
|
94
|
+
sectionContent?: import("tailwind-variants").ClassValue;
|
|
89
95
|
};
|
|
90
96
|
};
|
|
91
97
|
} | {}, {
|
|
@@ -107,7 +113,7 @@ declare const inspectorVariants: import("tailwind-variants").TVReturnType<{
|
|
|
107
113
|
sectionAction: string;
|
|
108
114
|
sectionContent: string[];
|
|
109
115
|
separator: string;
|
|
110
|
-
}, import("tailwind-variants").
|
|
116
|
+
}, import("tailwind-variants").TVReturnTypeLike<unknown, {
|
|
111
117
|
root: string;
|
|
112
118
|
rail: string[];
|
|
113
119
|
marker: string[];
|
|
@@ -126,7 +132,7 @@ declare const inspectorVariants: import("tailwind-variants").TVReturnType<{
|
|
|
126
132
|
sectionAction: string;
|
|
127
133
|
sectionContent: string[];
|
|
128
134
|
separator: string;
|
|
129
|
-
}
|
|
135
|
+
}>>;
|
|
130
136
|
export interface InspectorProps extends Omit<Tabs.Root.Props, 'className' | 'orientation'> {
|
|
131
137
|
className?: string;
|
|
132
138
|
}
|
|
@@ -161,7 +167,7 @@ declare namespace InspectorTab {
|
|
|
161
167
|
export interface InspectorRailSeparatorProps extends ComponentProps<'span'> {
|
|
162
168
|
}
|
|
163
169
|
/** A short line between groups of pages on the rail. */
|
|
164
|
-
declare function InspectorRailSeparator({ className, ...props }: InspectorRailSeparatorProps): import("react").
|
|
170
|
+
declare function InspectorRailSeparator({ className, render, ...props }: InspectorRailSeparatorProps & RenderProp<'span'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
165
171
|
declare namespace InspectorRailSeparator {
|
|
166
172
|
var displayName: string;
|
|
167
173
|
}
|
|
@@ -172,7 +178,7 @@ export interface InspectorPanelProps extends ComponentProps<'div'> {
|
|
|
172
178
|
* page longer than that scrolls inside it. Without pages, its children are
|
|
173
179
|
* one page of sections.
|
|
174
180
|
*/
|
|
175
|
-
declare function InspectorPanel({ className, children, ...props }: InspectorPanelProps): import("react").
|
|
181
|
+
declare function InspectorPanel({ className, children, render, ...props }: InspectorPanelProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
176
182
|
declare namespace InspectorPanel {
|
|
177
183
|
var displayName: string;
|
|
178
184
|
}
|
|
@@ -209,7 +215,7 @@ declare namespace InspectorSectionTitle {
|
|
|
209
215
|
export interface InspectorSectionActionProps extends ComponentProps<'div'> {
|
|
210
216
|
}
|
|
211
217
|
/** What sits at the end of the title's line: the switch for the whole section, or a Reset. */
|
|
212
|
-
declare function InspectorSectionAction({ className, ...props }: InspectorSectionActionProps): import("react").
|
|
218
|
+
declare function InspectorSectionAction({ className, render, ...props }: InspectorSectionActionProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
213
219
|
declare namespace InspectorSectionAction {
|
|
214
220
|
var displayName: string;
|
|
215
221
|
}
|
|
@@ -223,7 +229,7 @@ declare namespace InspectorSectionContent {
|
|
|
223
229
|
export interface InspectorSeparatorProps extends ComponentProps<'div'> {
|
|
224
230
|
}
|
|
225
231
|
/** A hairline between sections that belong to different things. */
|
|
226
|
-
declare function InspectorSeparator({ className, ...props }: InspectorSeparatorProps): import("react").
|
|
232
|
+
declare function InspectorSeparator({ className, render, ...props }: InspectorSeparatorProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
227
233
|
declare namespace InspectorSeparator {
|
|
228
234
|
var displayName: string;
|
|
229
235
|
}
|
|
@@ -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
|
* Inspector — the settings panel beside an editor's canvas: a rail of
|
|
5
5
|
* icons, each opening a page of titled sections.
|
|
@@ -43,6 +43,8 @@ import { Tabs } from '@base-ui/react/tabs';
|
|
|
43
43
|
import { Tooltip } from '@base-ui/react/tooltip';
|
|
44
44
|
import { createContext, useContext } from 'react';
|
|
45
45
|
import { tv } from 'tailwind-variants';
|
|
46
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
47
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
46
48
|
const EASE = 'ease-[cubic-bezier(0.3,1.2,0.4,1)]';
|
|
47
49
|
const inspectorVariants = tv({
|
|
48
50
|
slots: {
|
|
@@ -133,9 +135,13 @@ function InspectorTab({ label, className, children, ...props }) {
|
|
|
133
135
|
}
|
|
134
136
|
InspectorTab.displayName = 'Inspector.Tab';
|
|
135
137
|
/** A short line between groups of pages on the rail. */
|
|
136
|
-
function InspectorRailSeparator({ className, ...props }) {
|
|
138
|
+
function InspectorRailSeparator({ className, render, ...props }) {
|
|
137
139
|
const slots = inspectorVariants();
|
|
138
|
-
return
|
|
140
|
+
return useRender({
|
|
141
|
+
defaultTagName: 'span',
|
|
142
|
+
render,
|
|
143
|
+
props: mergeProps({ 'aria-hidden': true, 'data-slot': 'inspector-rail-separator', className: slots.railSeparator({ className }) }, props),
|
|
144
|
+
});
|
|
139
145
|
}
|
|
140
146
|
InspectorRailSeparator.displayName = 'Inspector.RailSeparator';
|
|
141
147
|
/**
|
|
@@ -143,9 +149,17 @@ InspectorRailSeparator.displayName = 'Inspector.RailSeparator';
|
|
|
143
149
|
* page longer than that scrolls inside it. Without pages, its children are
|
|
144
150
|
* one page of sections.
|
|
145
151
|
*/
|
|
146
|
-
function InspectorPanel({ className, children, ...props }) {
|
|
152
|
+
function InspectorPanel({ className, children, render, ...props }) {
|
|
147
153
|
const slots = inspectorVariants();
|
|
148
|
-
return (
|
|
154
|
+
return useRender({
|
|
155
|
+
defaultTagName: 'div',
|
|
156
|
+
render,
|
|
157
|
+
props: mergeProps({
|
|
158
|
+
'data-slot': 'inspector-panel',
|
|
159
|
+
className: slots.panel({ className }),
|
|
160
|
+
children: _jsx(_Fragment, { children: hasPages(children) ? children : _jsx(Scroll, { children: children }) }),
|
|
161
|
+
}, props),
|
|
162
|
+
});
|
|
149
163
|
}
|
|
150
164
|
InspectorPanel.displayName = 'Inspector.Panel';
|
|
151
165
|
/** Whether the panel's children are pages, rather than sections written straight into it. */
|
|
@@ -193,10 +207,14 @@ function InspectorSectionTitle({ className, children, ...props }) {
|
|
|
193
207
|
}
|
|
194
208
|
InspectorSectionTitle.displayName = 'Inspector.SectionTitle';
|
|
195
209
|
/** What sits at the end of the title's line: the switch for the whole section, or a Reset. */
|
|
196
|
-
function InspectorSectionAction({ className, ...props }) {
|
|
210
|
+
function InspectorSectionAction({ className, render, ...props }) {
|
|
197
211
|
useSection('Inspector.SectionAction');
|
|
198
212
|
const slots = inspectorVariants();
|
|
199
|
-
return
|
|
213
|
+
return useRender({
|
|
214
|
+
defaultTagName: 'div',
|
|
215
|
+
render,
|
|
216
|
+
props: mergeProps({ 'data-slot': 'inspector-section-action', className: slots.sectionAction({ className }) }, props),
|
|
217
|
+
});
|
|
200
218
|
}
|
|
201
219
|
InspectorSectionAction.displayName = 'Inspector.SectionAction';
|
|
202
220
|
/** The controls under the title, stacked with an even gap. */
|
|
@@ -210,9 +228,13 @@ function InspectorSectionContent({ className, children, ...props }) {
|
|
|
210
228
|
}
|
|
211
229
|
InspectorSectionContent.displayName = 'Inspector.SectionContent';
|
|
212
230
|
/** A hairline between sections that belong to different things. */
|
|
213
|
-
function InspectorSeparator({ className, ...props }) {
|
|
231
|
+
function InspectorSeparator({ className, render, ...props }) {
|
|
214
232
|
const slots = inspectorVariants();
|
|
215
|
-
return
|
|
233
|
+
return useRender({
|
|
234
|
+
defaultTagName: 'div',
|
|
235
|
+
render,
|
|
236
|
+
props: mergeProps({ role: 'separator', 'data-slot': 'inspector-separator', className: slots.separator({ className }) }, props),
|
|
237
|
+
});
|
|
216
238
|
}
|
|
217
239
|
InspectorSeparator.displayName = 'Inspector.Separator';
|
|
218
240
|
export const Inspector = Object.assign(InspectorRoot, {
|
|
@@ -42,6 +42,12 @@
|
|
|
42
42
|
* adds nothing to the JavaScript a page sends.
|
|
43
43
|
*/
|
|
44
44
|
import type { ComponentProps, ReactNode } from 'react';
|
|
45
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
46
|
+
import type { ElementType as RenderElementType } from 'react';
|
|
47
|
+
/** Draws a part as another element, or composes it with a component: `render={<a href="/" />}`. */
|
|
48
|
+
type RenderProp<Tag extends RenderElementType> = {
|
|
49
|
+
render?: useRender.ComponentProps<Tag>['render'];
|
|
50
|
+
};
|
|
45
51
|
/** Which of the theme's roles a chart or a bar is drawn in. */
|
|
46
52
|
export type KpiColor = 'primary' | 'info' | 'success' | 'warning' | 'destructive';
|
|
47
53
|
/** Which direction of movement is the good news for this metric. */
|
|
@@ -52,14 +58,14 @@ export interface KpiProps extends ComponentProps<'div'> {
|
|
|
52
58
|
/** Draws the metric as a card of its own. Leave it off inside a frame or a group. */
|
|
53
59
|
surface?: boolean;
|
|
54
60
|
}
|
|
55
|
-
declare function KpiRoot({ surface, className, ...props }: KpiProps): import("react").
|
|
61
|
+
declare function KpiRoot({ surface, className, render, ...props }: KpiProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
56
62
|
declare namespace KpiRoot {
|
|
57
63
|
var displayName: string;
|
|
58
64
|
}
|
|
59
65
|
export interface KpiHeaderProps extends ComponentProps<'div'> {
|
|
60
66
|
}
|
|
61
67
|
/** The row over the number: an icon, the title, and anything at the end. */
|
|
62
|
-
declare function KpiHeader({ className, ...props }: KpiHeaderProps): import("react").
|
|
68
|
+
declare function KpiHeader({ className, render, ...props }: KpiHeaderProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
63
69
|
declare namespace KpiHeader {
|
|
64
70
|
var displayName: string;
|
|
65
71
|
}
|
|
@@ -68,21 +74,21 @@ export interface KpiIconProps extends ComponentProps<'span'> {
|
|
|
68
74
|
tone?: KpiTone;
|
|
69
75
|
}
|
|
70
76
|
/** A small tile for an icon, at the start of the header. */
|
|
71
|
-
declare function KpiIcon({ tone, className, ...props }: KpiIconProps): import("react").
|
|
77
|
+
declare function KpiIcon({ tone, className, render, ...props }: KpiIconProps & RenderProp<'span'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
72
78
|
declare namespace KpiIcon {
|
|
73
79
|
var displayName: string;
|
|
74
80
|
}
|
|
75
81
|
export interface KpiTitleProps extends ComponentProps<'div'> {
|
|
76
82
|
}
|
|
77
83
|
/** What the number measures. */
|
|
78
|
-
declare function KpiTitle({ className, ...props }: KpiTitleProps): import("react").
|
|
84
|
+
declare function KpiTitle({ className, render, ...props }: KpiTitleProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
79
85
|
declare namespace KpiTitle {
|
|
80
86
|
var displayName: string;
|
|
81
87
|
}
|
|
82
88
|
export interface KpiActionsProps extends ComponentProps<'div'> {
|
|
83
89
|
}
|
|
84
90
|
/** Whatever belongs at the end of the header: a period, a badge, a button. */
|
|
85
|
-
declare function KpiActions({ className, ...props }: KpiActionsProps): import("react").
|
|
91
|
+
declare function KpiActions({ className, render, ...props }: KpiActionsProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
86
92
|
declare namespace KpiActions {
|
|
87
93
|
var displayName: string;
|
|
88
94
|
}
|
|
@@ -91,21 +97,21 @@ export interface KpiContentProps extends ComponentProps<'div'> {
|
|
|
91
97
|
layout?: 'below' | 'inline';
|
|
92
98
|
}
|
|
93
99
|
/** The row the number is in, with a trend or a chart at its other end. */
|
|
94
|
-
declare function KpiContent({ layout, className, ...props }: KpiContentProps): import("react").
|
|
100
|
+
declare function KpiContent({ layout, className, render, ...props }: KpiContentProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
95
101
|
declare namespace KpiContent {
|
|
96
102
|
var displayName: string;
|
|
97
103
|
}
|
|
98
104
|
export interface KpiStatProps extends ComponentProps<'div'> {
|
|
99
105
|
}
|
|
100
106
|
/** Title, value and trend stacked as one block, for a row with a chart beside it. */
|
|
101
|
-
declare function KpiStat({ className, ...props }: KpiStatProps): import("react").
|
|
107
|
+
declare function KpiStat({ className, render, ...props }: KpiStatProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
102
108
|
declare namespace KpiStat {
|
|
103
109
|
var displayName: string;
|
|
104
110
|
}
|
|
105
111
|
export interface KpiValueProps extends ComponentProps<'div'> {
|
|
106
112
|
}
|
|
107
113
|
/** The number. */
|
|
108
|
-
declare function KpiValue({ className, ...props }: KpiValueProps): import("react").
|
|
114
|
+
declare function KpiValue({ className, render, ...props }: KpiValueProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
109
115
|
declare namespace KpiValue {
|
|
110
116
|
var displayName: string;
|
|
111
117
|
}
|
|
@@ -127,7 +133,7 @@ export interface KpiTrendProps extends Omit<ComponentProps<'span'>, 'children'>
|
|
|
127
133
|
* The change. Colour comes from what the movement means, not from its sign: a
|
|
128
134
|
* fall in churn is good news and is drawn as good news.
|
|
129
135
|
*/
|
|
130
|
-
declare function KpiTrend({ value, format, goodDirection, variant, caption, threshold, className, ...props }: KpiTrendProps): import("react").
|
|
136
|
+
declare function KpiTrend({ value, format, goodDirection, variant, caption, threshold, className, render, ...props }: KpiTrendProps & RenderProp<'span'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
131
137
|
declare namespace KpiTrend {
|
|
132
138
|
var displayName: string;
|
|
133
139
|
}
|
|
@@ -149,7 +155,7 @@ export interface KpiChartProps extends Omit<ComponentProps<'svg'>, 'children' |
|
|
|
149
155
|
strokeWidth?: number;
|
|
150
156
|
}
|
|
151
157
|
/** The sparkline: the shape of the number over time, with no axis and no values. */
|
|
152
|
-
declare function KpiChart({ data, color, filled, height, inline, strokeWidth, className, style, ...props }: KpiChartProps): import("react").
|
|
158
|
+
declare function KpiChart({ data, color, filled, height, inline, strokeWidth, className, style, render, ...props }: KpiChartProps & RenderProp<'svg'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
153
159
|
declare namespace KpiChart {
|
|
154
160
|
var displayName: string;
|
|
155
161
|
}
|
|
@@ -166,21 +172,21 @@ export interface KpiProgressProps extends Omit<ComponentProps<'div'>, 'children'
|
|
|
166
172
|
color?: KpiColor;
|
|
167
173
|
}
|
|
168
174
|
/** Progress towards a target, under the number. */
|
|
169
|
-
declare function KpiProgress({ value, maxValue, label, showValueLabel, color, className, ...props }: KpiProgressProps): import("react").
|
|
175
|
+
declare function KpiProgress({ value, maxValue, label, showValueLabel, color, className, render, ...props }: KpiProgressProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
170
176
|
declare namespace KpiProgress {
|
|
171
177
|
var displayName: string;
|
|
172
178
|
}
|
|
173
179
|
export interface KpiFooterProps extends ComponentProps<'div'> {
|
|
174
180
|
}
|
|
175
181
|
/** A quiet line under everything: when it was measured, how long is left. */
|
|
176
|
-
declare function KpiFooter({ className, ...props }: KpiFooterProps): import("react").
|
|
182
|
+
declare function KpiFooter({ className, render, ...props }: KpiFooterProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
177
183
|
declare namespace KpiFooter {
|
|
178
184
|
var displayName: string;
|
|
179
185
|
}
|
|
180
186
|
export interface KpiSeparatorProps extends ComponentProps<'div'> {
|
|
181
187
|
}
|
|
182
188
|
/** A rule between two parts of one card. */
|
|
183
|
-
declare function KpiSeparator({ className, ...props }: KpiSeparatorProps): import("react").
|
|
189
|
+
declare function KpiSeparator({ className, render, ...props }: KpiSeparatorProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
184
190
|
declare namespace KpiSeparator {
|
|
185
191
|
var displayName: string;
|
|
186
192
|
}
|
|
@@ -191,7 +197,7 @@ export interface KpiGroupProps extends ComponentProps<'div'> {
|
|
|
191
197
|
surface?: boolean;
|
|
192
198
|
}
|
|
193
199
|
/** Several metrics as one panel, with a rule between each and the next. */
|
|
194
|
-
declare function KpiGroup({ orientation, surface, className, ...props }: KpiGroupProps): import("react").
|
|
200
|
+
declare function KpiGroup({ orientation, surface, className, render, ...props }: KpiGroupProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
195
201
|
declare namespace KpiGroup {
|
|
196
202
|
var displayName: string;
|
|
197
203
|
}
|