@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.cjs
CHANGED
|
@@ -33297,6 +33297,65 @@ function useConversation(config) {
|
|
|
33297
33297
|
};
|
|
33298
33298
|
}
|
|
33299
33299
|
var h = React11__namespace.createElement;
|
|
33300
|
+
var svg = (children, size = 16) => h(
|
|
33301
|
+
"svg",
|
|
33302
|
+
{
|
|
33303
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
33304
|
+
viewBox: "0 0 24 24",
|
|
33305
|
+
width: size,
|
|
33306
|
+
height: size,
|
|
33307
|
+
fill: "none",
|
|
33308
|
+
stroke: "currentColor",
|
|
33309
|
+
strokeWidth: 2,
|
|
33310
|
+
strokeLinecap: "round",
|
|
33311
|
+
strokeLinejoin: "round",
|
|
33312
|
+
"aria-hidden": true
|
|
33313
|
+
},
|
|
33314
|
+
children
|
|
33315
|
+
);
|
|
33316
|
+
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" }));
|
|
33317
|
+
var IconBold = () => svg([
|
|
33318
|
+
h("path", { key: "a", d: "M6 4h8a4 4 0 0 1 0 8H6z" }),
|
|
33319
|
+
h("path", { key: "b", d: "M6 12h9a4 4 0 0 1 0 8H6z" })
|
|
33320
|
+
]);
|
|
33321
|
+
var IconItalic = () => svg([
|
|
33322
|
+
h("line", { key: "a", x1: 19, y1: 4, x2: 10, y2: 4 }),
|
|
33323
|
+
h("line", { key: "b", x1: 14, y1: 20, x2: 5, y2: 20 }),
|
|
33324
|
+
h("line", { key: "c", x1: 15, y1: 4, x2: 9, y2: 20 })
|
|
33325
|
+
]);
|
|
33326
|
+
var IconCode = () => svg([
|
|
33327
|
+
h("polyline", { key: "a", points: "16 18 22 12 16 6" }),
|
|
33328
|
+
h("polyline", { key: "b", points: "8 6 2 12 8 18" })
|
|
33329
|
+
]);
|
|
33330
|
+
var IconLink = () => svg([
|
|
33331
|
+
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" }),
|
|
33332
|
+
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" })
|
|
33333
|
+
]);
|
|
33334
|
+
var IconQuote = () => svg([
|
|
33335
|
+
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" }),
|
|
33336
|
+
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" })
|
|
33337
|
+
]);
|
|
33338
|
+
var IconListUl = () => svg([
|
|
33339
|
+
h("line", { key: "a", x1: 8, y1: 6, x2: 21, y2: 6 }),
|
|
33340
|
+
h("line", { key: "b", x1: 8, y1: 12, x2: 21, y2: 12 }),
|
|
33341
|
+
h("line", { key: "c", x1: 8, y1: 18, x2: 21, y2: 18 }),
|
|
33342
|
+
h("line", { key: "d", x1: 3, y1: 6, x2: 3.01, y2: 6 }),
|
|
33343
|
+
h("line", { key: "e", x1: 3, y1: 12, x2: 3.01, y2: 12 }),
|
|
33344
|
+
h("line", { key: "f", x1: 3, y1: 18, x2: 3.01, y2: 18 })
|
|
33345
|
+
]);
|
|
33346
|
+
var IconListOl = () => svg([
|
|
33347
|
+
h("line", { key: "a", x1: 10, y1: 6, x2: 21, y2: 6 }),
|
|
33348
|
+
h("line", { key: "b", x1: 10, y1: 12, x2: 21, y2: 12 }),
|
|
33349
|
+
h("line", { key: "c", x1: 10, y1: 18, x2: 21, y2: 18 }),
|
|
33350
|
+
h("path", { key: "d", d: "M4 6h1v4" }),
|
|
33351
|
+
h("path", { key: "e", d: "M4 10h2" }),
|
|
33352
|
+
h("path", { key: "f", d: "M6 18H4c0-1 2-2 2-3s-1-1.5-2-1" })
|
|
33353
|
+
]);
|
|
33354
|
+
var IconArrowUp = () => svg([
|
|
33355
|
+
h("path", { key: "a", d: "M12 19V5" }),
|
|
33356
|
+
h("path", { key: "b", d: "m5 12 7-7 7 7" })
|
|
33357
|
+
]);
|
|
33358
|
+
var IconStop = () => svg(h("rect", { x: 7, y: 7, width: 10, height: 10, rx: 1.5 }));
|
|
33300
33359
|
var EMOJI = {
|
|
33301
33360
|
smile: "\u{1F604}",
|
|
33302
33361
|
grin: "\u{1F601}",
|
|
@@ -33349,7 +33408,7 @@ function detectTrigger(text, caret) {
|
|
|
33349
33408
|
return { type, query, start: caret - query.length - 1, end: caret };
|
|
33350
33409
|
}
|
|
33351
33410
|
function Composer({
|
|
33352
|
-
placeholder = "
|
|
33411
|
+
placeholder = "Send a message\u2026",
|
|
33353
33412
|
busy = false,
|
|
33354
33413
|
slashCommands = [],
|
|
33355
33414
|
mentions,
|
|
@@ -33498,20 +33557,22 @@ ${sel}
|
|
|
33498
33557
|
submit();
|
|
33499
33558
|
}
|
|
33500
33559
|
}
|
|
33501
|
-
const iconBtn = "flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground hover:bg-accent hover:text-foreground";
|
|
33502
|
-
const toolbarBtn = (
|
|
33560
|
+
const iconBtn = "flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-accent hover:text-foreground";
|
|
33561
|
+
const toolbarBtn = (icon, title, kind) => h(
|
|
33503
33562
|
"button",
|
|
33504
33563
|
{
|
|
33505
33564
|
key: kind,
|
|
33506
33565
|
type: "button",
|
|
33507
33566
|
title,
|
|
33508
|
-
|
|
33567
|
+
"aria-label": title,
|
|
33568
|
+
className: iconBtn,
|
|
33509
33569
|
onMouseDown: (e2) => e2.preventDefault(),
|
|
33510
33570
|
// keep textarea selection
|
|
33511
33571
|
onClick: () => format(kind)
|
|
33512
33572
|
},
|
|
33513
|
-
|
|
33573
|
+
icon
|
|
33514
33574
|
);
|
|
33575
|
+
const divider = () => h("span", { className: "mx-1 h-5 w-px bg-border", "aria-hidden": true });
|
|
33515
33576
|
const menu = menuOpen ? h(
|
|
33516
33577
|
"div",
|
|
33517
33578
|
{
|
|
@@ -33556,7 +33617,11 @@ ${sel}
|
|
|
33556
33617
|
h(
|
|
33557
33618
|
"div",
|
|
33558
33619
|
{
|
|
33559
|
-
className:
|
|
33620
|
+
className: (
|
|
33621
|
+
// Subtle focus: slight border darkening + a soft shadow lift — no
|
|
33622
|
+
// bright colored ring (matches Claude/ChatGPT).
|
|
33623
|
+
"overflow-hidden rounded-2xl border border-border bg-background shadow-sm transition-shadow focus-within:border-foreground/25 focus-within:shadow-md"
|
|
33624
|
+
)
|
|
33560
33625
|
},
|
|
33561
33626
|
// error banner
|
|
33562
33627
|
error ? h(
|
|
@@ -33615,35 +33680,36 @@ ${sel}
|
|
|
33615
33680
|
e2.target.value = "";
|
|
33616
33681
|
}
|
|
33617
33682
|
}),
|
|
33618
|
-
h("button", { type: "button", className: iconBtn, "aria-label": "Attach image or GIF", onClick: () => fileRef.current?.click() },
|
|
33683
|
+
h("button", { type: "button", className: iconBtn, "aria-label": "Attach image or GIF", onClick: () => fileRef.current?.click() }, h(IconAttach))
|
|
33619
33684
|
) : null,
|
|
33620
|
-
attachments && toolbar ?
|
|
33685
|
+
attachments && toolbar ? divider() : null,
|
|
33621
33686
|
toolbar ? h(
|
|
33622
33687
|
React11__namespace.Fragment,
|
|
33623
33688
|
null,
|
|
33624
|
-
toolbarBtn(
|
|
33625
|
-
toolbarBtn(
|
|
33626
|
-
toolbarBtn(
|
|
33627
|
-
toolbarBtn(
|
|
33628
|
-
|
|
33629
|
-
toolbarBtn(
|
|
33630
|
-
toolbarBtn(
|
|
33689
|
+
toolbarBtn(h(IconBold), "Bold (\u2318B)", "bold"),
|
|
33690
|
+
toolbarBtn(h(IconItalic), "Italic (\u2318I)", "italic"),
|
|
33691
|
+
toolbarBtn(h(IconCode), "Code (\u2318E)", "code"),
|
|
33692
|
+
toolbarBtn(h(IconLink), "Link (\u2318K)", "link"),
|
|
33693
|
+
divider(),
|
|
33694
|
+
toolbarBtn(h(IconQuote), "Quote", "quote"),
|
|
33695
|
+
toolbarBtn(h(IconListUl), "Bulleted list", "ul"),
|
|
33696
|
+
toolbarBtn(h(IconListOl), "Numbered list", "ol")
|
|
33631
33697
|
) : null,
|
|
33632
33698
|
h("div", { className: "flex-1" }),
|
|
33633
33699
|
busy ? h(
|
|
33634
33700
|
"button",
|
|
33635
|
-
{ type: "button", "aria-label": "Stop", className: "flex h-
|
|
33636
|
-
|
|
33701
|
+
{ 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?.() },
|
|
33702
|
+
h(IconStop)
|
|
33637
33703
|
) : h(
|
|
33638
33704
|
"button",
|
|
33639
33705
|
{
|
|
33640
33706
|
type: "button",
|
|
33641
33707
|
"aria-label": "Send",
|
|
33642
|
-
className: "flex h-
|
|
33708
|
+
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",
|
|
33643
33709
|
disabled: !value.trim() && pending.length === 0,
|
|
33644
33710
|
onClick: submit
|
|
33645
33711
|
},
|
|
33646
|
-
|
|
33712
|
+
h(IconArrowUp)
|
|
33647
33713
|
)
|
|
33648
33714
|
)
|
|
33649
33715
|
)
|