@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.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 = "Type a message\u2026 (/ commands, @ mentions, : emoji)",
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 = (label, title, kind) => h(
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
- className: cn(iconBtn, "text-xs font-medium"),
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
- label
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
  {
@@ -33615,35 +33676,36 @@ ${sel}
33615
33676
  e2.target.value = "";
33616
33677
  }
33617
33678
  }),
33618
- h("button", { type: "button", className: iconBtn, "aria-label": "Attach image or GIF", onClick: () => fileRef.current?.click() }, "\u{1F4CE}")
33679
+ h("button", { type: "button", className: iconBtn, "aria-label": "Attach image or GIF", onClick: () => fileRef.current?.click() }, h(IconAttach))
33619
33680
  ) : null,
33620
- attachments && toolbar ? h("span", { className: "mx-1 h-5 w-px bg-border" }) : null,
33681
+ attachments && toolbar ? divider() : null,
33621
33682
  toolbar ? h(
33622
33683
  React11__namespace.Fragment,
33623
33684
  null,
33624
- toolbarBtn("B", "Bold (\u2318B)", "bold"),
33625
- toolbarBtn("\u{1D456}", "Italic (\u2318I)", "italic"),
33626
- toolbarBtn("</>", "Code (\u2318E)", "code"),
33627
- toolbarBtn("\u{1F517}", "Link (\u2318K)", "link"),
33628
- toolbarBtn("\u275D", "Quote", "quote"),
33629
- toolbarBtn("\u2022", "Bulleted list", "ul"),
33630
- toolbarBtn("1.", "Numbered list", "ol")
33685
+ toolbarBtn(h(IconBold), "Bold (\u2318B)", "bold"),
33686
+ toolbarBtn(h(IconItalic), "Italic (\u2318I)", "italic"),
33687
+ toolbarBtn(h(IconCode), "Code (\u2318E)", "code"),
33688
+ toolbarBtn(h(IconLink), "Link (\u2318K)", "link"),
33689
+ divider(),
33690
+ toolbarBtn(h(IconQuote), "Quote", "quote"),
33691
+ toolbarBtn(h(IconListUl), "Bulleted list", "ul"),
33692
+ toolbarBtn(h(IconListOl), "Numbered list", "ol")
33631
33693
  ) : null,
33632
33694
  h("div", { className: "flex-1" }),
33633
33695
  busy ? h(
33634
33696
  "button",
33635
- { type: "button", "aria-label": "Stop", className: "flex h-8 w-8 items-center justify-center rounded-lg bg-primary text-primary-foreground", onClick: () => onStop?.() },
33636
- "\u25A0"
33697
+ { 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?.() },
33698
+ h(IconStop)
33637
33699
  ) : h(
33638
33700
  "button",
33639
33701
  {
33640
33702
  type: "button",
33641
33703
  "aria-label": "Send",
33642
- 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",
33704
+ 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
33705
  disabled: !value.trim() && pending.length === 0,
33644
33706
  onClick: submit
33645
33707
  },
33646
- "\u2191"
33708
+ h(IconArrowUp)
33647
33709
  )
33648
33710
  )
33649
33711
  )