@refraction-ui/react 0.12.0 → 0.12.2
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/index.cjs +85 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +85 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3368,6 +3368,65 @@ function useConversation(config) {
|
|
|
3368
3368
|
};
|
|
3369
3369
|
}
|
|
3370
3370
|
var h = React11.createElement;
|
|
3371
|
+
var svg = (children, size = 16) => h(
|
|
3372
|
+
"svg",
|
|
3373
|
+
{
|
|
3374
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3375
|
+
viewBox: "0 0 24 24",
|
|
3376
|
+
width: size,
|
|
3377
|
+
height: size,
|
|
3378
|
+
fill: "none",
|
|
3379
|
+
stroke: "currentColor",
|
|
3380
|
+
strokeWidth: 2,
|
|
3381
|
+
strokeLinecap: "round",
|
|
3382
|
+
strokeLinejoin: "round",
|
|
3383
|
+
"aria-hidden": true
|
|
3384
|
+
},
|
|
3385
|
+
children
|
|
3386
|
+
);
|
|
3387
|
+
var IconAttach = () => svg(h("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 17.93 8.81l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48" }));
|
|
3388
|
+
var IconBold = () => svg([
|
|
3389
|
+
h("path", { key: "a", d: "M6 4h8a4 4 0 0 1 0 8H6z" }),
|
|
3390
|
+
h("path", { key: "b", d: "M6 12h9a4 4 0 0 1 0 8H6z" })
|
|
3391
|
+
]);
|
|
3392
|
+
var IconItalic = () => svg([
|
|
3393
|
+
h("line", { key: "a", x1: 19, y1: 4, x2: 10, y2: 4 }),
|
|
3394
|
+
h("line", { key: "b", x1: 14, y1: 20, x2: 5, y2: 20 }),
|
|
3395
|
+
h("line", { key: "c", x1: 15, y1: 4, x2: 9, y2: 20 })
|
|
3396
|
+
]);
|
|
3397
|
+
var IconCode = () => svg([
|
|
3398
|
+
h("polyline", { key: "a", points: "16 18 22 12 16 6" }),
|
|
3399
|
+
h("polyline", { key: "b", points: "8 6 2 12 8 18" })
|
|
3400
|
+
]);
|
|
3401
|
+
var IconLink = () => svg([
|
|
3402
|
+
h("path", { key: "a", d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
|
|
3403
|
+
h("path", { key: "b", d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
|
|
3404
|
+
]);
|
|
3405
|
+
var IconQuote = () => svg([
|
|
3406
|
+
h("path", { key: "a", d: "M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z" }),
|
|
3407
|
+
h("path", { key: "b", d: "M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z" })
|
|
3408
|
+
]);
|
|
3409
|
+
var IconListUl = () => svg([
|
|
3410
|
+
h("line", { key: "a", x1: 8, y1: 6, x2: 21, y2: 6 }),
|
|
3411
|
+
h("line", { key: "b", x1: 8, y1: 12, x2: 21, y2: 12 }),
|
|
3412
|
+
h("line", { key: "c", x1: 8, y1: 18, x2: 21, y2: 18 }),
|
|
3413
|
+
h("line", { key: "d", x1: 3, y1: 6, x2: 3.01, y2: 6 }),
|
|
3414
|
+
h("line", { key: "e", x1: 3, y1: 12, x2: 3.01, y2: 12 }),
|
|
3415
|
+
h("line", { key: "f", x1: 3, y1: 18, x2: 3.01, y2: 18 })
|
|
3416
|
+
]);
|
|
3417
|
+
var IconListOl = () => svg([
|
|
3418
|
+
h("line", { key: "a", x1: 10, y1: 6, x2: 21, y2: 6 }),
|
|
3419
|
+
h("line", { key: "b", x1: 10, y1: 12, x2: 21, y2: 12 }),
|
|
3420
|
+
h("line", { key: "c", x1: 10, y1: 18, x2: 21, y2: 18 }),
|
|
3421
|
+
h("path", { key: "d", d: "M4 6h1v4" }),
|
|
3422
|
+
h("path", { key: "e", d: "M4 10h2" }),
|
|
3423
|
+
h("path", { key: "f", d: "M6 18H4c0-1 2-2 2-3s-1-1.5-2-1" })
|
|
3424
|
+
]);
|
|
3425
|
+
var IconArrowUp = () => svg([
|
|
3426
|
+
h("path", { key: "a", d: "M12 19V5" }),
|
|
3427
|
+
h("path", { key: "b", d: "m5 12 7-7 7 7" })
|
|
3428
|
+
]);
|
|
3429
|
+
var IconStop = () => svg(h("rect", { x: 7, y: 7, width: 10, height: 10, rx: 1.5 }));
|
|
3371
3430
|
var EMOJI = {
|
|
3372
3431
|
smile: "\u{1F604}",
|
|
3373
3432
|
grin: "\u{1F601}",
|
|
@@ -3420,7 +3479,7 @@ function detectTrigger(text, caret) {
|
|
|
3420
3479
|
return { type, query, start: caret - query.length - 1, end: caret };
|
|
3421
3480
|
}
|
|
3422
3481
|
function Composer({
|
|
3423
|
-
placeholder = "
|
|
3482
|
+
placeholder = "Send a message\u2026",
|
|
3424
3483
|
busy = false,
|
|
3425
3484
|
slashCommands = [],
|
|
3426
3485
|
mentions,
|
|
@@ -3569,20 +3628,22 @@ ${sel}
|
|
|
3569
3628
|
submit();
|
|
3570
3629
|
}
|
|
3571
3630
|
}
|
|
3572
|
-
const iconBtn = "flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground hover:bg-accent hover:text-foreground";
|
|
3573
|
-
const toolbarBtn = (
|
|
3631
|
+
const iconBtn = "flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground";
|
|
3632
|
+
const toolbarBtn = (icon, title, kind) => h(
|
|
3574
3633
|
"button",
|
|
3575
3634
|
{
|
|
3576
3635
|
key: kind,
|
|
3577
3636
|
type: "button",
|
|
3578
3637
|
title,
|
|
3579
|
-
|
|
3638
|
+
"aria-label": title,
|
|
3639
|
+
className: iconBtn,
|
|
3580
3640
|
onMouseDown: (e) => e.preventDefault(),
|
|
3581
3641
|
// keep textarea selection
|
|
3582
3642
|
onClick: () => format(kind)
|
|
3583
3643
|
},
|
|
3584
|
-
|
|
3644
|
+
icon
|
|
3585
3645
|
);
|
|
3646
|
+
const divider = () => h("span", { className: "mx-1 h-5 w-px bg-border", "aria-hidden": true });
|
|
3586
3647
|
const menu = menuOpen ? h(
|
|
3587
3648
|
"div",
|
|
3588
3649
|
{
|
|
@@ -3627,7 +3688,11 @@ ${sel}
|
|
|
3627
3688
|
h(
|
|
3628
3689
|
"div",
|
|
3629
3690
|
{
|
|
3630
|
-
className:
|
|
3691
|
+
className: (
|
|
3692
|
+
// Subtle focus: slight border darkening + a soft shadow lift — no
|
|
3693
|
+
// bright colored ring (matches Claude/ChatGPT).
|
|
3694
|
+
"overflow-hidden rounded-2xl border border-border bg-background shadow-sm transition-shadow focus-within:border-foreground/25 focus-within:shadow-md"
|
|
3695
|
+
)
|
|
3631
3696
|
},
|
|
3632
3697
|
// error banner
|
|
3633
3698
|
error ? h(
|
|
@@ -3686,35 +3751,36 @@ ${sel}
|
|
|
3686
3751
|
e.target.value = "";
|
|
3687
3752
|
}
|
|
3688
3753
|
}),
|
|
3689
|
-
h("button", { type: "button", className: iconBtn, "aria-label": "Attach image or GIF", onClick: () => fileRef.current?.click() },
|
|
3754
|
+
h("button", { type: "button", className: iconBtn, "aria-label": "Attach image or GIF", onClick: () => fileRef.current?.click() }, h(IconAttach))
|
|
3690
3755
|
) : null,
|
|
3691
|
-
attachments && toolbar ?
|
|
3756
|
+
attachments && toolbar ? divider() : null,
|
|
3692
3757
|
toolbar ? h(
|
|
3693
3758
|
React11.Fragment,
|
|
3694
3759
|
null,
|
|
3695
|
-
toolbarBtn(
|
|
3696
|
-
toolbarBtn(
|
|
3697
|
-
toolbarBtn(
|
|
3698
|
-
toolbarBtn(
|
|
3699
|
-
|
|
3700
|
-
toolbarBtn(
|
|
3701
|
-
toolbarBtn(
|
|
3760
|
+
toolbarBtn(h(IconBold), "Bold (\u2318B)", "bold"),
|
|
3761
|
+
toolbarBtn(h(IconItalic), "Italic (\u2318I)", "italic"),
|
|
3762
|
+
toolbarBtn(h(IconCode), "Code (\u2318E)", "code"),
|
|
3763
|
+
toolbarBtn(h(IconLink), "Link (\u2318K)", "link"),
|
|
3764
|
+
divider(),
|
|
3765
|
+
toolbarBtn(h(IconQuote), "Quote", "quote"),
|
|
3766
|
+
toolbarBtn(h(IconListUl), "Bulleted list", "ul"),
|
|
3767
|
+
toolbarBtn(h(IconListOl), "Numbered list", "ol")
|
|
3702
3768
|
) : null,
|
|
3703
3769
|
h("div", { className: "flex-1" }),
|
|
3704
3770
|
busy ? h(
|
|
3705
3771
|
"button",
|
|
3706
|
-
{ type: "button", "aria-label": "Stop", className: "flex h-
|
|
3707
|
-
|
|
3772
|
+
{ type: "button", "aria-label": "Stop", className: "flex h-9 w-9 items-center justify-center rounded-full bg-primary text-primary-foreground transition hover:opacity-90", onClick: () => onStop?.() },
|
|
3773
|
+
h(IconStop)
|
|
3708
3774
|
) : h(
|
|
3709
3775
|
"button",
|
|
3710
3776
|
{
|
|
3711
3777
|
type: "button",
|
|
3712
3778
|
"aria-label": "Send",
|
|
3713
|
-
className: "flex h-
|
|
3779
|
+
className: "flex h-9 w-9 items-center justify-center rounded-full bg-primary text-primary-foreground transition hover:opacity-90 disabled:bg-muted disabled:text-muted-foreground disabled:opacity-100",
|
|
3714
3780
|
disabled: !value.trim() && pending.length === 0,
|
|
3715
3781
|
onClick: submit
|
|
3716
3782
|
},
|
|
3717
|
-
|
|
3783
|
+
h(IconArrowUp)
|
|
3718
3784
|
)
|
|
3719
3785
|
)
|
|
3720
3786
|
)
|