@refraction-ui/react 0.12.0 → 0.12.1

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.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 = "Type a message\u2026 (/ commands, @ mentions, : emoji)",
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 = (label, title, kind) => h(
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
- className: cn(iconBtn, "text-xs font-medium"),
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
- label
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
  {
@@ -3686,35 +3747,36 @@ ${sel}
3686
3747
  e.target.value = "";
3687
3748
  }
3688
3749
  }),
3689
- h("button", { type: "button", className: iconBtn, "aria-label": "Attach image or GIF", onClick: () => fileRef.current?.click() }, "\u{1F4CE}")
3750
+ h("button", { type: "button", className: iconBtn, "aria-label": "Attach image or GIF", onClick: () => fileRef.current?.click() }, h(IconAttach))
3690
3751
  ) : null,
3691
- attachments && toolbar ? h("span", { className: "mx-1 h-5 w-px bg-border" }) : null,
3752
+ attachments && toolbar ? divider() : null,
3692
3753
  toolbar ? h(
3693
3754
  React11.Fragment,
3694
3755
  null,
3695
- toolbarBtn("B", "Bold (\u2318B)", "bold"),
3696
- toolbarBtn("\u{1D456}", "Italic (\u2318I)", "italic"),
3697
- toolbarBtn("</>", "Code (\u2318E)", "code"),
3698
- toolbarBtn("\u{1F517}", "Link (\u2318K)", "link"),
3699
- toolbarBtn("\u275D", "Quote", "quote"),
3700
- toolbarBtn("\u2022", "Bulleted list", "ul"),
3701
- toolbarBtn("1.", "Numbered list", "ol")
3756
+ toolbarBtn(h(IconBold), "Bold (\u2318B)", "bold"),
3757
+ toolbarBtn(h(IconItalic), "Italic (\u2318I)", "italic"),
3758
+ toolbarBtn(h(IconCode), "Code (\u2318E)", "code"),
3759
+ toolbarBtn(h(IconLink), "Link (\u2318K)", "link"),
3760
+ divider(),
3761
+ toolbarBtn(h(IconQuote), "Quote", "quote"),
3762
+ toolbarBtn(h(IconListUl), "Bulleted list", "ul"),
3763
+ toolbarBtn(h(IconListOl), "Numbered list", "ol")
3702
3764
  ) : null,
3703
3765
  h("div", { className: "flex-1" }),
3704
3766
  busy ? h(
3705
3767
  "button",
3706
- { type: "button", "aria-label": "Stop", className: "flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-primary-foreground", onClick: () => onStop?.() },
3707
- "\u25A0"
3768
+ { 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?.() },
3769
+ h(IconStop)
3708
3770
  ) : h(
3709
3771
  "button",
3710
3772
  {
3711
3773
  type: "button",
3712
3774
  "aria-label": "Send",
3713
- className: "flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-base font-semibold text-primary-foreground transition disabled:opacity-40",
3775
+ 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
3776
  disabled: !value.trim() && pending.length === 0,
3715
3777
  onClick: submit
3716
3778
  },
3717
- "\u2191"
3779
+ h(IconArrowUp)
3718
3780
  )
3719
3781
  )
3720
3782
  )