@alexgorbatchev/shadcn 0.0.153 → 0.0.155
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/{chunk-9e1yb90r.js → chunk-5ez5vgkn.js} +2 -2
- package/dist/{chunk-9tyf36w5.js → chunk-dthve8hk.js} +1 -1
- package/dist/{chunk-4dsv0qwt.js → chunk-g2amqz9q.js} +24 -19
- package/dist/{chunk-ncskzkqr.js → chunk-hbhpnc1m.js} +1 -1
- package/dist/{chunk-fbajrfv6.js → chunk-j6mh013a.js} +2 -2
- package/dist/{chunk-32ah7jyp.js → chunk-pbyj8rja.js} +1 -1
- package/dist/{chunk-0kbbxpsq.js → chunk-saftvg12.js} +1 -1
- package/dist/{chunk-5q0670jv.js → chunk-tgkc06q4.js} +1 -1
- package/dist/{chunk-ywr2pqhc.js → chunk-xndv627n.js} +1 -1
- package/dist/components/Field.d.ts +5 -2
- package/dist/components/assistant-ui/elements/EditMessage.js +2 -2
- package/dist/components/assistant-ui/elements/ElicitationForm.js +2 -2
- package/dist/components/assistant-ui/elements/FeedbackDialog.js +3 -3
- package/dist/components/assistant-ui/elements/MessageActions.js +2 -2
- package/dist/components/assistant-ui/elements/ModelPicker.js +2 -2
- package/dist/components/assistant-ui/elements/ReasoningEffort.js +2 -2
- package/dist/components/assistant-ui/index.js +8 -8
- package/dist/components/event-calendar/index.js +1 -1
- package/dist/components/image-viewer/index.js +2 -2
- package/dist/components/input-otp/index.js +1 -1
- package/dist/components/json-render/index.js +3 -3
- package/dist/components/text-diff/index.js +5 -4
- package/dist/components/tree/Tree.d.ts +3 -1
- package/dist/components/tree/TreeItem.d.ts +3 -1
- package/dist/components/tree/TreeSelect.d.ts +3 -1
- package/dist/components/tree/index.js +19 -7
- package/dist/index.js +3 -3
- package/dist/prototype.js +1 -1
- package/llms/components/actions/ToggleGroup.md +16 -0
- package/llms/components/data-display/Item.md +19 -0
- package/llms/components/navigation/TreeSelect.md +10 -0
- package/llms/components/overlays/FormDialog.md +8 -0
- package/package.json +1 -1
|
@@ -50,13 +50,13 @@ var fieldVariants = cva("group/field flex w-full gap-2 data-[invalid=true]:text-
|
|
|
50
50
|
orientation: "vertical"
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
|
-
function Field2({ density, className, orientation = "vertical", ...props }) {
|
|
53
|
+
function Field2({ density, className, orientation = "vertical", grow = false, ...props }) {
|
|
54
54
|
return /* @__PURE__ */ jsx("div", {
|
|
55
55
|
role: "group",
|
|
56
56
|
"data-density": density,
|
|
57
57
|
"data-slot": "field",
|
|
58
58
|
"data-orientation": orientation,
|
|
59
|
-
className: cn2(fieldVariants({ orientation }), className),
|
|
59
|
+
className: cn2(fieldVariants({ orientation }), grow && "min-h-0 flex-1", className),
|
|
60
60
|
...props
|
|
61
61
|
});
|
|
62
62
|
}
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
Field2,
|
|
72
72
|
FieldLabel2,
|
|
73
73
|
FieldDescription2
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-5ez5vgkn.js";
|
|
75
75
|
import {
|
|
76
76
|
Textarea2
|
|
77
77
|
} from "./chunk-p51p95er.js";
|
|
@@ -348,20 +348,25 @@ function FormDialog2({
|
|
|
348
348
|
error,
|
|
349
349
|
children
|
|
350
350
|
}) {
|
|
351
|
+
const isFullscreen = size === "fullscreen";
|
|
351
352
|
const body = /* @__PURE__ */ jsxs2(Fragment, {
|
|
352
353
|
children: [
|
|
353
|
-
/* @__PURE__ */
|
|
354
|
+
/* @__PURE__ */ jsx4(ScrollArea2, {
|
|
354
355
|
density,
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
356
|
+
grow: isFullscreen,
|
|
357
|
+
children: /* @__PURE__ */ jsxs2("div", {
|
|
358
|
+
className: cn2("flex flex-col gap-panel", isFullscreen && "min-h-full"),
|
|
359
|
+
children: [
|
|
360
|
+
children,
|
|
361
|
+
error && /* @__PURE__ */ jsx4(Alert2, {
|
|
362
|
+
variant: "destructive",
|
|
363
|
+
density,
|
|
364
|
+
children: /* @__PURE__ */ jsx4(AlertDescription2, {
|
|
365
|
+
children: error
|
|
366
|
+
})
|
|
362
367
|
})
|
|
363
|
-
|
|
364
|
-
|
|
368
|
+
]
|
|
369
|
+
})
|
|
365
370
|
}),
|
|
366
371
|
/* @__PURE__ */ jsxs2(DialogFooter2, {
|
|
367
372
|
density,
|
|
@@ -411,7 +416,7 @@ function FormDialog2({
|
|
|
411
416
|
]
|
|
412
417
|
}),
|
|
413
418
|
onSubmit ? /* @__PURE__ */ jsx4("form", {
|
|
414
|
-
className: "flex min-h-0 flex-col gap-panel",
|
|
419
|
+
className: cn2("flex min-h-0 flex-col gap-panel", isFullscreen && "flex-1"),
|
|
415
420
|
onSubmit: (event) => {
|
|
416
421
|
if (isBusy)
|
|
417
422
|
event.preventDefault();
|
|
@@ -1680,7 +1685,7 @@ function BreadcrumbLink2({ analytics, density, className, render, ...props }) {
|
|
|
1680
1685
|
return useRender3({
|
|
1681
1686
|
defaultTagName: "a",
|
|
1682
1687
|
props: mergeProps3({
|
|
1683
|
-
className: cn2("transition-colors hover:text-foreground", className)
|
|
1688
|
+
className: cn2("inline-block cursor-pointer rounded-xs border-b border-input px-0.5 -mx-0.5 leading-6 transition-colors outline-none hover:border-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring", className)
|
|
1684
1689
|
}, { ...props, onClick }),
|
|
1685
1690
|
render,
|
|
1686
1691
|
state: {
|
|
@@ -1696,7 +1701,7 @@ function BreadcrumbPage2({ density, className, ...props }) {
|
|
|
1696
1701
|
role: "link",
|
|
1697
1702
|
"aria-disabled": "true",
|
|
1698
1703
|
"aria-current": "page",
|
|
1699
|
-
className: cn2("font-normal text-foreground", className),
|
|
1704
|
+
className: cn2("inline-block border-b border-transparent leading-6 font-normal text-foreground", className),
|
|
1700
1705
|
...props
|
|
1701
1706
|
});
|
|
1702
1707
|
}
|
|
@@ -1867,11 +1872,11 @@ function ItemSeparator2({ density, className, ...props }) {
|
|
|
1867
1872
|
...props
|
|
1868
1873
|
});
|
|
1869
1874
|
}
|
|
1870
|
-
var itemVariants = cva2("group/item flex w-full flex-wrap items-center rounded-sm border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring [a]:transition-colors [a]:hover:bg-muted", {
|
|
1875
|
+
var itemVariants = cva2("group/item flex w-full flex-wrap items-center rounded-sm border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring [&:is(a,button)]:cursor-pointer [&:is(a,button)]:transition-colors [&:is(a,button)]:hover:bg-muted aria-[current=true]:border-primary aria-[current=true]:bg-muted/60", {
|
|
1871
1876
|
variants: {
|
|
1872
1877
|
variant: {
|
|
1873
1878
|
default: "border-transparent",
|
|
1874
|
-
outline: "border-border",
|
|
1879
|
+
outline: "border-border [&:is(button)]:border-input",
|
|
1875
1880
|
muted: "border-transparent bg-muted/50"
|
|
1876
1881
|
},
|
|
1877
1882
|
size: {
|
|
@@ -1907,7 +1912,7 @@ function Item2({
|
|
|
1907
1912
|
}
|
|
1908
1913
|
});
|
|
1909
1914
|
}
|
|
1910
|
-
var itemMediaVariants = cva2("flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none", {
|
|
1915
|
+
var itemMediaVariants = cva2("flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&:last-child:not(:first-child)]:translate-y-0 [&:last-child:not(:first-child)]:self-center [&_svg]:pointer-events-none", {
|
|
1911
1916
|
variants: {
|
|
1912
1917
|
variant: {
|
|
1913
1918
|
default: "bg-transparent",
|
|
@@ -4308,8 +4313,8 @@ function ReadMore2({ maxHeight, density, className, style, children, ...props })
|
|
|
4308
4313
|
}),
|
|
4309
4314
|
isOverflowing && isFolded && /* @__PURE__ */ jsx41(Button2, {
|
|
4310
4315
|
type: "button",
|
|
4311
|
-
variant: "
|
|
4312
|
-
size: "
|
|
4316
|
+
variant: "outline",
|
|
4317
|
+
size: "xs",
|
|
4313
4318
|
"data-slot": "read-more-toggle",
|
|
4314
4319
|
"aria-expanded": false,
|
|
4315
4320
|
"aria-controls": `${id}-content`,
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
Field2,
|
|
14
14
|
FieldLabel2
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5ez5vgkn.js";
|
|
16
16
|
import {
|
|
17
17
|
Textarea2
|
|
18
18
|
} from "./chunk-p51p95er.js";
|
|
19
19
|
import {
|
|
20
20
|
ToggleGroup2,
|
|
21
21
|
ToggleGroupItem2
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-pbyj8rja.js";
|
|
23
23
|
|
|
24
24
|
// src/components/assistant-ui/elements/FeedbackDialog.tsx
|
|
25
25
|
import { useId } from "react";
|
|
@@ -79,7 +79,7 @@ function ToggleGroup2({
|
|
|
79
79
|
gap: `calc(var(--spacing) * ${spacing})`,
|
|
80
80
|
...typeof style === "function" ? style(state) : style
|
|
81
81
|
}),
|
|
82
|
-
className: (state) => cn2("group/toggle-group flex w-fit flex-row items-center rounded-sm data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch", layout === "fill" && "w-full", typeof className === "function" ? className(state) : className),
|
|
82
|
+
className: (state) => cn2("group/toggle-group flex w-fit flex-row items-center rounded-sm data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch", layout === "fill" ? "w-full" : spacing > 0 && orientation === "horizontal" && "max-w-full flex-wrap", typeof className === "function" ? className(state) : className),
|
|
83
83
|
...props,
|
|
84
84
|
onValueChange: (value, details) => {
|
|
85
85
|
if (required && value.length === 0) {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
ToggleGroup2,
|
|
6
6
|
ToggleGroupItem2
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-pbyj8rja.js";
|
|
8
8
|
|
|
9
9
|
// src/components/assistant-ui/elements/MessageActions.tsx
|
|
10
10
|
import { CheckIcon, CopyIcon, EllipsisIcon, RefreshCwIcon, ThumbsDownIcon, ThumbsUpIcon } from "lucide-react";
|
|
@@ -15,8 +15,11 @@ declare function FieldGroup({ density, className, columns, ...props }: FieldGrou
|
|
|
15
15
|
declare const fieldVariants: (props?: ({
|
|
16
16
|
orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
|
|
17
17
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
18
|
-
type FieldProps = ComponentProps<"div"> & VariantProps<typeof fieldVariants> & IDensityProps
|
|
19
|
-
|
|
18
|
+
type FieldProps = ComponentProps<"div"> & VariantProps<typeof fieldVariants> & IDensityProps & {
|
|
19
|
+
/** Stretch inside a flex container (for example, a fullscreen FormDialog holding a growing picker). */
|
|
20
|
+
grow?: boolean;
|
|
21
|
+
};
|
|
22
|
+
declare function Field({ density, className, orientation, grow, ...props }: FieldProps): ReactElement;
|
|
20
23
|
type FieldContentProps = ComponentProps<"div"> & IDensityProps;
|
|
21
24
|
declare function FieldContent({ density, className, ...props }: FieldContentProps): ReactElement;
|
|
22
25
|
type FieldLabelProps = ComponentProps<typeof Label> & IDensityProps & {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EditMessage2
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-tgkc06q4.js";
|
|
4
4
|
import"../../../chunk-vxvaaptq.js";
|
|
5
|
-
import"../../../chunk-
|
|
5
|
+
import"../../../chunk-5ez5vgkn.js";
|
|
6
6
|
import"../../../chunk-jc3cbwyg.js";
|
|
7
7
|
import"../../../chunk-4m2x9jfb.js";
|
|
8
8
|
import"../../../chunk-p51p95er.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ElicitationForm2
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-hbhpnc1m.js";
|
|
4
4
|
import"../../../chunk-vxvaaptq.js";
|
|
5
5
|
import"../../../chunk-kgqe8gpb.js";
|
|
6
6
|
import"../../../chunk-m98d89xc.js";
|
|
7
|
-
import"../../../chunk-
|
|
7
|
+
import"../../../chunk-5ez5vgkn.js";
|
|
8
8
|
import"../../../chunk-jc3cbwyg.js";
|
|
9
9
|
import"../../../chunk-4m2x9jfb.js";
|
|
10
10
|
import"../../../chunk-7vg045gd.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FeedbackDialog2
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import"../../../chunk-
|
|
5
|
-
import"../../../chunk-
|
|
3
|
+
} from "../../../chunk-j6mh013a.js";
|
|
4
|
+
import"../../../chunk-pbyj8rja.js";
|
|
5
|
+
import"../../../chunk-5ez5vgkn.js";
|
|
6
6
|
import"../../../chunk-jc3cbwyg.js";
|
|
7
7
|
import"../../../chunk-4m2x9jfb.js";
|
|
8
8
|
import"../../../chunk-p51p95er.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MessageActions2
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import"../../../chunk-
|
|
3
|
+
} from "../../../chunk-saftvg12.js";
|
|
4
|
+
import"../../../chunk-pbyj8rja.js";
|
|
5
5
|
import"../../../chunk-2sx8m8b2.js";
|
|
6
6
|
import"../../../chunk-x90xmrba.js";
|
|
7
7
|
import"../../../chunk-jpvw9xqy.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ModelPicker2
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-xndv627n.js";
|
|
4
4
|
import"../../../chunk-kgqe8gpb.js";
|
|
5
|
-
import"../../../chunk-
|
|
5
|
+
import"../../../chunk-5ez5vgkn.js";
|
|
6
6
|
import"../../../chunk-jc3cbwyg.js";
|
|
7
7
|
import"../../../chunk-dbe9ppwf.js";
|
|
8
8
|
import"../../../chunk-4m2x9jfb.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ReasoningEffort2
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import"../../../chunk-
|
|
3
|
+
} from "../../../chunk-dthve8hk.js";
|
|
4
|
+
import"../../../chunk-pbyj8rja.js";
|
|
5
5
|
import"../../../chunk-bcwbh20z.js";
|
|
6
6
|
import"../../../chunk-5mydsjp3.js";
|
|
7
7
|
import"../../../chunk-8ssktt4b.js";
|
|
@@ -226,15 +226,15 @@ import {
|
|
|
226
226
|
} from "../../chunk-fvxzrt3b.js";
|
|
227
227
|
import"../../chunk-4m2x9jfb.js";
|
|
228
228
|
import"../../chunk-52aadmkc.js";
|
|
229
|
-
import"../../chunk-
|
|
229
|
+
import"../../chunk-5ez5vgkn.js";
|
|
230
230
|
import {
|
|
231
231
|
EditMessage2
|
|
232
|
-
} from "../../chunk-
|
|
232
|
+
} from "../../chunk-tgkc06q4.js";
|
|
233
233
|
import"../../chunk-kgqe8gpb.js";
|
|
234
234
|
import"../../chunk-m98d89xc.js";
|
|
235
235
|
import {
|
|
236
236
|
ElicitationForm2
|
|
237
|
-
} from "../../chunk-
|
|
237
|
+
} from "../../chunk-hbhpnc1m.js";
|
|
238
238
|
import"../../chunk-4e96tpw0.js";
|
|
239
239
|
import {
|
|
240
240
|
EmptyState2
|
|
@@ -259,10 +259,10 @@ import"../../chunk-ctp5jhpj.js";
|
|
|
259
259
|
import {
|
|
260
260
|
EveAskQuestion2
|
|
261
261
|
} from "../../chunk-1m0afwnr.js";
|
|
262
|
-
import"../../chunk-
|
|
262
|
+
import"../../chunk-pbyj8rja.js";
|
|
263
263
|
import {
|
|
264
264
|
FeedbackDialog2
|
|
265
|
-
} from "../../chunk-
|
|
265
|
+
} from "../../chunk-j6mh013a.js";
|
|
266
266
|
import {
|
|
267
267
|
FileRoot2,
|
|
268
268
|
FileIconDisplay2,
|
|
@@ -352,7 +352,7 @@ import {
|
|
|
352
352
|
} from "../../chunk-40jpafh1.js";
|
|
353
353
|
import {
|
|
354
354
|
MessageActions2
|
|
355
|
-
} from "../../chunk-
|
|
355
|
+
} from "../../chunk-saftvg12.js";
|
|
356
356
|
import {
|
|
357
357
|
MessageAttachments2
|
|
358
358
|
} from "../../chunk-pp819k6p.js";
|
|
@@ -373,7 +373,7 @@ import {
|
|
|
373
373
|
} from "../../chunk-k872qrgx.js";
|
|
374
374
|
import {
|
|
375
375
|
ModelPicker2
|
|
376
|
-
} from "../../chunk-
|
|
376
|
+
} from "../../chunk-xndv627n.js";
|
|
377
377
|
import"../../chunk-kp3jgjng.js";
|
|
378
378
|
import {
|
|
379
379
|
ModelSelectorRoot2
|
|
@@ -462,7 +462,7 @@ import {
|
|
|
462
462
|
} from "../../chunk-x0p3g392.js";
|
|
463
463
|
import {
|
|
464
464
|
ReasoningEffort2
|
|
465
|
-
} from "../../chunk-
|
|
465
|
+
} from "../../chunk-dthve8hk.js";
|
|
466
466
|
import {
|
|
467
467
|
SwapLabel2
|
|
468
468
|
} from "../../chunk-39q6906v.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
Toggle2,
|
|
17
17
|
ToggleGroup2,
|
|
18
18
|
ToggleGroupItem2
|
|
19
|
-
} from "../../chunk-
|
|
19
|
+
} from "../../chunk-pbyj8rja.js";
|
|
20
20
|
import"../../chunk-4m2x9jfb.js";
|
|
21
21
|
import {
|
|
22
22
|
Separator2
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
FieldContent2,
|
|
27
27
|
FieldLabel2,
|
|
28
28
|
FieldDescription2
|
|
29
|
-
} from "../../chunk-
|
|
29
|
+
} from "../../chunk-5ez5vgkn.js";
|
|
30
30
|
import {
|
|
31
31
|
NumberField2,
|
|
32
32
|
NumberFieldGroup2,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
PaginationPrevious2,
|
|
27
27
|
PaginationNext2,
|
|
28
28
|
PaginationEllipsis2
|
|
29
|
-
} from "../../chunk-
|
|
29
|
+
} from "../../chunk-g2amqz9q.js";
|
|
30
30
|
import {
|
|
31
31
|
MenuPopup,
|
|
32
32
|
MenuItem2,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
import {
|
|
70
70
|
Field2,
|
|
71
71
|
FieldLabel2
|
|
72
|
-
} from "../../chunk-
|
|
72
|
+
} from "../../chunk-5ez5vgkn.js";
|
|
73
73
|
import {
|
|
74
74
|
Slider2
|
|
75
75
|
} from "../../chunk-7cq1s2ey.js";
|
|
@@ -124,7 +124,7 @@ import {
|
|
|
124
124
|
Toggle2,
|
|
125
125
|
ToggleGroup2,
|
|
126
126
|
ToggleGroupItem2
|
|
127
|
-
} from "../../chunk-
|
|
127
|
+
} from "../../chunk-pbyj8rja.js";
|
|
128
128
|
import {
|
|
129
129
|
Avatar2,
|
|
130
130
|
AvatarImage2,
|
|
@@ -126,7 +126,7 @@ function TextDiff({
|
|
|
126
126
|
children: [
|
|
127
127
|
/* @__PURE__ */ jsxs("div", {
|
|
128
128
|
"data-testid": "TextDiff--legend",
|
|
129
|
-
className: cn2("flex min-h-control-lg items-center
|
|
129
|
+
className: cn2("flex min-h-control-lg items-center border-b border-frame-edge text-xs font-medium tracking-wide text-muted-foreground", isSplit ? "[&>*]:w-1/2 [&>*:first-child]:border-e [&>*:first-child]:border-frame-edge [&>*:first-child]:ps-control-x [&>*:first-child]:pe-control-x [&>*:last-child]:px-control-x" : "gap-control-gap px-control-x"),
|
|
130
130
|
children: [
|
|
131
131
|
/* @__PURE__ */ jsx(SignLabel, {
|
|
132
132
|
sign: "-",
|
|
@@ -150,11 +150,12 @@ function TextDiff({
|
|
|
150
150
|
return /* @__PURE__ */ jsxs(Fragment, {
|
|
151
151
|
children: [
|
|
152
152
|
/* @__PURE__ */ jsx("div", {
|
|
153
|
-
|
|
153
|
+
"data-slot": "text-diff-fold",
|
|
154
|
+
className: "my-1 flex items-center border-y border-frame-edge bg-muted/40 px-control-x py-1 font-sans",
|
|
154
155
|
children: /* @__PURE__ */ jsx(Button2, {
|
|
155
156
|
type: "button",
|
|
156
|
-
variant: "
|
|
157
|
-
size: "
|
|
157
|
+
variant: "outline",
|
|
158
|
+
size: "xs",
|
|
158
159
|
"aria-expanded": isExpanded,
|
|
159
160
|
"aria-controls": regionId,
|
|
160
161
|
onClick: () => toggle(segment.start),
|
|
@@ -6,6 +6,8 @@ type TreeProps<T> = IAnalyticsProps & IDensityProps & {
|
|
|
6
6
|
tree: TreeInstance<T>;
|
|
7
7
|
label: string;
|
|
8
8
|
variant?: "default" | "sidebar";
|
|
9
|
+
/** Take remaining vertical space inside a flex parent while keeping rows packed from the top. */
|
|
10
|
+
grow?: boolean;
|
|
9
11
|
renderIcon?: (item: ItemInstance<T>) => ReactNode;
|
|
10
12
|
renderLabel?: (item: ItemInstance<T>) => ReactNode;
|
|
11
13
|
renderItem?: (item: ItemInstance<T>) => ReactNode;
|
|
@@ -14,6 +16,6 @@ type TreeProps<T> = IAnalyticsProps & IDensityProps & {
|
|
|
14
16
|
* Headless Tree owns navigation, selection, expansion, and optional pointer/keyboard drag and drop. The tree is one Tab
|
|
15
17
|
* stop: arrows move between items, and row controls stay out of the Tab order.
|
|
16
18
|
*/
|
|
17
|
-
declare function Tree<T>({ analytics, tree, label, variant, renderIcon, renderLabel, renderItem, density, }: TreeProps<T>): ReactElement;
|
|
19
|
+
declare function Tree<T>({ analytics, tree, label, variant, grow, renderIcon, renderLabel, renderItem, density, }: TreeProps<T>): ReactElement;
|
|
18
20
|
export { Tree };
|
|
19
21
|
export type { TreeProps };
|
|
@@ -27,6 +27,8 @@ type TreeItemProps<T> = useRender.ComponentProps<"div", TreeItemState> & IDensit
|
|
|
27
27
|
* never rests on colour.
|
|
28
28
|
*/
|
|
29
29
|
tone?: "default" | "warning";
|
|
30
|
+
/** Selected row highlight: `subtle` uses the neutral accent fill; `accent` adds a primary border for pickers. */
|
|
31
|
+
selectionStyle?: "subtle" | "accent";
|
|
30
32
|
endEnhancer?: ReactNode;
|
|
31
33
|
expandOn?: "click" | "doubleClick" | "disclosure";
|
|
32
34
|
isEditing?: boolean;
|
|
@@ -107,5 +109,5 @@ export declare function TreeItemDot({ count, className }: ITreeItemDotProps): Re
|
|
|
107
109
|
* Registered tree row; compose menus with render, put counts in `description` and pointer shortcuts in `actions`.
|
|
108
110
|
* `endEnhancer` holds controls that must stay keyboard reachable on their own.
|
|
109
111
|
*/
|
|
110
|
-
export declare function TreeItem<T>({ analytics, item, children, startEnhancer, endEnhancer, description, descriptionLabel, actions, expandOn, isEditing, isDropTarget, isDimmed, isUnread, hasIcon, tone, leading, marker, linkProps, dropHint, density, render, ref, ...props }: TreeItemProps<T>): ReactElement;
|
|
112
|
+
export declare function TreeItem<T>({ analytics, item, children, startEnhancer, endEnhancer, description, descriptionLabel, actions, expandOn, isEditing, isDropTarget, isDimmed, isUnread, hasIcon, tone, selectionStyle, leading, marker, linkProps, dropHint, density, render, ref, ...props }: TreeItemProps<T>): ReactElement;
|
|
111
113
|
export type { TreeItemProps };
|
|
@@ -24,6 +24,8 @@ export interface ITreeSelectProps {
|
|
|
24
24
|
currentLabel?: string | undefined;
|
|
25
25
|
/** Shown when the filter matches nothing; defaults to "No matches". */
|
|
26
26
|
emptyLabel?: string | undefined;
|
|
27
|
+
/** Stretch the destination list to fill remaining vertical space inside a flex parent. */
|
|
28
|
+
grow?: boolean | undefined;
|
|
27
29
|
isDisabled?: boolean | undefined;
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
@@ -32,4 +34,4 @@ export interface ITreeSelectProps {
|
|
|
32
34
|
* Space or a click chooses. The current place carries `currentLabel`, and places that cannot be chosen stay listed with
|
|
33
35
|
* their reason as the row's description.
|
|
34
36
|
*/
|
|
35
|
-
export declare function TreeSelect({ nodes, value, onValueChange, label, filterLabel, filterPlaceholder, currentId, currentLabel, emptyLabel, isDisabled, }: ITreeSelectProps): ReactElement;
|
|
37
|
+
export declare function TreeSelect({ nodes, value, onValueChange, label, filterLabel, filterPlaceholder, currentId, currentLabel, emptyLabel, grow, isDisabled, }: ITreeSelectProps): ReactElement;
|
|
@@ -120,6 +120,7 @@ function TreeItem({
|
|
|
120
120
|
isUnread = false,
|
|
121
121
|
hasIcon = true,
|
|
122
122
|
tone = "default",
|
|
123
|
+
selectionStyle = "subtle",
|
|
123
124
|
leading,
|
|
124
125
|
marker,
|
|
125
126
|
linkProps,
|
|
@@ -193,7 +194,7 @@ function TreeItem({
|
|
|
193
194
|
props: mergeProps({
|
|
194
195
|
...nativeProps,
|
|
195
196
|
ref: undefined,
|
|
196
|
-
className: cn2("flex min-w-0 flex-1 items-center gap-2 outline-none focus-visible:ring-2 focus-visible:ring-ring", faded),
|
|
197
|
+
className: cn2("flex min-w-0 flex-1 items-center gap-2 self-stretch -my-1 py-1 outline-none focus-visible:ring-2 focus-visible:ring-ring", faded),
|
|
197
198
|
children: label,
|
|
198
199
|
onFocus: () => item.setFocused(),
|
|
199
200
|
onClick: (event) => {
|
|
@@ -247,7 +248,7 @@ function TreeItem({
|
|
|
247
248
|
onDragStart: undefined
|
|
248
249
|
} : {},
|
|
249
250
|
style: { paddingInlineStart: `${item.getItemMeta().level * (item.getTree().getConfig().indent ?? 20) + 8}px` },
|
|
250
|
-
className: cn2("relative flex min-h-control min-w-0 cursor-default items-center gap-2 rounded-sm py-1 pr-2 text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring", (isSelected || isDropTarget || isInsideTarget) && "bg-accent text-accent-foreground", tone === "warning" && "before:pointer-events-none before:absolute before:inset-y-1 before:start-0 before:w-0.5 before:rounded-full before:bg-warning", isDimmed && "group/tree-item"),
|
|
251
|
+
className: cn2("relative flex min-h-control min-w-0 cursor-default items-center gap-2 rounded-sm border border-transparent py-1 pr-2 text-sm outline-none hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring", (isSelected || isDropTarget || isInsideTarget) && (selectionStyle === "accent" && isSelected ? "border-primary bg-muted/60 font-medium text-foreground" : "bg-accent text-accent-foreground"), tone === "warning" && "before:pointer-events-none before:absolute before:inset-y-1 before:start-0 before:w-0.5 before:rounded-full before:bg-warning", isDimmed && "group/tree-item"),
|
|
251
252
|
children: /* @__PURE__ */ jsxs(Fragment, {
|
|
252
253
|
children: [
|
|
253
254
|
item.isFolder() && expandOn === "disclosure" ? /* @__PURE__ */ jsx(Button2, {
|
|
@@ -363,6 +364,7 @@ function Tree({
|
|
|
363
364
|
tree,
|
|
364
365
|
label,
|
|
365
366
|
variant = "default",
|
|
367
|
+
grow = false,
|
|
366
368
|
renderIcon,
|
|
367
369
|
renderLabel,
|
|
368
370
|
renderItem,
|
|
@@ -378,7 +380,7 @@ function Tree({
|
|
|
378
380
|
children: /* @__PURE__ */ jsxs2("div", {
|
|
379
381
|
...container,
|
|
380
382
|
"data-density": density,
|
|
381
|
-
className: cn2("grid min-w-0 grid-cols-1 gap-1", variant === "default" && "rounded-sm border border-border bg-card p-2"),
|
|
383
|
+
className: cn2("grid min-w-0 grid-cols-1 gap-1", variant === "default" && "rounded-sm border border-border bg-card p-2", grow && "min-h-0 flex-1 content-start"),
|
|
382
384
|
onKeyDown: (event) => {
|
|
383
385
|
if (event.target instanceof Element && event.target.closest("input,textarea,select,form,button,[role=menu]"))
|
|
384
386
|
return;
|
|
@@ -2630,6 +2632,7 @@ var useTree = (config) => {
|
|
|
2630
2632
|
};
|
|
2631
2633
|
// src/components/tree/TreeSelect.tsx
|
|
2632
2634
|
import { useEffect as useEffect2, useId as useId2, useMemo, useState as useState2 } from "react";
|
|
2635
|
+
import { CheckIcon } from "lucide-react";
|
|
2633
2636
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2634
2637
|
var ROOT_ID = "tree-select-root";
|
|
2635
2638
|
function indexNodes(nodes, parentId, index) {
|
|
@@ -2662,6 +2665,7 @@ function TreeSelect({
|
|
|
2662
2665
|
currentId,
|
|
2663
2666
|
currentLabel = "Current location",
|
|
2664
2667
|
emptyLabel = "No matches",
|
|
2668
|
+
grow = false,
|
|
2665
2669
|
isDisabled = false
|
|
2666
2670
|
}) {
|
|
2667
2671
|
const filterId = useId2();
|
|
@@ -2714,7 +2718,7 @@ function TreeSelect({
|
|
|
2714
2718
|
return /* @__PURE__ */ jsxs3("div", {
|
|
2715
2719
|
"data-testid": "TreeSelect",
|
|
2716
2720
|
"data-slot": "tree-select",
|
|
2717
|
-
className: "flex min-w-0 flex-col gap-2",
|
|
2721
|
+
className: cn2("flex min-w-0 flex-col gap-2", grow && "min-h-0 flex-1"),
|
|
2718
2722
|
children: [
|
|
2719
2723
|
/* @__PURE__ */ jsx3(Input2, {
|
|
2720
2724
|
id: filterId,
|
|
@@ -2739,17 +2743,25 @@ function TreeSelect({
|
|
|
2739
2743
|
hasItems ? /* @__PURE__ */ jsx3(Tree, {
|
|
2740
2744
|
tree,
|
|
2741
2745
|
label,
|
|
2746
|
+
grow,
|
|
2742
2747
|
renderItem: (item) => {
|
|
2743
2748
|
const node = item.getItemData();
|
|
2744
|
-
const
|
|
2749
|
+
const isCurrent = node.id === currentId;
|
|
2750
|
+
const isChoice = node.id === value && !isCurrent && !node.disabledReason;
|
|
2751
|
+
const description = node.disabledReason ?? (isCurrent ? currentLabel : undefined);
|
|
2745
2752
|
return /* @__PURE__ */ jsx3(TreeItem, {
|
|
2746
2753
|
item,
|
|
2747
2754
|
expandOn: "disclosure",
|
|
2748
2755
|
hasIcon: false,
|
|
2756
|
+
selectionStyle: "accent",
|
|
2749
2757
|
description,
|
|
2750
|
-
|
|
2758
|
+
marker: isChoice ? /* @__PURE__ */ jsx3(CheckIcon, {
|
|
2759
|
+
"aria-hidden": "true",
|
|
2760
|
+
className: "size-3.5 text-primary"
|
|
2761
|
+
}) : undefined,
|
|
2762
|
+
isDimmed: Boolean(node.disabledReason) || isCurrent,
|
|
2751
2763
|
"aria-disabled": node.disabledReason || isDisabled ? true : undefined,
|
|
2752
|
-
"data-current":
|
|
2764
|
+
"data-current": isCurrent ? "" : undefined,
|
|
2753
2765
|
onKeyDown: (event) => {
|
|
2754
2766
|
if (event.key !== " ")
|
|
2755
2767
|
return;
|
package/dist/index.js
CHANGED
|
@@ -188,7 +188,7 @@ import {
|
|
|
188
188
|
DashboardLayout2,
|
|
189
189
|
BillingUsage2,
|
|
190
190
|
SelectionAction2
|
|
191
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-g2amqz9q.js";
|
|
192
192
|
import {
|
|
193
193
|
statusDotVariants2,
|
|
194
194
|
StatusDot2
|
|
@@ -301,7 +301,7 @@ import {
|
|
|
301
301
|
Toggle2,
|
|
302
302
|
ToggleGroup2,
|
|
303
303
|
ToggleGroupItem2
|
|
304
|
-
} from "./chunk-
|
|
304
|
+
} from "./chunk-pbyj8rja.js";
|
|
305
305
|
import {
|
|
306
306
|
Checkbox2
|
|
307
307
|
} from "./chunk-b5s5y5wq.js";
|
|
@@ -336,7 +336,7 @@ import {
|
|
|
336
336
|
FieldDescription2,
|
|
337
337
|
FieldSeparator2,
|
|
338
338
|
FieldError2
|
|
339
|
-
} from "./chunk-
|
|
339
|
+
} from "./chunk-5ez5vgkn.js";
|
|
340
340
|
import {
|
|
341
341
|
Spinner2
|
|
342
342
|
} from "./chunk-t3p4dn1p.js";
|
package/dist/prototype.js
CHANGED
|
@@ -2051,7 +2051,7 @@ var program = new Command;
|
|
|
2051
2051
|
// package.json
|
|
2052
2052
|
var package_default = {
|
|
2053
2053
|
name: "@alexgorbatchev/shadcn",
|
|
2054
|
-
version: "0.0.
|
|
2054
|
+
version: "0.0.155",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -233,3 +233,19 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
233
233
|
</DirectionProvider>)
|
|
234
234
|
}
|
|
235
235
|
```
|
|
236
|
+
|
|
237
|
+
### WrapsWhenNarrow
|
|
238
|
+
|
|
239
|
+
```tsx
|
|
240
|
+
{
|
|
241
|
+
args: { multiple: true, variant: "outline", spacing: 2, defaultValue: ["email"] },
|
|
242
|
+
render: (args) => (<div data-testid="narrow-toggle-container" className="w-44">
|
|
243
|
+
<ToggleGroup {...args}>
|
|
244
|
+
<ToggleGroupItem value="email">Email</ToggleGroupItem>
|
|
245
|
+
<ToggleGroupItem value="chat">Chat</ToggleGroupItem>
|
|
246
|
+
<ToggleGroupItem value="phone">Phone</ToggleGroupItem>
|
|
247
|
+
<ToggleGroupItem value="forum">Forum</ToggleGroupItem>
|
|
248
|
+
</ToggleGroup>
|
|
249
|
+
</div>)
|
|
250
|
+
}
|
|
251
|
+
```
|
|
@@ -530,6 +530,25 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
530
530
|
}
|
|
531
531
|
```
|
|
532
532
|
|
|
533
|
+
### InteractiveCurrent
|
|
534
|
+
|
|
535
|
+
```tsx
|
|
536
|
+
{
|
|
537
|
+
render: function Render() {
|
|
538
|
+
const [current, setCurrent] = useState("first");
|
|
539
|
+
return (<ItemGroup aria-label="Queue decisions">
|
|
540
|
+
{(["first", "second"] as const).map((id) => (<div key={id} role="listitem">
|
|
541
|
+
<Item size="xs" variant="outline" aria-current={current === id ? "true" : undefined} render={<button type="button" onClick={() => setCurrent(id)}/>}>
|
|
542
|
+
<ItemContent>
|
|
543
|
+
<ItemTitle>{id === "first" ? "First decision" : "Second decision"}</ItemTitle>
|
|
544
|
+
</ItemContent>
|
|
545
|
+
</Item>
|
|
546
|
+
</div>))}
|
|
547
|
+
</ItemGroup>);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
```
|
|
551
|
+
|
|
533
552
|
### InDropdown
|
|
534
553
|
|
|
535
554
|
```tsx
|
|
@@ -39,6 +39,16 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
39
39
|
{}
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
### GrowingHeight
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
{
|
|
46
|
+
render: () => (<div className="flex h-[500px] w-[360px] flex-col">
|
|
47
|
+
<TreeSelect nodes={destinations.slice(0, 1)} value="homepage" currentId="navigation" label="Destination" filterLabel="Filter places" filterPlaceholder="Filter places" grow onValueChange={choose}/>
|
|
48
|
+
</div>)
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
42
52
|
### FilterAndKeys
|
|
43
53
|
|
|
44
54
|
```tsx
|