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.
Files changed (99) hide show
  1. package/dist/components/alert/index.d.ts +15 -8
  2. package/dist/components/alert/index.js +65 -18
  3. package/dist/components/alert-dialog/index.d.ts +9 -3
  4. package/dist/components/alert-dialog/index.js +23 -7
  5. package/dist/components/avatar/index.d.ts +9 -3
  6. package/dist/components/avatar/index.js +34 -10
  7. package/dist/components/badge/index.d.ts +57 -0
  8. package/dist/components/badge/index.js +61 -0
  9. package/dist/components/bar-picker/index.d.ts +8 -1
  10. package/dist/components/bar-picker/index.js +35 -26
  11. package/dist/components/button/index.d.ts +68 -46
  12. package/dist/components/button/index.js +38 -2
  13. package/dist/components/button-group/index.d.ts +11 -5
  14. package/dist/components/button-group/index.js +31 -7
  15. package/dist/components/canvas/index.d.ts +9 -3
  16. package/dist/components/canvas/index.js +53 -25
  17. package/dist/components/card/index.d.ts +13 -7
  18. package/dist/components/card/index.js +45 -17
  19. package/dist/components/checkbox/index.d.ts +73 -0
  20. package/dist/components/checkbox/index.js +100 -0
  21. package/dist/components/chip/index.d.ts +79 -0
  22. package/dist/components/chip/index.js +112 -0
  23. package/dist/components/choice-cards/index.d.ts +11 -5
  24. package/dist/components/choice-cards/index.js +25 -6
  25. package/dist/components/command-dock/index.d.ts +16 -9
  26. package/dist/components/command-dock/index.js +76 -19
  27. package/dist/components/day-grid/index.d.ts +12 -6
  28. package/dist/components/day-grid/index.js +71 -27
  29. package/dist/components/dialog/index.d.ts +19 -12
  30. package/dist/components/dialog/index.js +84 -25
  31. package/dist/components/feedback/index.d.ts +20 -13
  32. package/dist/components/feedback/index.js +83 -27
  33. package/dist/components/field/index.d.ts +85 -0
  34. package/dist/components/field/index.js +90 -0
  35. package/dist/components/flow/index.d.ts +21 -14
  36. package/dist/components/flow/index.js +56 -20
  37. package/dist/components/frame/index.d.ts +17 -11
  38. package/dist/components/frame/index.js +73 -22
  39. package/dist/components/input/index.d.ts +9 -24
  40. package/dist/components/input/index.js +53 -6
  41. package/dist/components/inspector/index.d.ts +69 -63
  42. package/dist/components/inspector/index.js +31 -9
  43. package/dist/components/kpi/index.d.ts +20 -14
  44. package/dist/components/kpi/index.js +111 -36
  45. package/dist/components/label/index.d.ts +10 -4
  46. package/dist/components/label/index.js +39 -9
  47. package/dist/components/lane-board/index.d.ts +15 -9
  48. package/dist/components/lane-board/index.js +97 -57
  49. package/dist/components/menu/index.d.ts +10 -4
  50. package/dist/components/menu/index.js +28 -10
  51. package/dist/components/message/index.d.ts +15 -9
  52. package/dist/components/message/index.js +71 -19
  53. package/dist/components/not-found/index.d.ts +10 -4
  54. package/dist/components/not-found/index.js +48 -12
  55. package/dist/components/planet/index.d.ts +11 -5
  56. package/dist/components/planet/index.js +73 -20
  57. package/dist/components/prompt/index.d.ts +30 -23
  58. package/dist/components/prompt/index.js +148 -52
  59. package/dist/components/radio-group/index.d.ts +124 -0
  60. package/dist/components/radio-group/index.js +216 -0
  61. package/dist/components/range-meter/index.d.ts +9 -3
  62. package/dist/components/range-meter/index.js +61 -27
  63. package/dist/components/rolling-number/index.d.ts +8 -1
  64. package/dist/components/rolling-number/index.js +15 -6
  65. package/dist/components/select/index.d.ts +7 -1
  66. package/dist/components/select/index.js +13 -4
  67. package/dist/components/sheet/index.d.ts +8 -2
  68. package/dist/components/sheet/index.js +27 -15
  69. package/dist/components/slider/index.d.ts +11 -4
  70. package/dist/components/slider/index.js +30 -10
  71. package/dist/components/soundwave/index.d.ts +8 -2
  72. package/dist/components/soundwave/index.js +26 -6
  73. package/dist/components/stat/index.d.ts +13 -7
  74. package/dist/components/stat/index.js +45 -15
  75. package/dist/components/table/index.d.ts +128 -0
  76. package/dist/components/table/index.js +145 -0
  77. package/dist/components/tabs/index.d.ts +7 -1
  78. package/dist/components/tabs/index.js +8 -2
  79. package/dist/components/textarea/index.d.ts +0 -23
  80. package/dist/components/textarea/index.js +22 -5
  81. package/dist/components/tilt-card/index.d.ts +9 -3
  82. package/dist/components/tilt-card/index.js +28 -8
  83. package/dist/components/timeline/index.d.ts +20 -13
  84. package/dist/components/timeline/index.js +166 -59
  85. package/dist/components/toast/dither-text.d.ts +13 -0
  86. package/dist/components/toast/dither-text.js +143 -0
  87. package/dist/components/toast/dither.d.ts +29 -0
  88. package/dist/components/toast/dither.js +153 -0
  89. package/dist/components/toast/index.d.ts +108 -0
  90. package/dist/components/toast/index.js +225 -0
  91. package/dist/components/toolbar/index.d.ts +9 -3
  92. package/dist/components/toolbar/index.js +23 -6
  93. package/dist/components/workbench/index.d.ts +50 -43
  94. package/dist/components/workbench/index.js +77 -20
  95. package/dist/components/xy-pad/index.d.ts +9 -3
  96. package/dist/components/xy-pad/index.js +13 -2
  97. package/dist/index.d.ts +7 -0
  98. package/dist/index.js +7 -0
  99. package/package.json +1 -1
