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
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { tv } from 'tailwind-variants';
|
|
4
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
5
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
6
|
+
const tableVariants = tv({
|
|
7
|
+
// The parts are rendered apart from the table, so the table's own settings
|
|
8
|
+
// (density, stripes, pinning, framing) reach them as data attributes on
|
|
9
|
+
// the container rather than as variants.
|
|
10
|
+
slots: {
|
|
11
|
+
container: 'relative w-full overflow-auto',
|
|
12
|
+
table: 'w-full caption-bottom border-collapse text-sm',
|
|
13
|
+
header: [
|
|
14
|
+
// The header's line is a shadow, so it stays drawn while the row is pinned and the body scrolls under it.
|
|
15
|
+
'[&_tr]:shadow-[inset_0_-1px_0_var(--border)] [&_tr]:hover:bg-transparent',
|
|
16
|
+
],
|
|
17
|
+
body: '[&_tr:last-child]:border-0',
|
|
18
|
+
footer: 'border-t bg-muted/40 font-medium [&>tr]:last:border-b-0',
|
|
19
|
+
row: [
|
|
20
|
+
'border-b border-border transition-colors',
|
|
21
|
+
'hover:bg-muted/40 data-[state=selected]:bg-muted aria-selected:bg-muted',
|
|
22
|
+
],
|
|
23
|
+
head: [
|
|
24
|
+
'h-10 whitespace-nowrap px-3 text-start align-middle text-xs font-medium text-muted-foreground',
|
|
25
|
+
'first:ps-0 last:pe-0 in-data-[framed]:first:ps-4 in-data-[framed]:last:pe-4',
|
|
26
|
+
],
|
|
27
|
+
cell: 'px-3 align-middle first:ps-0 last:pe-0 in-data-[framed]:first:ps-4 in-data-[framed]:last:pe-4',
|
|
28
|
+
caption: 'mt-3 text-xs text-muted-foreground',
|
|
29
|
+
},
|
|
30
|
+
variants: {
|
|
31
|
+
align: {
|
|
32
|
+
start: {},
|
|
33
|
+
center: { head: 'text-center', cell: 'text-center' },
|
|
34
|
+
end: { head: 'text-end', cell: 'text-end tabular-nums' },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: { align: 'start' },
|
|
38
|
+
});
|
|
39
|
+
/** The table, in a box that scrolls when the table is wider or taller than it. */
|
|
40
|
+
function TableRoot({ density = 'comfortable', striped = false, framed = false, maxHeight, containerClassName, className, render, ...props }) {
|
|
41
|
+
const slots = tableVariants();
|
|
42
|
+
const element = useRender({
|
|
43
|
+
defaultTagName: 'table',
|
|
44
|
+
render,
|
|
45
|
+
props: mergeProps({ 'data-slot': 'table', className: slots.table({ className }) }, props),
|
|
46
|
+
});
|
|
47
|
+
return (_jsx("div", { "data-slot": "table-container", "data-density": density, "data-striped": striped ? '' : undefined, "data-framed": framed ? '' : undefined, "data-sticky": maxHeight != null ? '' : undefined, className: slots.container({ className: containerClassName }), style: maxHeight != null ? { maxHeight } : undefined, children: element }));
|
|
48
|
+
}
|
|
49
|
+
TableRoot.displayName = 'Table';
|
|
50
|
+
/** The header row group. Pinned while the body scrolls, when the table has a `maxHeight`. */
|
|
51
|
+
function TableHeader({ className, render, ...props }) {
|
|
52
|
+
const slots = tableVariants();
|
|
53
|
+
return useRender({
|
|
54
|
+
defaultTagName: 'thead',
|
|
55
|
+
render,
|
|
56
|
+
props: mergeProps({
|
|
57
|
+
'data-slot': 'table-header',
|
|
58
|
+
className: slots.header({
|
|
59
|
+
className: [
|
|
60
|
+
'in-data-[sticky]:sticky in-data-[sticky]:top-0 in-data-[sticky]:z-10 in-data-[sticky]:bg-background',
|
|
61
|
+
className,
|
|
62
|
+
],
|
|
63
|
+
}),
|
|
64
|
+
}, props),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
TableHeader.displayName = 'Table.Header';
|
|
68
|
+
/** The rows of data. */
|
|
69
|
+
function TableBody({ className, render, ...props }) {
|
|
70
|
+
return useRender({
|
|
71
|
+
defaultTagName: 'tbody',
|
|
72
|
+
render,
|
|
73
|
+
props: mergeProps({
|
|
74
|
+
'data-slot': 'table-body',
|
|
75
|
+
className: tableVariants().body({
|
|
76
|
+
className: ['in-data-[striped]:[&>tr:nth-child(even)]:bg-muted/40', className],
|
|
77
|
+
}),
|
|
78
|
+
}, props),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
TableBody.displayName = 'Table.Body';
|
|
82
|
+
/** Totals under the body. */
|
|
83
|
+
function TableFooter({ className, render, ...props }) {
|
|
84
|
+
return useRender({
|
|
85
|
+
defaultTagName: 'tfoot',
|
|
86
|
+
render,
|
|
87
|
+
props: mergeProps({ 'data-slot': 'table-footer', className: tableVariants().footer({ className }) }, props),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
TableFooter.displayName = 'Table.Footer';
|
|
91
|
+
/** One row. `aria-selected` shades it as chosen. */
|
|
92
|
+
function TableRow({ className, render, ...props }) {
|
|
93
|
+
return useRender({
|
|
94
|
+
defaultTagName: 'tr',
|
|
95
|
+
render,
|
|
96
|
+
props: mergeProps({ 'data-slot': 'table-row', className: tableVariants().row({ className }) }, props),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
TableRow.displayName = 'Table.Row';
|
|
100
|
+
/** A column's heading. */
|
|
101
|
+
function TableHead({ align = 'start', className, render, ...props }) {
|
|
102
|
+
return useRender({
|
|
103
|
+
defaultTagName: 'th',
|
|
104
|
+
render,
|
|
105
|
+
props: mergeProps({
|
|
106
|
+
'data-slot': 'table-head',
|
|
107
|
+
scope: 'col',
|
|
108
|
+
className: tableVariants({ align }).head({ className: ['in-data-[density=compact]:h-8', className] }),
|
|
109
|
+
}, props),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
TableHead.displayName = 'Table.Head';
|
|
113
|
+
/** One cell. */
|
|
114
|
+
function TableCell({ align = 'start', className, render, ...props }) {
|
|
115
|
+
return useRender({
|
|
116
|
+
defaultTagName: 'td',
|
|
117
|
+
render,
|
|
118
|
+
props: mergeProps({
|
|
119
|
+
'data-slot': 'table-cell',
|
|
120
|
+
className: tableVariants({ align }).cell({
|
|
121
|
+
className: ['py-3 in-data-[density=compact]:py-1.5', className],
|
|
122
|
+
}),
|
|
123
|
+
}, props),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
TableCell.displayName = 'Table.Cell';
|
|
127
|
+
/** What the table is, under it. Read first by a screen reader. */
|
|
128
|
+
function TableCaption({ className, render, ...props }) {
|
|
129
|
+
return useRender({
|
|
130
|
+
defaultTagName: 'caption',
|
|
131
|
+
render,
|
|
132
|
+
props: mergeProps({ 'data-slot': 'table-caption', className: tableVariants().caption({ className }) }, props),
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
TableCaption.displayName = 'Table.Caption';
|
|
136
|
+
export const Table = Object.assign(TableRoot, {
|
|
137
|
+
Header: TableHeader,
|
|
138
|
+
Body: TableBody,
|
|
139
|
+
Footer: TableFooter,
|
|
140
|
+
Row: TableRow,
|
|
141
|
+
Head: TableHead,
|
|
142
|
+
Cell: TableCell,
|
|
143
|
+
Caption: TableCaption,
|
|
144
|
+
});
|
|
145
|
+
export { TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption };
|
|
@@ -37,6 +37,12 @@
|
|
|
37
37
|
*/
|
|
38
38
|
import { Tabs as BaseTabs } from '@base-ui/react/tabs';
|
|
39
39
|
import { type ComponentProps } from 'react';
|
|
40
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
41
|
+
import type { ElementType as RenderElementType } from 'react';
|
|
42
|
+
/** Draws a part as another element, or composes it with a component: `render={<a href="/" />}`. */
|
|
43
|
+
type RenderProp<Tag extends RenderElementType> = {
|
|
44
|
+
render?: useRender.ComponentProps<Tag>['render'];
|
|
45
|
+
};
|
|
40
46
|
export type TabsVariant = 'segmented' | 'underline' | 'pills';
|
|
41
47
|
export interface TabsProps extends Omit<BaseTabs.Root.Props, 'className'> {
|
|
42
48
|
/** How the tabs are drawn. Default `segmented`. */
|
|
@@ -73,7 +79,7 @@ declare namespace TabsTrigger {
|
|
|
73
79
|
export interface TabsBadgeProps extends ComponentProps<'span'> {
|
|
74
80
|
}
|
|
75
81
|
/** A count beside a tab's label: unread, open, waiting. */
|
|
76
|
-
declare function TabsBadge({ className, ...props }: TabsBadgeProps): import("react").
|
|
82
|
+
declare function TabsBadge({ className, render, ...props }: TabsBadgeProps & RenderProp<'span'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
77
83
|
declare namespace TabsBadge {
|
|
78
84
|
var displayName: string;
|
|
79
85
|
}
|
|
@@ -40,6 +40,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
40
40
|
import { Tabs as BaseTabs } from '@base-ui/react/tabs';
|
|
41
41
|
import { createContext, useContext, useEffect, useRef } from 'react';
|
|
42
42
|
import { tv } from 'tailwind-variants';
|
|
43
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
44
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
43
45
|
/** One curve for the marker and the panel, so they move as one thing. */
|
|
44
46
|
const EASE = 'ease-[cubic-bezier(0.3,0.7,0.1,1)]';
|
|
45
47
|
const tabsVariants = tv({
|
|
@@ -177,9 +179,13 @@ function TabsTrigger({ className, ...props }) {
|
|
|
177
179
|
}
|
|
178
180
|
TabsTrigger.displayName = 'Tabs.Trigger';
|
|
179
181
|
/** A count beside a tab's label: unread, open, waiting. */
|
|
180
|
-
function TabsBadge({ className, ...props }) {
|
|
182
|
+
function TabsBadge({ className, render, ...props }) {
|
|
181
183
|
const slots = tabsVariants({ variant: useContext(VariantContext) });
|
|
182
|
-
return
|
|
184
|
+
return useRender({
|
|
185
|
+
defaultTagName: 'span',
|
|
186
|
+
render,
|
|
187
|
+
props: mergeProps({ 'data-slot': 'tabs-badge', className: slots.badge({ className }) }, props),
|
|
188
|
+
});
|
|
183
189
|
}
|
|
184
190
|
TabsBadge.displayName = 'Tabs.Badge';
|
|
185
191
|
/** What one tab shows. Only the chosen one is in the page unless `keepMounted` is set. */
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Textarea — a field for more than one line, that grows as it is written in.
|
|
3
|
-
*
|
|
4
|
-
* ```tsx
|
|
5
|
-
* <Textarea placeholder="What happened?" />
|
|
6
|
-
* <Textarea minRows={1} maxRows={6} variant="ghost" />
|
|
7
|
-
* ```
|
|
8
|
-
*
|
|
9
|
-
* ## Growing
|
|
10
|
-
*
|
|
11
|
-
* It starts `minRows` lines tall and grows a line at a time as text is
|
|
12
|
-
* written, up to `maxRows`. Past that it scrolls, with a thin scrollbar of its
|
|
13
|
-
* own rather than the browser's. Pass `autoResize={false}` for a field that
|
|
14
|
-
* keeps the size `rows` gives it and can be resized by hand.
|
|
15
|
-
*
|
|
16
|
-
* The height is measured from the text, so it is right on the first render
|
|
17
|
-
* for a value that was already there, and for a value set from outside.
|
|
18
|
-
*
|
|
19
|
-
* ## Ghost
|
|
20
|
-
*
|
|
21
|
-
* `variant="ghost"` drops the border, background and ring, for a field set
|
|
22
|
-
* inside something that already draws them, such as a card or a composer.
|
|
23
|
-
*/
|
|
24
1
|
import { type ComponentProps } from 'react';
|
|
25
2
|
export interface TextareaProps extends Omit<ComponentProps<'textarea'>, 'size'> {
|
|
26
3
|
/** `ghost` draws no box, for a field inside something that draws one. Default `default`. */
|
|
@@ -22,7 +22,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
22
22
|
*
|
|
23
23
|
* `variant="ghost"` drops the border, background and ring, for a field set
|
|
24
24
|
* inside something that already draws them, such as a card or a composer.
|
|
25
|
+
*
|
|
26
|
+
* ## Inside a Field
|
|
27
|
+
*
|
|
28
|
+
* Put in a `Field`, it takes the field's label, description and error without
|
|
29
|
+
* ids passed by hand, and turns invalid when the field does.
|
|
25
30
|
*/
|
|
31
|
+
import { Field as BaseField } from '@base-ui/react/field';
|
|
26
32
|
import { useCallback, useLayoutEffect, useRef } from 'react';
|
|
27
33
|
import { tv } from 'tailwind-variants';
|
|
28
34
|
const textareaVariants = tv({
|
|
@@ -89,13 +95,24 @@ function TextareaRoot({ variant, size, autoResize = true, minRows = 2, maxRows =
|
|
|
89
95
|
}, [autoResize, minRows, maxRows]);
|
|
90
96
|
// Before paint, so a value that was already there never shows at the wrong height.
|
|
91
97
|
useLayoutEffect(fit, [fit, value]);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
98
|
+
const control = {
|
|
99
|
+
'data-slot': 'textarea',
|
|
100
|
+
rows: autoResize ? minRows : rows,
|
|
101
|
+
value,
|
|
102
|
+
onInput: (event) => {
|
|
96
103
|
onInput?.(event);
|
|
97
104
|
fit();
|
|
98
|
-
},
|
|
105
|
+
},
|
|
106
|
+
className: textareaVariants({ variant, size, autoResize, className }),
|
|
107
|
+
style,
|
|
108
|
+
...props,
|
|
109
|
+
};
|
|
110
|
+
// Rendered through the field's control, so a Field around it can label,
|
|
111
|
+
// describe and validate it. Outside a Field it is a plain textarea.
|
|
112
|
+
return (_jsx(BaseField.Control, { ref: (node) => {
|
|
113
|
+
field.current = node;
|
|
114
|
+
setRef(ref, node);
|
|
115
|
+
}, render: _jsx("textarea", {}), ...control }));
|
|
99
116
|
}
|
|
100
117
|
TextareaRoot.displayName = 'Textarea';
|
|
101
118
|
export const Textarea = TextareaRoot;
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
* for reduced motion. Whatever the card says is in its contents.
|
|
33
33
|
*/
|
|
34
34
|
import { type ComponentProps } from 'react';
|
|
35
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
36
|
+
import type { ElementType as RenderElementType } from 'react';
|
|
37
|
+
/** Draws a part as another element, or composes it with a component: `render={<a href="/" />}`. */
|
|
38
|
+
type RenderProp<Tag extends RenderElementType> = {
|
|
39
|
+
render?: useRender.ComponentProps<Tag>['render'];
|
|
40
|
+
};
|
|
35
41
|
/** Which of the theme's roles the light under the pointer is drawn in. */
|
|
36
42
|
export type TiltCardColor = 'primary' | 'info' | 'success' | 'warning' | 'destructive';
|
|
37
43
|
export interface TiltCardProps extends Omit<ComponentProps<'div'>, 'color'> {
|
|
@@ -44,7 +50,7 @@ export interface TiltCardProps extends Omit<ComponentProps<'div'>, 'color'> {
|
|
|
44
50
|
/** Extra classes for the card itself. `className` goes on the box round it. */
|
|
45
51
|
cardClassName?: string;
|
|
46
52
|
}
|
|
47
|
-
declare function TiltCardRoot({ tilt, color, glare, className, cardClassName, children, onPointerMove, onPointerLeave, ...props }: TiltCardProps): import("react").
|
|
53
|
+
declare function TiltCardRoot({ tilt, color, glare, className, cardClassName, children, onPointerMove, onPointerLeave, render, ...props }: TiltCardProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
48
54
|
declare namespace TiltCardRoot {
|
|
49
55
|
var displayName: string;
|
|
50
56
|
}
|
|
@@ -53,7 +59,7 @@ export interface TiltCardLayerProps extends ComponentProps<'div'> {
|
|
|
53
59
|
depth?: number;
|
|
54
60
|
}
|
|
55
61
|
/** Something lifted off the card, which moves against it as the card leans. */
|
|
56
|
-
declare function TiltCardLayer({ depth, className, style, ...props }: TiltCardLayerProps): import("react").
|
|
62
|
+
declare function TiltCardLayer({ depth, className, style, render, ...props }: TiltCardLayerProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
57
63
|
declare namespace TiltCardLayer {
|
|
58
64
|
var displayName: string;
|
|
59
65
|
}
|
|
@@ -69,7 +75,7 @@ declare namespace TiltCardTitle {
|
|
|
69
75
|
export interface TiltCardDescriptionProps extends ComponentProps<'p'> {
|
|
70
76
|
}
|
|
71
77
|
/** A line or two of body text, under the title. */
|
|
72
|
-
declare function TiltCardDescription({ className, ...props }: TiltCardDescriptionProps): import("react").
|
|
78
|
+
declare function TiltCardDescription({ className, render, ...props }: TiltCardDescriptionProps & RenderProp<'p'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
73
79
|
declare namespace TiltCardDescription {
|
|
74
80
|
var displayName: string;
|
|
75
81
|
}
|
|
@@ -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
|
* TiltCard — a card that leans towards the pointer, with layers inside it
|
|
5
5
|
* that move by how near they are.
|
|
@@ -33,8 +33,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
33
33
|
* follow a finger, and it holds still for anyone who has asked their system
|
|
34
34
|
* for reduced motion. Whatever the card says is in its contents.
|
|
35
35
|
*/
|
|
36
|
-
import { useRef
|
|
36
|
+
import { useRef } from 'react';
|
|
37
37
|
import { tv } from 'tailwind-variants';
|
|
38
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
39
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
38
40
|
const tiltCardVariants = tv({
|
|
39
41
|
slots: {
|
|
40
42
|
// The eye's distance from the card. Nearer and the lean would be a lurch.
|
|
@@ -62,7 +64,7 @@ const tiltCardVariants = tv({
|
|
|
62
64
|
},
|
|
63
65
|
defaultVariants: { color: 'primary' },
|
|
64
66
|
});
|
|
65
|
-
function TiltCardRoot({ tilt = 8, color = 'primary', glare = true, className, cardClassName, children, onPointerMove, onPointerLeave, ...props }) {
|
|
67
|
+
function TiltCardRoot({ tilt = 8, color = 'primary', glare = true, className, cardClassName, children, onPointerMove, onPointerLeave, render, ...props }) {
|
|
66
68
|
const slots = tiltCardVariants({ color });
|
|
67
69
|
const root = useRef(null);
|
|
68
70
|
const frame = useRef(0);
|
|
@@ -103,12 +105,26 @@ function TiltCardRoot({ tilt = 8, color = 'primary', glare = true, className, ca
|
|
|
103
105
|
for (const name of ['--pu-rx', '--pu-ry', '--pu-px', '--pu-py'])
|
|
104
106
|
node.style.removeProperty(name);
|
|
105
107
|
};
|
|
106
|
-
return (
|
|
108
|
+
return useRender({
|
|
109
|
+
defaultTagName: 'div',
|
|
110
|
+
render,
|
|
111
|
+
props: mergeProps({
|
|
112
|
+
ref: root,
|
|
113
|
+
className: slots.root({ className }),
|
|
114
|
+
onPointerMove: lean,
|
|
115
|
+
onPointerLeave: settle,
|
|
116
|
+
children: (_jsx(_Fragment, { children: _jsxs("div", { className: slots.card({ className: cardClassName }), children: [children, glare ? _jsx("span", { "aria-hidden": "true", className: slots.glare() }) : null] }) })),
|
|
117
|
+
}, props),
|
|
118
|
+
});
|
|
107
119
|
}
|
|
108
120
|
TiltCardRoot.displayName = 'TiltCard';
|
|
109
121
|
/** Something lifted off the card, which moves against it as the card leans. */
|
|
110
|
-
function TiltCardLayer({ depth = 16, className, style, ...props }) {
|
|
111
|
-
return (
|
|
122
|
+
function TiltCardLayer({ depth = 16, className, style, render, ...props }) {
|
|
123
|
+
return useRender({
|
|
124
|
+
defaultTagName: 'div',
|
|
125
|
+
render,
|
|
126
|
+
props: mergeProps({ className: tiltCardVariants().layer({ className }), style: { ['--pu-depth']: depth, ...style } }, props),
|
|
127
|
+
});
|
|
112
128
|
}
|
|
113
129
|
TiltCardLayer.displayName = 'TiltCard.Layer';
|
|
114
130
|
/** What the card is about. */
|
|
@@ -117,8 +133,12 @@ function TiltCardTitle({ as: Tag = 'h3', className, ...props }) {
|
|
|
117
133
|
}
|
|
118
134
|
TiltCardTitle.displayName = 'TiltCard.Title';
|
|
119
135
|
/** A line or two of body text, under the title. */
|
|
120
|
-
function TiltCardDescription({ className, ...props }) {
|
|
121
|
-
return (
|
|
136
|
+
function TiltCardDescription({ className, render, ...props }) {
|
|
137
|
+
return useRender({
|
|
138
|
+
defaultTagName: 'p',
|
|
139
|
+
render,
|
|
140
|
+
props: mergeProps({ 'data-slot': 'tilt-card-description', className: tiltCardVariants().description({ className }) }, props),
|
|
141
|
+
});
|
|
122
142
|
}
|
|
123
143
|
TiltCardDescription.displayName = 'TiltCard.Description';
|
|
124
144
|
export const TiltCard = Object.assign(TiltCardRoot, {
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { type ComponentProps } from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type * as ReactTypes from 'react';
|
|
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
|
+
};
|
|
2
9
|
export type TimelineColor = 'primary' | 'info' | 'success' | 'warning' | 'destructive' | 'chart-1' | 'chart-2' | 'chart-3' | 'chart-4' | 'chart-5';
|
|
3
10
|
export type TimelineClipVariant = 'bar' | 'block' | 'media';
|
|
4
11
|
export type TimelineTrackSize = 'sm' | 'md' | 'lg';
|
|
@@ -102,7 +109,7 @@ declare const timelineVariants: import("tailwind-variants").TVReturnType<{
|
|
|
102
109
|
playhead: string;
|
|
103
110
|
playheadLine: string;
|
|
104
111
|
playheadHead: string[];
|
|
105
|
-
}, import("tailwind-variants").
|
|
112
|
+
}, import("tailwind-variants").TVReturnTypeLike<{
|
|
106
113
|
variant: {
|
|
107
114
|
bar: {
|
|
108
115
|
clip: string;
|
|
@@ -148,7 +155,7 @@ declare const timelineVariants: import("tailwind-variants").TVReturnType<{
|
|
|
148
155
|
playhead: string;
|
|
149
156
|
playheadLine: string;
|
|
150
157
|
playheadHead: string[];
|
|
151
|
-
}
|
|
158
|
+
}>>;
|
|
152
159
|
/**
|
|
153
160
|
* The timeline's state, for controls of your own: a play button in a
|
|
154
161
|
* toolbar, a readout, a button that zooms to fit. Use it inside `<Timeline>`.
|
|
@@ -198,14 +205,14 @@ export interface TimelineProps extends Omit<ComponentProps<'div'>, 'onChange'> {
|
|
|
198
205
|
readOnly?: boolean;
|
|
199
206
|
}
|
|
200
207
|
/** Holds the time, the zoom and playback for the parts inside it. */
|
|
201
|
-
declare function TimelineRoot({ duration, time: timeProp, defaultTime, onTimeChange, zoom: zoomProp, defaultZoom, onZoomChange, minZoom, maxZoom, playing: playingProp, onPlayingChange, loop, snap, readOnly, className, children, ...props }: TimelineProps):
|
|
208
|
+
declare function TimelineRoot({ duration, time: timeProp, defaultTime, onTimeChange, zoom: zoomProp, defaultZoom, onZoomChange, minZoom, maxZoom, playing: playingProp, onPlayingChange, loop, snap, readOnly, className, children, ...props }: TimelineProps): ReactTypes.JSX.Element;
|
|
202
209
|
declare namespace TimelineRoot {
|
|
203
210
|
var displayName: string;
|
|
204
211
|
}
|
|
205
212
|
export interface TimelineHeaderProps extends ComponentProps<'div'> {
|
|
206
213
|
}
|
|
207
214
|
/** A row above the tracks, for a toolbar, the time and the zoom. */
|
|
208
|
-
declare function TimelineHeader({ className, ...props }: TimelineHeaderProps):
|
|
215
|
+
declare function TimelineHeader({ className, render, ...props }: TimelineHeaderProps & RenderProp<'div'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
209
216
|
declare namespace TimelineHeader {
|
|
210
217
|
var displayName: string;
|
|
211
218
|
}
|
|
@@ -214,14 +221,14 @@ export interface TimelineTimeProps extends ComponentProps<'span'> {
|
|
|
214
221
|
showDuration?: boolean;
|
|
215
222
|
}
|
|
216
223
|
/** Where the playhead is, written out, and how long the whole is. */
|
|
217
|
-
declare function TimelineTime({ showDuration, className, ...props }: TimelineTimeProps):
|
|
224
|
+
declare function TimelineTime({ showDuration, className, render, ...props }: TimelineTimeProps & RenderProp<'span'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
218
225
|
declare namespace TimelineTime {
|
|
219
226
|
var displayName: string;
|
|
220
227
|
}
|
|
221
228
|
export interface TimelineZoomProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
222
229
|
}
|
|
223
230
|
/** A line slider that zooms the timeline, with zoom out and zoom in either side. */
|
|
224
|
-
declare function TimelineZoom({ className, ...props }: TimelineZoomProps):
|
|
231
|
+
declare function TimelineZoom({ className, render, ...props }: TimelineZoomProps & RenderProp<'div'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
225
232
|
declare namespace TimelineZoom {
|
|
226
233
|
var displayName: string;
|
|
227
234
|
}
|
|
@@ -231,14 +238,14 @@ export interface TimelineViewportProps extends ComponentProps<'div'> {
|
|
|
231
238
|
* The part that scrolls sideways: the ruler, the tracks and the playhead go
|
|
232
239
|
* in here. Pinch, or ⌘ or Ctrl with the wheel, zooms about the pointer.
|
|
233
240
|
*/
|
|
234
|
-
declare function TimelineViewport({ className, style, children, ...props }: TimelineViewportProps):
|
|
241
|
+
declare function TimelineViewport({ className, style, children, ...props }: TimelineViewportProps): ReactTypes.JSX.Element;
|
|
235
242
|
declare namespace TimelineViewport {
|
|
236
243
|
var displayName: string;
|
|
237
244
|
}
|
|
238
245
|
export interface TimelineRulerProps extends ComponentProps<'div'> {
|
|
239
246
|
}
|
|
240
247
|
/** Ticks and times along the top. Pressing or dragging on it moves the playhead there. */
|
|
241
|
-
declare function TimelineRuler({ className, ...props }: TimelineRulerProps):
|
|
248
|
+
declare function TimelineRuler({ className, render, ...props }: TimelineRulerProps & RenderProp<'div'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
242
249
|
declare namespace TimelineRuler {
|
|
243
250
|
var displayName: string;
|
|
244
251
|
}
|
|
@@ -249,7 +256,7 @@ export interface TimelineTrackProps extends ComponentProps<'div'> {
|
|
|
249
256
|
label?: string;
|
|
250
257
|
}
|
|
251
258
|
/** A row of clips. Clips on one track cannot overlap. */
|
|
252
|
-
declare function TimelineTrack({ size, label, className, ...props }: TimelineTrackProps):
|
|
259
|
+
declare function TimelineTrack({ size, label, className, ...props }: TimelineTrackProps): ReactTypes.JSX.Element;
|
|
253
260
|
declare namespace TimelineTrack {
|
|
254
261
|
var displayName: string;
|
|
255
262
|
}
|
|
@@ -278,14 +285,14 @@ export interface TimelineClipProps extends Omit<ComponentProps<'div'>, 'onChange
|
|
|
278
285
|
label?: string;
|
|
279
286
|
}
|
|
280
287
|
/** One clip. With `onChange` it moves by its middle and trims by its ends. */
|
|
281
|
-
declare function TimelineClip({ start, end, onChange, onChangeEnd, onRemove, variant: variantProp, color, label, className, style, children, onKeyDown, ...props }: TimelineClipProps):
|
|
288
|
+
declare function TimelineClip({ start, end, onChange, onChangeEnd, onRemove, variant: variantProp, color, label, className, style, children, onKeyDown, render, ...props }: TimelineClipProps & RenderProp<'div'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
282
289
|
declare namespace TimelineClip {
|
|
283
290
|
var displayName: string;
|
|
284
291
|
}
|
|
285
292
|
export interface TimelineClipLabelProps extends ComponentProps<'span'> {
|
|
286
293
|
}
|
|
287
294
|
/** Words on a clip, with an icon: its length, its speed, what it is. */
|
|
288
|
-
declare function TimelineClipLabel({ className, ...props }: TimelineClipLabelProps):
|
|
295
|
+
declare function TimelineClipLabel({ className, render, ...props }: TimelineClipLabelProps & RenderProp<'span'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
289
296
|
declare namespace TimelineClipLabel {
|
|
290
297
|
var displayName: string;
|
|
291
298
|
}
|
|
@@ -294,7 +301,7 @@ export interface TimelineWaveformProps extends Omit<ComponentProps<'svg'>, 'chil
|
|
|
294
301
|
peaks: number[];
|
|
295
302
|
}
|
|
296
303
|
/** The sound of a media clip, drawn as bars across it. */
|
|
297
|
-
declare function TimelineWaveform({ peaks, className, ...props }: TimelineWaveformProps):
|
|
304
|
+
declare function TimelineWaveform({ peaks, className, render, ...props }: TimelineWaveformProps & RenderProp<'svg'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
298
305
|
declare namespace TimelineWaveform {
|
|
299
306
|
var displayName: string;
|
|
300
307
|
}
|
|
@@ -309,7 +316,7 @@ export interface TimelinePlayheadProps extends Omit<ComponentProps<'div'>, 'colo
|
|
|
309
316
|
* be dragged, and with focus the arrow keys step it: a tenth of a second,
|
|
310
317
|
* or a second with Shift.
|
|
311
318
|
*/
|
|
312
|
-
declare function TimelinePlayhead({ color, showTime, className, style, ...props }: TimelinePlayheadProps):
|
|
319
|
+
declare function TimelinePlayhead({ color, showTime, className, style, render, ...props }: TimelinePlayheadProps & RenderProp<'div'>): ReactTypes.ReactElement<unknown, string | ReactTypes.JSXElementConstructor<any>>;
|
|
313
320
|
declare namespace TimelinePlayhead {
|
|
314
321
|
var displayName: string;
|
|
315
322
|
}
|