@@ -1,5 +1,8 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
3
  import { tv } from 'tailwind-variants';
4
+ import { mergeProps } from '@base-ui/react/merge-props';
5
+ import { useRender } from '@base-ui/react/use-render';
3
6
  const kpiVariants = tv({
4
7
  slots: {
5
8
  root: 'flex w-full flex-col gap-2 text-foreground',
@@ -94,50 +97,82 @@ const kpiVariants = tv({
94
97
  ],
95
98
  defaultVariants: { tone: 'neutral', trendVariant: 'text', layout: 'below', color: 'primary' },
96
99
  });
97
- function KpiRoot({ surface = false, className, ...props }) {
98
- return _jsx("div", { className: kpiVariants({ surface }).root({ className }), ...props });
100
+ function KpiRoot({ surface = false, className, render, ...props }) {
101
+ return useRender({
102
+ defaultTagName: 'div',
103
+ render,
104
+ props: mergeProps({ className: kpiVariants({ surface }).root({ className }) }, props),
105
+ });
99
106
  }
100
107
  KpiRoot.displayName = 'Kpi';
101
108
  /** The row over the number: an icon, the title, and anything at the end. */
102
- function KpiHeader({ className, ...props }) {
103
- return _jsx("div", { className: kpiVariants().header({ className }), ...props });
109
+ function KpiHeader({ className, render, ...props }) {
110
+ return useRender({
111
+ defaultTagName: 'div',
112
+ render,
113
+ props: mergeProps({ className: kpiVariants().header({ className }) }, props),
114
+ });
104
115
  }
105
116
  KpiHeader.displayName = 'Kpi.Header';
106
117
  /** A small tile for an icon, at the start of the header. */
107
- function KpiIcon({ tone = 'neutral', className, ...props }) {
108
- return _jsx("span", { "aria-hidden": "true", className: kpiVariants({ tone }).icon({ className }), ...props });
118
+ function KpiIcon({ tone = 'neutral', className, render, ...props }) {
119
+ return useRender({
120
+ defaultTagName: 'span',
121
+ render,
122
+ props: mergeProps({ 'aria-hidden': 'true', className: kpiVariants({ tone }).icon({ className }) }, props),
123
+ });
109
124
  }
110
125
  KpiIcon.displayName = 'Kpi.Icon';
111
126
  /** What the number measures. */
112
- function KpiTitle({ className, ...props }) {
113
- return _jsx("div", { "data-kpi-title": "", className: kpiVariants().title({ className }), ...props });
127
+ function KpiTitle({ className, render, ...props }) {
128
+ return useRender({
129
+ defaultTagName: 'div',
130
+ render,
131
+ props: mergeProps({ 'data-kpi-title': '', className: kpiVariants().title({ className }) }, props),
132
+ });
114
133
  }
115
134
  KpiTitle.displayName = 'Kpi.Title';
116
135
  /** Whatever belongs at the end of the header: a period, a badge, a button. */
117
- function KpiActions({ className, ...props }) {
118
- return _jsx("div", { className: kpiVariants().actions({ className }), ...props });
136
+ function KpiActions({ className, render, ...props }) {
137
+ return useRender({
138
+ defaultTagName: 'div',
139
+ render,
140
+ props: mergeProps({ className: kpiVariants().actions({ className }) }, props),
141
+ });
119
142
  }
120
143
  KpiActions.displayName = 'Kpi.Actions';
121
144
  /** The row the number is in, with a trend or a chart at its other end. */
122
- function KpiContent({ layout = 'below', className, ...props }) {
123
- return _jsx("div", { className: kpiVariants({ layout }).content({ className }), ...props });
145
+ function KpiContent({ layout = 'below', className, render, ...props }) {
146
+ return useRender({
147
+ defaultTagName: 'div',
148
+ render,
149
+ props: mergeProps({ className: kpiVariants({ layout }).content({ className }) }, props),
150
+ });
124
151
  }
125
152
  KpiContent.displayName = 'Kpi.Content';
126
153
  /** Title, value and trend stacked as one block, for a row with a chart beside it. */
127
- function KpiStat({ className, ...props }) {
128
- return _jsx("div", { className: kpiVariants().stat({ className }), ...props });
154
+ function KpiStat({ className, render, ...props }) {
155
+ return useRender({
156
+ defaultTagName: 'div',
157
+ render,
158
+ props: mergeProps({ className: kpiVariants().stat({ className }) }, props),
159
+ });
129
160
  }
130
161
  KpiStat.displayName = 'Kpi.Stat';
131
162
  /** The number. */
132
- function KpiValue({ className, ...props }) {
133
- return _jsx("div", { className: kpiVariants().value({ className }), ...props });
163
+ function KpiValue({ className, render, ...props }) {
164
+ return useRender({
165
+ defaultTagName: 'div',
166
+ render,
167
+ props: mergeProps({ className: kpiVariants().value({ className }) }, props),
168
+ });
134
169
  }
135
170
  KpiValue.displayName = 'Kpi.Value';
136
171
  /**
137
172
  * The change. Colour comes from what the movement means, not from its sign: a
138
173
  * fall in churn is good news and is drawn as good news.
139
174
  */
140
- function KpiTrend({ value, format, goodDirection = 'up', variant = 'text', caption, threshold = 0, className, ...props }) {
175
+ function KpiTrend({ value, format, goodDirection = 'up', variant = 'text', caption, threshold = 0, className, render, ...props }) {
141
176
  const flat = Math.abs(value) <= threshold;
142
177
  const rising = value > 0;
143
178
  const tone = flat
@@ -154,7 +189,16 @@ function KpiTrend({ value, format, goodDirection = 'up', variant = 'text', capti
154
189
  // dash between two words, and the sign is half the meaning.
155
190
  `${rising ? '+' : value < 0 ? '−' : ''}${Math.abs(value).toFixed(1)}%`;
156
191
  const spoken = `${flat ? 'No change' : rising ? 'Up' : 'Down'} ${Math.abs(value).toFixed(1)} percent${caption ? `, ${caption}` : ''}`;
157
- return (_jsxs("span", { role: "img", "aria-label": spoken, className: slots.trend({ className }), ...props, children: [variant === 'badge' ? (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", className: "size-3", children: flat ? (_jsx("path", { d: "M5 12h14" })) : rising ? (_jsx("path", { d: "M12 19V5M5 12l7-7 7 7" })) : (_jsx("path", { d: "M12 5v14M19 12l-7 7-7-7" })) })) : null, _jsxs("span", { "aria-hidden": "true", children: [label, caption ? _jsxs("span", { className: slots.caption(), children: [" ", caption] }) : null] })] }));
192
+ return useRender({
193
+ defaultTagName: 'span',
194
+ render,
195
+ props: mergeProps({
196
+ role: 'img',
197
+ 'aria-label': spoken,
198
+ className: slots.trend({ className }),
199
+ children: (_jsxs(_Fragment, { children: [variant === 'badge' ? (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", className: "size-3", children: flat ? (_jsx("path", { d: "M5 12h14" })) : rising ? (_jsx("path", { d: "M12 19V5M5 12l7-7 7 7" })) : (_jsx("path", { d: "M12 5v14M19 12l-7 7-7-7" })) })) : null, _jsxs("span", { "aria-hidden": "true", children: [label, caption ? _jsxs("span", { className: slots.caption(), children: [" ", caption] }) : null] })] })),
200
+ }, props),
201
+ });
158
202
  }
159
203
  KpiTrend.displayName = 'Kpi.Trend';
160
204
  /** The box an inline chart is given, in pixels. */
@@ -182,7 +226,7 @@ function linePath(points) {
182
226
  return path;
183
227
  }
184
228
  /** The sparkline: the shape of the number over time, with no axis and no values. */
185
- function KpiChart({ data, color = 'primary', filled = false, height, inline = false, strokeWidth = 2, className, style, ...props }) {
229
+ function KpiChart({ data, color = 'primary', filled = false, height, inline = false, strokeWidth = 2, className, style, render, ...props }) {
186
230
  const slots = kpiVariants({ color });
187
231
  const low = Math.min(...data);
188
232
  const high = Math.max(...data);
@@ -195,37 +239,68 @@ function KpiChart({ data, color = 'primary', filled = false, height, inline = fa
195
239
  pad + (1 - (value - low) / span) * (GRID_HEIGHT - pad * 2),
196
240
  ]);
197
241
  const line = linePath(points);
198
- return (_jsxs("svg", { role: "img", "aria-label": "Trend", viewBox: `0 0 ${GRID_WIDTH} ${GRID_HEIGHT}`, preserveAspectRatio: "none", className: slots.chart({ className }), style: {
199
- height: height ?? (inline ? INLINE_HEIGHT : 56),
200
- ...(inline ? { width: INLINE_WIDTH, flex: 'none' } : null),
201
- ...style,
202
- }, ...props, children: [filled && line ? (_jsx("path", { d: `${line} L${GRID_WIDTH} ${GRID_HEIGHT} L0 ${GRID_HEIGHT} Z`, fill: "var(--pu-color)", opacity: "0.12" })) : null, _jsx("path", { d: line, fill: "none", stroke: "var(--pu-color)", strokeWidth: strokeWidth, strokeLinecap: "round", strokeLinejoin: "round",
203
- // The grid is stretched to the chart's size. Without this the line
204
- // would be stretched with it, thick across and thin up and down.
205
- vectorEffect: "non-scaling-stroke" })] }));
242
+ return useRender({
243
+ defaultTagName: 'svg',
244
+ render,
245
+ props: mergeProps({
246
+ role: 'img',
247
+ 'aria-label': 'Trend',
248
+ viewBox: `0 0 ${GRID_WIDTH} ${GRID_HEIGHT}`,
249
+ preserveAspectRatio: 'none',
250
+ className: slots.chart({ className }),
251
+ style: {
252
+ height: height ?? (inline ? INLINE_HEIGHT : 56),
253
+ ...(inline ? { width: INLINE_WIDTH, flex: 'none' } : null),
254
+ ...style,
255
+ },
256
+ children: (_jsxs(_Fragment, { children: [filled && line ? (_jsx("path", { d: `${line} L${GRID_WIDTH} ${GRID_HEIGHT} L0 ${GRID_HEIGHT} Z`, fill: "var(--pu-color)", opacity: "0.12" })) : null, _jsx("path", { d: line, fill: "none", stroke: "var(--pu-color)", strokeWidth: strokeWidth, strokeLinecap: "round", strokeLinejoin: "round",
257
+ // The grid is stretched to the chart's size. Without this the line
258
+ // would be stretched with it, thick across and thin up and down.
259
+ vectorEffect: "non-scaling-stroke" })] })),
260
+ }, props),
261
+ });
206
262
  }
207
263
  KpiChart.displayName = 'Kpi.Chart';
208
264
  /** Progress towards a target, under the number. */
209
- function KpiProgress({ value, maxValue = 100, label, showValueLabel = false, color = 'primary', className, ...props }) {
265
+ function KpiProgress({ value, maxValue = 100, label, showValueLabel = false, color = 'primary', className, render, ...props }) {
210
266
  const slots = kpiVariants({ color });
211
267
  const share = Math.min(1, Math.max(0, maxValue === 0 ? 0 : value / maxValue));
212
268
  const percent = Math.round(share * 100);
213
- return (_jsxs("div", { className: slots.progress({ className }), ...props, children: [label !== undefined || showValueLabel ? (_jsxs("div", { className: slots.progressHeader(), children: [_jsx("span", { className: "font-medium", children: label }), showValueLabel ? _jsxs("span", { className: "text-muted-foreground", children: [percent, "%"] }) : null] })) : null, _jsx("div", { role: "progressbar", "aria-valuemin": 0, "aria-valuemax": maxValue, "aria-valuenow": value, "aria-label": typeof label === 'string' ? label : 'Progress', className: slots.progressTrack(), children: _jsx("div", { className: slots.progressFill(), style: { width: `${percent}%` } }) })] }));
269
+ return useRender({
270
+ defaultTagName: 'div',
271
+ render,
272
+ props: mergeProps({
273
+ className: slots.progress({ className }),
274
+ children: (_jsxs(_Fragment, { children: [label !== undefined || showValueLabel ? (_jsxs("div", { className: slots.progressHeader(), children: [_jsx("span", { className: "font-medium", children: label }), showValueLabel ? _jsxs("span", { className: "text-muted-foreground", children: [percent, "%"] }) : null] })) : null, _jsx("div", { role: "progressbar", "aria-valuemin": 0, "aria-valuemax": maxValue, "aria-valuenow": value, "aria-label": typeof label === 'string' ? label : 'Progress', className: slots.progressTrack(), children: _jsx("div", { className: slots.progressFill(), style: { width: `${percent}%` } }) })] })),
275
+ }, props),
276
+ });
214
277
  }
215
278
  KpiProgress.displayName = 'Kpi.Progress';
216
279
  /** A quiet line under everything: when it was measured, how long is left. */
217
- function KpiFooter({ className, ...props }) {
218
- return _jsx("div", { className: kpiVariants().footer({ className }), ...props });
280
+ function KpiFooter({ className, render, ...props }) {
281
+ return useRender({
282
+ defaultTagName: 'div',
283
+ render,
284
+ props: mergeProps({ className: kpiVariants().footer({ className }) }, props),
285
+ });
219
286
  }
220
287
  KpiFooter.displayName = 'Kpi.Footer';
221
288
  /** A rule between two parts of one card. */
222
- function KpiSeparator({ className, ...props }) {
223
- return _jsx("div", { role: "separator", className: kpiVariants().separator({ className }), ...props });
289
+ function KpiSeparator({ className, render, ...props }) {
290
+ return useRender({
291
+ defaultTagName: 'div',
292
+ render,
293
+ props: mergeProps({ role: 'separator', className: kpiVariants().separator({ className }) }, props),
294
+ });
224
295
  }
225
296
  KpiSeparator.displayName = 'Kpi.Separator';
226
297
  /** Several metrics as one panel, with a rule between each and the next. */
227
- function KpiGroup({ orientation = 'horizontal', surface = false, className, ...props }) {
228
- return _jsx("div", { className: kpiVariants({ orientation, surface }).group({ className }), ...props });
298
+ function KpiGroup({ orientation = 'horizontal', surface = false, className, render, ...props }) {
299
+ return useRender({
300
+ defaultTagName: 'div',
301
+ render,
302
+ props: mergeProps({ className: kpiVariants({ orientation, surface }).group({ className }) }, props),
303
+ });
229
304
  }
230
305
  KpiGroup.displayName = 'Kpi.Group';
231
306
  export const Kpi = Object.assign(KpiRoot, {
@@ -33,6 +33,12 @@
33
33
  * through context, so a label has no client JavaScript of its own.
34
34
  */
35
35
  import type { ComponentProps } from 'react';
36
+ import { useRender } from '@base-ui/react/use-render';
37
+ import type { ElementType as RenderElementType } from 'react';
38
+ /** Draws a part as another element, or composes it with a component: `render={<a href="/" />}`. */
39
+ type RenderProp<Tag extends RenderElementType> = {
40
+ render?: useRender.ComponentProps<Tag>['render'];
41
+ };
36
42
  export interface LabelProps extends ComponentProps<'label'> {
37
43
  /**
38
44
  * Marks the field as one that must be filled. The mark is for the eye; set
@@ -53,14 +59,14 @@ export interface LabelProps extends ComponentProps<'label'> {
53
59
  * The label element. A string child is the label's text; for more, compose
54
60
  * `Label.Text`, `Label.Hint` and `Label.Action`.
55
61
  */
56
- declare function LabelRoot({ required, optional, invalid, disabled, className, children, ...props }: LabelProps): import("react").JSX.Element;
62
+ declare function LabelRoot({ required, optional, invalid, disabled, className, children, render, ...props }: LabelProps & RenderProp<'label'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
57
63
  declare namespace LabelRoot {
58
64
  var displayName: string;
59
65
  }
60
66
  export interface LabelTextProps extends ComponentProps<'span'> {
61
67
  }
62
68
  /** The field's name. It truncates rather than pushing the action off the line. */
63
- declare function LabelText({ className, children, ...props }: LabelTextProps): import("react").JSX.Element;
69
+ declare function LabelText({ className, children, render, ...props }: LabelTextProps & RenderProp<'span'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
64
70
  declare namespace LabelText {
65
71
  var displayName: string;
66
72
  }
@@ -70,14 +76,14 @@ export interface LabelHintProps extends ComponentProps<'span'> {
70
76
  * A quieter word or two after the name: a limit, a format, a unit. On an
71
77
  * invalid field it takes the destructive colour, so it can say what is wrong.
72
78
  */
73
- declare function LabelHint({ className, ...props }: LabelHintProps): import("react").JSX.Element;
79
+ declare function LabelHint({ className, render, ...props }: LabelHintProps & RenderProp<'span'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
74
80
  declare namespace LabelHint {
75
81
  var displayName: string;
76
82
  }
77
83
  export interface LabelActionProps extends ComponentProps<'span'> {
78
84
  }
79
85
  /** Pushed to the far end of the line: a link, a count, a small button. */
80
- declare function LabelAction({ className, ...props }: LabelActionProps): import("react").JSX.Element;
86
+ declare function LabelAction({ className, render, ...props }: LabelActionProps & RenderProp<'span'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
81
87
  declare namespace LabelAction {
82
88
  var displayName: string;
83
89
  }
@@ -1,5 +1,8 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { tv } from 'tailwind-variants';
4
+ import { mergeProps } from '@base-ui/react/merge-props';
5
+ import { useRender } from '@base-ui/react/use-render';
3
6
  const labelVariants = tv({
4
7
  slots: {
5
8
  root: [
@@ -31,29 +34,56 @@ const labelVariants = tv({
31
34
  * The label element. A string child is the label's text; for more, compose
32
35
  * `Label.Text`, `Label.Hint` and `Label.Action`.
33
36
  */
34
- function LabelRoot({ required = false, optional = false, invalid = false, disabled = false, className, children, ...props }) {
37
+ function LabelRoot({ required = false, optional = false, invalid = false, disabled = false, className, children, render, ...props }) {
35
38
  const slots = labelVariants();
36
39
  const plain = typeof children === 'string' || typeof children === 'number';
37
- return (_jsxs("label", { "data-slot": "label", "data-required": required ? '' : undefined, "data-invalid": invalid ? '' : undefined, "data-disabled": disabled ? '' : undefined, className: slots.root({ className }), ...props, children: [plain ? _jsx(LabelText, { children: children }) : children, optional ? _jsx(LabelHint, { children: "Optional" }) : null] }));
40
+ return useRender({
41
+ defaultTagName: 'label',
42
+ render,
43
+ props: mergeProps({
44
+ 'data-slot': 'label',
45
+ 'data-required': required ? '' : undefined,
46
+ 'data-invalid': invalid ? '' : undefined,
47
+ 'data-disabled': disabled ? '' : undefined,
48
+ className: slots.root({ className }),
49
+ children: (_jsxs(_Fragment, { children: [plain ? _jsx(LabelText, { children: children }) : children, optional ? _jsx(LabelHint, { children: "Optional" }) : null] })),
50
+ }, props),
51
+ });
38
52
  }
39
53
  LabelRoot.displayName = 'Label';
40
54
  /** The field's name. It truncates rather than pushing the action off the line. */
41
- function LabelText({ className, children, ...props }) {
55
+ function LabelText({ className, children, render, ...props }) {
42
56
  const slots = labelVariants();
43
- return (_jsx("span", { "data-slot": "label-text", className: slots.text({ className }), ...props, children: _jsx("span", { className: slots.textInner(), children: children }) }));
57
+ return useRender({
58
+ defaultTagName: 'span',
59
+ render,
60
+ props: mergeProps({
61
+ 'data-slot': 'label-text',
62
+ className: slots.text({ className }),
63
+ children: (_jsx(_Fragment, { children: _jsx("span", { className: slots.textInner(), children: children }) })),
64
+ }, props),
65
+ });
44
66
  }
45
67
  LabelText.displayName = 'Label.Text';
46
68
  /**
47
69
  * A quieter word or two after the name: a limit, a format, a unit. On an
48
70
  * invalid field it takes the destructive colour, so it can say what is wrong.
49
71
  */
50
- function LabelHint({ className, ...props }) {
51
- return _jsx("span", { "data-slot": "label-hint", className: labelVariants().hint({ className }), ...props });
72
+ function LabelHint({ className, render, ...props }) {
73
+ return useRender({
74
+ defaultTagName: 'span',
75
+ render,
76
+ props: mergeProps({ 'data-slot': 'label-hint', className: labelVariants().hint({ className }) }, props),
77
+ });
52
78
  }
53
79
  LabelHint.displayName = 'Label.Hint';
54
80
  /** Pushed to the far end of the line: a link, a count, a small button. */
55
- function LabelAction({ className, ...props }) {
56
- return _jsx("span", { "data-slot": "label-action", className: labelVariants().action({ className }), ...props });
81
+ function LabelAction({ className, render, ...props }) {
82
+ return useRender({
83
+ defaultTagName: 'span',
84
+ render,
85
+ props: mergeProps({ 'data-slot': 'label-action', className: labelVariants().action({ className }) }, props),
86
+ });
57
87
  }
58
88
  LabelAction.displayName = 'Label.Action';
59
89
  export const Label = Object.assign(LabelRoot, {
@@ -1,4 +1,10 @@
1
1
  import { type ComponentProps, type ReactNode } from 'react';
2
+ import { useRender } from '@base-ui/react/use-render';
3
+ import type { ElementType as RenderElementType } from 'react';
4
+ /** Draws a part as another element, or composes it with a component: `render={<a href="/" />}`. */
5
+ type RenderProp<Tag extends RenderElementType> = {
6
+ render?: useRender.ComponentProps<Tag>['render'];
7
+ };
2
8
  /** Which of the theme's roles a part is drawn in. */
3
9
  export type LaneBoardColor = 'primary' | 'info' | 'success' | 'warning' | 'destructive';
4
10
  /** A card is anything with an id that is its own across the whole board. */
@@ -58,28 +64,28 @@ export interface LaneBoardProps<T extends LaneBoardCard> extends Omit<ComponentP
58
64
  */
59
65
  height?: number | string;
60
66
  }
61
- declare function LaneBoardRoot<T extends LaneBoardCard>({ lanes: controlled, defaultLanes, onLanesChange, onMove, renderCard, renderLaneFooter, cardName, label, height, className, style, ...props }: LaneBoardProps<T>): import("react").JSX.Element;
67
+ declare function LaneBoardRoot<T extends LaneBoardCard>({ lanes: controlled, defaultLanes, onLanesChange, onMove, renderCard, renderLaneFooter, cardName, label, height, className, style, render, ...props }: LaneBoardProps<T> & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
62
68
  declare namespace LaneBoardRoot {
63
69
  var displayName: string;
64
70
  }
65
71
  export interface LaneBoardTitleProps extends ComponentProps<'div'> {
66
72
  }
67
73
  /** A card's name. */
68
- declare function LaneBoardTitle({ className, ...props }: LaneBoardTitleProps): import("react").JSX.Element;
74
+ declare function LaneBoardTitle({ className, render, ...props }: LaneBoardTitleProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
69
75
  declare namespace LaneBoardTitle {
70
76
  var displayName: string;
71
77
  }
72
78
  export interface LaneBoardCodeProps extends ComponentProps<'div'> {
73
79
  }
74
80
  /** A card's reference, in a fixed-width face so a column of them lines up. */
75
- declare function LaneBoardCode({ className, ...props }: LaneBoardCodeProps): import("react").JSX.Element;
81
+ declare function LaneBoardCode({ className, render, ...props }: LaneBoardCodeProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
76
82
  declare namespace LaneBoardCode {
77
83
  var displayName: string;
78
84
  }
79
85
  export interface LaneBoardRowProps extends ComponentProps<'div'> {
80
86
  }
81
87
  /** The last line of a card: something at each end. */
82
- declare function LaneBoardRow({ className, ...props }: LaneBoardRowProps): import("react").JSX.Element;
88
+ declare function LaneBoardRow({ className, render, ...props }: LaneBoardRowProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
83
89
  declare namespace LaneBoardRow {
84
90
  var displayName: string;
85
91
  }
@@ -94,7 +100,7 @@ export interface LaneBoardStepsProps extends Omit<ComponentProps<'div'>, 'childr
94
100
  label?: string;
95
101
  }
96
102
  /** How far along a card is, as a row of dashes with the done ones lit. */
97
- declare function LaneBoardSteps({ value, max, color, label, className, ...props }: LaneBoardStepsProps): import("react").JSX.Element;
103
+ declare function LaneBoardSteps({ value, max, color, label, className, render, ...props }: LaneBoardStepsProps & RenderProp<'div'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
98
104
  declare namespace LaneBoardSteps {
99
105
  var displayName: string;
100
106
  }
@@ -103,21 +109,21 @@ export interface LaneBoardTagProps extends Omit<ComponentProps<'span'>, 'color'>
103
109
  color?: LaneBoardColor;
104
110
  }
105
111
  /** A word in a pill, for a card's state. */
106
- declare function LaneBoardTag({ color, className, ...props }: LaneBoardTagProps): import("react").JSX.Element;
112
+ declare function LaneBoardTag({ color, className, render, ...props }: LaneBoardTagProps & RenderProp<'span'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
107
113
  declare namespace LaneBoardTag {
108
114
  var displayName: string;
109
115
  }
110
116
  export interface LaneBoardMetaProps extends ComponentProps<'span'> {
111
117
  }
112
118
  /** A short figure at the end of a card's last line: a time, a count. */
113
- declare function LaneBoardMeta({ className, ...props }: LaneBoardMetaProps): import("react").JSX.Element;
119
+ declare function LaneBoardMeta({ className, render, ...props }: LaneBoardMetaProps & RenderProp<'span'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
114
120
  declare namespace LaneBoardMeta {
115
121
  var displayName: string;
116
122
  }
117
123
  export interface LaneBoardAvatarProps extends ComponentProps<'span'> {
118
124
  }
119
125
  /** Who a card belongs to, as initials in a small circle. */
120
- declare function LaneBoardAvatar({ className, ...props }: LaneBoardAvatarProps): import("react").JSX.Element;
126
+ declare function LaneBoardAvatar({ className, render, ...props }: LaneBoardAvatarProps & RenderProp<'span'>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
121
127
  declare namespace LaneBoardAvatar {
122
128
  var displayName: string;
123
129
  }
@@ -130,4 +136,4 @@ export declare const LaneBoard: typeof LaneBoardRoot & {
130
136
  Meta: typeof LaneBoardMeta;
131
137
  Avatar: typeof LaneBoardAvatar;
132
138
  };
133
- export { LaneBoardTitle, LaneBoardCode, LaneBoardRow, LaneBoardSteps, LaneBoardTag, LaneBoardMeta, LaneBoardAvatar, };
139
+ export { LaneBoardTitle, LaneBoardCode, LaneBoardRow, LaneBoardSteps, LaneBoardTag, LaneBoardMeta, LaneBoardAvatar };