@openwarelabs/ui 0.10.1 → 0.11.0
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/components/Container/Container.d.cts +7 -0
- package/dist/components/Container/Container.d.ts +7 -0
- package/dist/components/Container/Container.types.d.cts +12 -0
- package/dist/components/Container/Container.types.d.ts +12 -0
- package/dist/components/Section/Section.d.cts +7 -0
- package/dist/components/Section/Section.d.ts +7 -0
- package/dist/components/Section/Section.types.d.cts +16 -0
- package/dist/components/Section/Section.types.d.ts +16 -0
- package/dist/components.css +67 -0
- package/dist/index.cjs +299 -285
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +217 -203
- package/dist/index.js.map +4 -4
- package/dist/openware-ui.iife.js +6 -6
- package/dist/styles.css +70 -0
- package/dist/tokens.css +3 -0
- package/dist/tokens.json +15 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6342,11 +6342,23 @@ function VisuallyHidden({ className, ...props }) {
|
|
|
6342
6342
|
return /* @__PURE__ */ jsx60("span", { className: cx("ow-visually-hidden", className), ...props });
|
|
6343
6343
|
}
|
|
6344
6344
|
|
|
6345
|
+
// src/components/Container/Container.tsx
|
|
6346
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
6347
|
+
function Container({ size: size2 = "page", as: Element2 = "div", className, ...props }) {
|
|
6348
|
+
return /* @__PURE__ */ jsx61(Element2, { className: cx("ow-container", `ow-container--${size2}`, className), ...props });
|
|
6349
|
+
}
|
|
6350
|
+
|
|
6351
|
+
// src/components/Section/Section.tsx
|
|
6352
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
6353
|
+
function Section({ tone = "paper", spacing = "md", size: size2 = "page", as: Element2 = "section", className, children, ...props }) {
|
|
6354
|
+
return /* @__PURE__ */ jsx62(Element2, { className: cx("ow-section", `ow-section--${tone}`, `ow-section--space-${spacing}`, className), ...props, children: size2 === false ? children : /* @__PURE__ */ jsx62(Container, { size: size2, children }) });
|
|
6355
|
+
}
|
|
6356
|
+
|
|
6345
6357
|
// src/components/Marketing/Marketing.tsx
|
|
6346
6358
|
import { useRef as useRef33 } from "react";
|
|
6347
|
-
import { jsx as
|
|
6359
|
+
import { jsx as jsx63, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
6348
6360
|
function Chip({ className, ...props }) {
|
|
6349
|
-
return /* @__PURE__ */
|
|
6361
|
+
return /* @__PURE__ */ jsx63("span", { className: cx("ow-chip", className), ...props });
|
|
6350
6362
|
}
|
|
6351
6363
|
function SectionHeading({
|
|
6352
6364
|
eyebrow,
|
|
@@ -6357,16 +6369,16 @@ function SectionHeading({
|
|
|
6357
6369
|
className
|
|
6358
6370
|
}) {
|
|
6359
6371
|
return /* @__PURE__ */ jsxs47("div", { className: cx("ow-section-heading", align === "center" && "ow-section-heading--center", className), children: [
|
|
6360
|
-
eyebrow ? /* @__PURE__ */
|
|
6361
|
-
/* @__PURE__ */
|
|
6362
|
-
intro ? /* @__PURE__ */
|
|
6372
|
+
eyebrow ? /* @__PURE__ */ jsx63(Chip, { children: eyebrow }) : null,
|
|
6373
|
+
/* @__PURE__ */ jsx63(Heading, { className: "ow-section-heading__title", children: title }),
|
|
6374
|
+
intro ? /* @__PURE__ */ jsx63("p", { className: "ow-section-heading__intro", children: intro }) : null
|
|
6363
6375
|
] });
|
|
6364
6376
|
}
|
|
6365
6377
|
function SiteHeader({ brand, nav, actions, className }) {
|
|
6366
6378
|
return /* @__PURE__ */ jsxs47("header", { className: cx("ow-site-header", className), children: [
|
|
6367
|
-
/* @__PURE__ */
|
|
6368
|
-
nav ? /* @__PURE__ */
|
|
6369
|
-
actions ? /* @__PURE__ */
|
|
6379
|
+
/* @__PURE__ */ jsx63("div", { className: "ow-site-header__brand", children: brand }),
|
|
6380
|
+
nav ? /* @__PURE__ */ jsx63("nav", { className: "ow-site-header__nav", children: nav }) : null,
|
|
6381
|
+
actions ? /* @__PURE__ */ jsx63("div", { className: "ow-site-header__actions", children: actions }) : null
|
|
6370
6382
|
] });
|
|
6371
6383
|
}
|
|
6372
6384
|
function DotGrid({ fade = false, interactive = false, className, children, onPointerMove, ...props }) {
|
|
@@ -6387,9 +6399,9 @@ function DotGrid({ fade = false, interactive = false, className, children, onPoi
|
|
|
6387
6399
|
onPointerMove: track,
|
|
6388
6400
|
...props,
|
|
6389
6401
|
children: [
|
|
6390
|
-
/* @__PURE__ */
|
|
6391
|
-
interactive ? /* @__PURE__ */
|
|
6392
|
-
/* @__PURE__ */
|
|
6402
|
+
/* @__PURE__ */ jsx63("span", { className: "ow-dot-grid__dots", "aria-hidden": "true" }),
|
|
6403
|
+
interactive ? /* @__PURE__ */ jsx63("span", { className: "ow-dot-grid__brass", "aria-hidden": "true" }) : null,
|
|
6404
|
+
/* @__PURE__ */ jsx63("div", { className: "ow-dot-grid__content", children })
|
|
6393
6405
|
]
|
|
6394
6406
|
}
|
|
6395
6407
|
);
|
|
@@ -6397,7 +6409,7 @@ function DotGrid({ fade = false, interactive = false, className, children, onPoi
|
|
|
6397
6409
|
|
|
6398
6410
|
// src/components/Prose/Prose.tsx
|
|
6399
6411
|
import { forwardRef as forwardRef23, useEffect as useEffect26, useRef as useRef34 } from "react";
|
|
6400
|
-
import { jsx as
|
|
6412
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
6401
6413
|
var Prose = /* @__PURE__ */ forwardRef23(function Prose2({ size: size2 = "md", fullWidth = false, as = "div", className, children, ...props }, ref) {
|
|
6402
6414
|
const Element2 = as;
|
|
6403
6415
|
const root = useRef34(null);
|
|
@@ -6413,7 +6425,7 @@ var Prose = /* @__PURE__ */ forwardRef23(function Prose2({ size: size2 = "md", f
|
|
|
6413
6425
|
if (text) box.setAttribute("aria-label", text);
|
|
6414
6426
|
}
|
|
6415
6427
|
});
|
|
6416
|
-
return /* @__PURE__ */
|
|
6428
|
+
return /* @__PURE__ */ jsx64(
|
|
6417
6429
|
Element2,
|
|
6418
6430
|
{
|
|
6419
6431
|
ref: (node) => {
|
|
@@ -6429,10 +6441,10 @@ var Prose = /* @__PURE__ */ forwardRef23(function Prose2({ size: size2 = "md", f
|
|
|
6429
6441
|
});
|
|
6430
6442
|
|
|
6431
6443
|
// src/components/TextShimmer/TextShimmer.tsx
|
|
6432
|
-
import { jsx as
|
|
6444
|
+
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
6433
6445
|
function TextShimmer({ children, as = "span", duration = 2, active = true, className }) {
|
|
6434
6446
|
const Element2 = as;
|
|
6435
|
-
return /* @__PURE__ */
|
|
6447
|
+
return /* @__PURE__ */ jsx65(
|
|
6436
6448
|
Element2,
|
|
6437
6449
|
{
|
|
6438
6450
|
className: cx("ow-shimmer", active && "ow-shimmer--active", className),
|
|
@@ -6451,12 +6463,12 @@ import {
|
|
|
6451
6463
|
useRef as useRef35,
|
|
6452
6464
|
useState as useState29
|
|
6453
6465
|
} from "react";
|
|
6454
|
-
import { jsx as
|
|
6466
|
+
import { jsx as jsx66, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
6455
6467
|
var noAttachments = [];
|
|
6456
6468
|
var counterFrom = 0.8;
|
|
6457
6469
|
var announceDelay = 1e3;
|
|
6458
6470
|
function Glyph({ children }) {
|
|
6459
|
-
return /* @__PURE__ */
|
|
6471
|
+
return /* @__PURE__ */ jsx66(
|
|
6460
6472
|
"svg",
|
|
6461
6473
|
{
|
|
6462
6474
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6476,29 +6488,29 @@ function Glyph({ children }) {
|
|
|
6476
6488
|
}
|
|
6477
6489
|
var sheet = "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z";
|
|
6478
6490
|
var fold = "M14 2v5a1 1 0 0 0 1 1h5";
|
|
6479
|
-
var PaperclipIcon = () => /* @__PURE__ */
|
|
6480
|
-
var StopIcon = () => /* @__PURE__ */
|
|
6491
|
+
var PaperclipIcon = () => /* @__PURE__ */ jsx66(Glyph, { children: /* @__PURE__ */ jsx66("path", { d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551" }) });
|
|
6492
|
+
var StopIcon = () => /* @__PURE__ */ jsx66(Glyph, { children: /* @__PURE__ */ jsx66("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2", fill: "currentColor", stroke: "none" }) });
|
|
6481
6493
|
var fileIcons = {
|
|
6482
6494
|
image: /* @__PURE__ */ jsxs48(Glyph, { children: [
|
|
6483
|
-
/* @__PURE__ */
|
|
6484
|
-
/* @__PURE__ */
|
|
6485
|
-
/* @__PURE__ */
|
|
6486
|
-
/* @__PURE__ */
|
|
6495
|
+
/* @__PURE__ */ jsx66("path", { d: sheet }),
|
|
6496
|
+
/* @__PURE__ */ jsx66("path", { d: fold }),
|
|
6497
|
+
/* @__PURE__ */ jsx66("circle", { cx: "10", cy: "12", r: "2" }),
|
|
6498
|
+
/* @__PURE__ */ jsx66("path", { d: "m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22" })
|
|
6487
6499
|
] }),
|
|
6488
6500
|
code: /* @__PURE__ */ jsxs48(Glyph, { children: [
|
|
6489
|
-
/* @__PURE__ */
|
|
6490
|
-
/* @__PURE__ */
|
|
6491
|
-
/* @__PURE__ */
|
|
6492
|
-
/* @__PURE__ */
|
|
6501
|
+
/* @__PURE__ */ jsx66("path", { d: sheet }),
|
|
6502
|
+
/* @__PURE__ */ jsx66("path", { d: fold }),
|
|
6503
|
+
/* @__PURE__ */ jsx66("path", { d: "M10 12.5 8 15l2 2.5" }),
|
|
6504
|
+
/* @__PURE__ */ jsx66("path", { d: "m14 12.5 2 2.5-2 2.5" })
|
|
6493
6505
|
] }),
|
|
6494
6506
|
text: /* @__PURE__ */ jsxs48(Glyph, { children: [
|
|
6495
|
-
/* @__PURE__ */
|
|
6496
|
-
/* @__PURE__ */
|
|
6497
|
-
/* @__PURE__ */
|
|
6498
|
-
/* @__PURE__ */
|
|
6499
|
-
/* @__PURE__ */
|
|
6507
|
+
/* @__PURE__ */ jsx66("path", { d: sheet }),
|
|
6508
|
+
/* @__PURE__ */ jsx66("path", { d: fold }),
|
|
6509
|
+
/* @__PURE__ */ jsx66("path", { d: "M10 9H8" }),
|
|
6510
|
+
/* @__PURE__ */ jsx66("path", { d: "M16 13H8" }),
|
|
6511
|
+
/* @__PURE__ */ jsx66("path", { d: "M16 17H8" })
|
|
6500
6512
|
] }),
|
|
6501
|
-
file: /* @__PURE__ */
|
|
6513
|
+
file: /* @__PURE__ */ jsx66(FileIcon, { size: 16 })
|
|
6502
6514
|
};
|
|
6503
6515
|
function kindOf({ name, type = "" }) {
|
|
6504
6516
|
const lower = name.toLowerCase();
|
|
@@ -6691,7 +6703,7 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
|
|
|
6691
6703
|
event.preventDefault();
|
|
6692
6704
|
textAreaRef.current?.focus();
|
|
6693
6705
|
}
|
|
6694
|
-
const attachButton = onAttach ? /* @__PURE__ */
|
|
6706
|
+
const attachButton = onAttach ? /* @__PURE__ */ jsx66(Tooltip, { label: "Attach files", children: /* @__PURE__ */ jsx66(
|
|
6695
6707
|
Button,
|
|
6696
6708
|
{
|
|
6697
6709
|
className: "ow-prompt-input__attach",
|
|
@@ -6701,11 +6713,11 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
|
|
|
6701
6713
|
"aria-label": multiple ? "Attach files" : "Attach a file",
|
|
6702
6714
|
disabled,
|
|
6703
6715
|
onClick: () => pickerRef.current?.click(),
|
|
6704
|
-
children: /* @__PURE__ */
|
|
6716
|
+
children: /* @__PURE__ */ jsx66(PaperclipIcon, {})
|
|
6705
6717
|
}
|
|
6706
6718
|
) }) : null;
|
|
6707
6719
|
const actionLabel = isStreaming ? "Stop" : "Send";
|
|
6708
|
-
const actionButton = /* @__PURE__ */
|
|
6720
|
+
const actionButton = /* @__PURE__ */ jsx66(Tooltip, { label: actionLabel, children: /* @__PURE__ */ jsx66(
|
|
6709
6721
|
Button,
|
|
6710
6722
|
{
|
|
6711
6723
|
ref: actionRef,
|
|
@@ -6720,7 +6732,7 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
|
|
|
6720
6732
|
else submit();
|
|
6721
6733
|
textAreaRef.current?.focus();
|
|
6722
6734
|
},
|
|
6723
|
-
children: isStreaming ? /* @__PURE__ */
|
|
6735
|
+
children: isStreaming ? /* @__PURE__ */ jsx66(StopIcon, {}) : /* @__PURE__ */ jsx66(ArrowUpIcon, { size: 16 })
|
|
6724
6736
|
}
|
|
6725
6737
|
) });
|
|
6726
6738
|
return /* @__PURE__ */ jsxs48(
|
|
@@ -6767,12 +6779,12 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
|
|
|
6767
6779
|
take(Array.from(event.dataTransfer.files));
|
|
6768
6780
|
},
|
|
6769
6781
|
children: [
|
|
6770
|
-
attachments.length ? /* @__PURE__ */
|
|
6782
|
+
attachments.length ? /* @__PURE__ */ jsx66("ul", { ref: listRef, className: "ow-prompt-input__attachments", "aria-label": "Attachments", children: attachments.map((attachment, index) => {
|
|
6771
6783
|
const [base, extension] = splitName(attachment.name);
|
|
6772
6784
|
return /* @__PURE__ */ jsxs48("li", { className: "ow-prompt-input__attachment", children: [
|
|
6773
6785
|
/* @__PURE__ */ jsxs48("span", { className: "ow-prompt-input__thumb", "aria-hidden": "true", children: [
|
|
6774
6786
|
fileIcons[kindOf(attachment)],
|
|
6775
|
-
attachment.previewUrl ? /* @__PURE__ */
|
|
6787
|
+
attachment.previewUrl ? /* @__PURE__ */ jsx66(
|
|
6776
6788
|
"img",
|
|
6777
6789
|
{
|
|
6778
6790
|
src: attachment.previewUrl,
|
|
@@ -6785,24 +6797,24 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
|
|
|
6785
6797
|
] }),
|
|
6786
6798
|
/* @__PURE__ */ jsxs48("span", { className: "ow-prompt-input__file", children: [
|
|
6787
6799
|
/* @__PURE__ */ jsxs48("span", { className: "ow-prompt-input__file-name", title: attachment.name, children: [
|
|
6788
|
-
/* @__PURE__ */
|
|
6800
|
+
/* @__PURE__ */ jsx66("span", { className: "ow-prompt-input__file-base", children: base }),
|
|
6789
6801
|
extension
|
|
6790
6802
|
] }),
|
|
6791
|
-
attachment.size !== void 0 ? /* @__PURE__ */
|
|
6803
|
+
attachment.size !== void 0 ? /* @__PURE__ */ jsx66("span", { className: "ow-prompt-input__file-size", children: formatBytes(attachment.size, locale) }) : null
|
|
6792
6804
|
] }),
|
|
6793
|
-
onRemoveAttachment ? /* @__PURE__ */
|
|
6805
|
+
onRemoveAttachment ? /* @__PURE__ */ jsx66(
|
|
6794
6806
|
"button",
|
|
6795
6807
|
{
|
|
6796
6808
|
type: "button",
|
|
6797
6809
|
className: "ow-prompt-input__remove",
|
|
6798
6810
|
"aria-label": `Remove ${attachment.name}`,
|
|
6799
6811
|
onClick: () => remove(attachment, index),
|
|
6800
|
-
children: /* @__PURE__ */
|
|
6812
|
+
children: /* @__PURE__ */ jsx66(XIcon, { size: 14 })
|
|
6801
6813
|
}
|
|
6802
6814
|
) : null
|
|
6803
6815
|
] }, attachment.id);
|
|
6804
6816
|
}) }) : null,
|
|
6805
|
-
/* @__PURE__ */
|
|
6817
|
+
/* @__PURE__ */ jsx66(
|
|
6806
6818
|
Textarea,
|
|
6807
6819
|
{
|
|
6808
6820
|
ref: setTextAreaRef,
|
|
@@ -6848,7 +6860,7 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
|
|
|
6848
6860
|
actionButton
|
|
6849
6861
|
] })
|
|
6850
6862
|
] }),
|
|
6851
|
-
onAttach ? /* @__PURE__ */
|
|
6863
|
+
onAttach ? /* @__PURE__ */ jsx66(
|
|
6852
6864
|
"input",
|
|
6853
6865
|
{
|
|
6854
6866
|
ref: pickerRef,
|
|
@@ -6865,13 +6877,13 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
|
|
|
6865
6877
|
}
|
|
6866
6878
|
) : null,
|
|
6867
6879
|
isDragging ? /* @__PURE__ */ jsxs48("div", { className: "ow-prompt-input__drop", "aria-hidden": "true", children: [
|
|
6868
|
-
/* @__PURE__ */
|
|
6880
|
+
/* @__PURE__ */ jsx66(UploadIcon, { size: 16 }),
|
|
6869
6881
|
"Drop to attach"
|
|
6870
6882
|
] }) : null
|
|
6871
6883
|
]
|
|
6872
6884
|
}
|
|
6873
6885
|
),
|
|
6874
|
-
shownHint ? /* @__PURE__ */
|
|
6886
|
+
shownHint ? /* @__PURE__ */ jsx66(
|
|
6875
6887
|
"div",
|
|
6876
6888
|
{
|
|
6877
6889
|
className: cx("ow-prompt-input__hint", notice && "ow-prompt-input__hint--notice"),
|
|
@@ -6880,7 +6892,7 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
|
|
|
6880
6892
|
children: shownHint
|
|
6881
6893
|
}
|
|
6882
6894
|
) : null,
|
|
6883
|
-
/* @__PURE__ */
|
|
6895
|
+
/* @__PURE__ */ jsx66("span", { className: "ow-visually-hidden", role: "status", children: announcement })
|
|
6884
6896
|
]
|
|
6885
6897
|
}
|
|
6886
6898
|
);
|
|
@@ -6888,14 +6900,14 @@ var PromptInput = /* @__PURE__ */ forwardRef24(function PromptInput2({
|
|
|
6888
6900
|
|
|
6889
6901
|
// src/components/PromptInput/PromptSuggestion.tsx
|
|
6890
6902
|
import { forwardRef as forwardRef25 } from "react";
|
|
6891
|
-
import { jsx as
|
|
6903
|
+
import { jsx as jsx67, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
6892
6904
|
var PromptSuggestion = /* @__PURE__ */ forwardRef25(function PromptSuggestion2({ children, icon: icon2, description, variant = description ? "card" : "pill", type = "button", className, ...buttonProps }, ref) {
|
|
6893
6905
|
if (variant === "card") {
|
|
6894
6906
|
return /* @__PURE__ */ jsxs49("button", { ref, type, className: cx("ow-prompt-suggestion", "ow-prompt-suggestion--card", className), ...buttonProps, children: [
|
|
6895
|
-
icon2 ? /* @__PURE__ */
|
|
6907
|
+
icon2 ? /* @__PURE__ */ jsx67("span", { className: "ow-prompt-suggestion__icon", children: icon2 }) : null,
|
|
6896
6908
|
/* @__PURE__ */ jsxs49("span", { className: "ow-prompt-suggestion__text", children: [
|
|
6897
|
-
/* @__PURE__ */
|
|
6898
|
-
description ? /* @__PURE__ */
|
|
6909
|
+
/* @__PURE__ */ jsx67("span", { className: "ow-prompt-suggestion__title", children }),
|
|
6910
|
+
description ? /* @__PURE__ */ jsx67("span", { className: "ow-prompt-suggestion__description", children: description }) : null
|
|
6899
6911
|
] })
|
|
6900
6912
|
] });
|
|
6901
6913
|
}
|
|
@@ -6912,8 +6924,8 @@ var PromptSuggestion = /* @__PURE__ */ forwardRef25(function PromptSuggestion2({
|
|
|
6912
6924
|
),
|
|
6913
6925
|
...buttonProps,
|
|
6914
6926
|
children: [
|
|
6915
|
-
icon2 ? /* @__PURE__ */
|
|
6916
|
-
/* @__PURE__ */
|
|
6927
|
+
icon2 ? /* @__PURE__ */ jsx67("span", { className: "ow-prompt-suggestion__icon", children: icon2 }) : null,
|
|
6928
|
+
/* @__PURE__ */ jsx67("span", { className: "ow-prompt-suggestion__label", children })
|
|
6917
6929
|
]
|
|
6918
6930
|
}
|
|
6919
6931
|
);
|
|
@@ -6928,7 +6940,7 @@ function PromptSuggestions({
|
|
|
6928
6940
|
style,
|
|
6929
6941
|
...props
|
|
6930
6942
|
}) {
|
|
6931
|
-
return /* @__PURE__ */
|
|
6943
|
+
return /* @__PURE__ */ jsx67(
|
|
6932
6944
|
"div",
|
|
6933
6945
|
{
|
|
6934
6946
|
role: "group",
|
|
@@ -6954,7 +6966,7 @@ import {
|
|
|
6954
6966
|
useRef as useRef36,
|
|
6955
6967
|
useState as useState30
|
|
6956
6968
|
} from "react";
|
|
6957
|
-
import { jsx as
|
|
6969
|
+
import { jsx as jsx68, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
6958
6970
|
var ChatConversationContext = /* @__PURE__ */ createContext8(null);
|
|
6959
6971
|
var stickyDistance = 32;
|
|
6960
6972
|
var defaultCount = (count) => `${count} new`;
|
|
@@ -7051,7 +7063,7 @@ var ChatConversation = /* @__PURE__ */ forwardRef26(function ChatConversation2({
|
|
|
7051
7063
|
const jump = usePresence(showJump);
|
|
7052
7064
|
return /* @__PURE__ */ jsxs50("div", { className: cx("ow-chat-conversation", width === "full" && "ow-chat-conversation--full", className), ...props, children: [
|
|
7053
7065
|
/* @__PURE__ */ jsxs50("div", { className: "ow-chat-conversation__viewport", children: [
|
|
7054
|
-
/* @__PURE__ */
|
|
7066
|
+
/* @__PURE__ */ jsx68(
|
|
7055
7067
|
"div",
|
|
7056
7068
|
{
|
|
7057
7069
|
ref: scrollerRef,
|
|
@@ -7063,17 +7075,17 @@ var ChatConversation = /* @__PURE__ */ forwardRef26(function ChatConversation2({
|
|
|
7063
7075
|
"aria-labelledby": ariaLabelledBy,
|
|
7064
7076
|
tabIndex: isEmpty ? void 0 : 0,
|
|
7065
7077
|
onScroll,
|
|
7066
|
-
children: /* @__PURE__ */
|
|
7078
|
+
children: /* @__PURE__ */ jsx68("div", { ref: contentRef, className: "ow-chat-conversation__content", children: /* @__PURE__ */ jsx68(ChatConversationContext.Provider, { value: context, children }) })
|
|
7067
7079
|
}
|
|
7068
7080
|
),
|
|
7069
|
-
isEmpty && empty ? /* @__PURE__ */
|
|
7070
|
-
jump.mounted ? /* @__PURE__ */
|
|
7081
|
+
isEmpty && empty ? /* @__PURE__ */ jsx68("div", { className: "ow-chat-conversation__empty", children: /* @__PURE__ */ jsx68("div", { className: "ow-chat-conversation__empty-inner", children: empty }) }) : null,
|
|
7082
|
+
jump.mounted ? /* @__PURE__ */ jsx68("div", { className: "ow-chat-conversation__jump", "data-state": jump.state, children: /* @__PURE__ */ jsxs50(
|
|
7071
7083
|
Button,
|
|
7072
7084
|
{
|
|
7073
7085
|
ref: jumpRef,
|
|
7074
7086
|
size: "sm",
|
|
7075
7087
|
shape: "pill",
|
|
7076
|
-
startIcon: /* @__PURE__ */
|
|
7088
|
+
startIcon: /* @__PURE__ */ jsx68(ArrowDownIcon, { size: 16 }),
|
|
7077
7089
|
"aria-label": newCount > 0 ? `${jumpLabel}, ${formatNewCount(newCount)}` : jumpLabel,
|
|
7078
7090
|
tabIndex: showJump ? void 0 : -1,
|
|
7079
7091
|
onClick: () => {
|
|
@@ -7082,12 +7094,12 @@ var ChatConversation = /* @__PURE__ */ forwardRef26(function ChatConversation2({
|
|
|
7082
7094
|
},
|
|
7083
7095
|
children: [
|
|
7084
7096
|
jumpLabel,
|
|
7085
|
-
newCount > 0 ? /* @__PURE__ */
|
|
7097
|
+
newCount > 0 ? /* @__PURE__ */ jsx68("span", { className: "ow-chat-conversation__count", children: formatNewCount(newCount) }) : null
|
|
7086
7098
|
]
|
|
7087
7099
|
}
|
|
7088
7100
|
) }) : null
|
|
7089
7101
|
] }),
|
|
7090
|
-
footer != null && footer !== false ? /* @__PURE__ */
|
|
7102
|
+
footer != null && footer !== false ? /* @__PURE__ */ jsx68("div", { className: "ow-chat-conversation__footer", children: /* @__PURE__ */ jsx68("div", { className: "ow-chat-conversation__footer-inner", children: footer }) }) : null
|
|
7091
7103
|
] });
|
|
7092
7104
|
});
|
|
7093
7105
|
|
|
@@ -7101,10 +7113,10 @@ import {
|
|
|
7101
7113
|
useRef as useRef37,
|
|
7102
7114
|
useState as useState31
|
|
7103
7115
|
} from "react";
|
|
7104
|
-
import { Fragment as Fragment10, jsx as
|
|
7116
|
+
import { Fragment as Fragment10, jsx as jsx69, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
7105
7117
|
function lucide(paths) {
|
|
7106
7118
|
return function Icon({ size: size2 = 16, strokeWidth = 2, ...props }) {
|
|
7107
|
-
return /* @__PURE__ */
|
|
7119
|
+
return /* @__PURE__ */ jsx69(
|
|
7108
7120
|
"svg",
|
|
7109
7121
|
{
|
|
7110
7122
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7126,48 +7138,48 @@ function lucide(paths) {
|
|
|
7126
7138
|
}
|
|
7127
7139
|
var BotIcon = /* @__PURE__ */ lucide(
|
|
7128
7140
|
/* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7129
|
-
/* @__PURE__ */
|
|
7130
|
-
/* @__PURE__ */
|
|
7131
|
-
/* @__PURE__ */
|
|
7132
|
-
/* @__PURE__ */
|
|
7133
|
-
/* @__PURE__ */
|
|
7134
|
-
/* @__PURE__ */
|
|
7141
|
+
/* @__PURE__ */ jsx69("path", { d: "M12 8V4H8" }),
|
|
7142
|
+
/* @__PURE__ */ jsx69("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }),
|
|
7143
|
+
/* @__PURE__ */ jsx69("path", { d: "M2 14h2" }),
|
|
7144
|
+
/* @__PURE__ */ jsx69("path", { d: "M20 14h2" }),
|
|
7145
|
+
/* @__PURE__ */ jsx69("path", { d: "M15 13v2" }),
|
|
7146
|
+
/* @__PURE__ */ jsx69("path", { d: "M9 13v2" })
|
|
7135
7147
|
] })
|
|
7136
7148
|
);
|
|
7137
7149
|
var RotateCcwIcon = /* @__PURE__ */ lucide(
|
|
7138
7150
|
/* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7139
|
-
/* @__PURE__ */
|
|
7140
|
-
/* @__PURE__ */
|
|
7151
|
+
/* @__PURE__ */ jsx69("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
|
|
7152
|
+
/* @__PURE__ */ jsx69("path", { d: "M3 3v5h5" })
|
|
7141
7153
|
] })
|
|
7142
7154
|
);
|
|
7143
7155
|
var ThumbsUpIcon = /* @__PURE__ */ lucide(
|
|
7144
7156
|
/* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7145
|
-
/* @__PURE__ */
|
|
7146
|
-
/* @__PURE__ */
|
|
7157
|
+
/* @__PURE__ */ jsx69("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z" }),
|
|
7158
|
+
/* @__PURE__ */ jsx69("path", { d: "M7 10v12" })
|
|
7147
7159
|
] })
|
|
7148
7160
|
);
|
|
7149
7161
|
var ThumbsDownIcon = /* @__PURE__ */ lucide(
|
|
7150
7162
|
/* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7151
|
-
/* @__PURE__ */
|
|
7152
|
-
/* @__PURE__ */
|
|
7163
|
+
/* @__PURE__ */ jsx69("path", { d: "M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z" }),
|
|
7164
|
+
/* @__PURE__ */ jsx69("path", { d: "M17 14V2" })
|
|
7153
7165
|
] })
|
|
7154
7166
|
);
|
|
7155
7167
|
var PencilIcon = /* @__PURE__ */ lucide(
|
|
7156
7168
|
/* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7157
|
-
/* @__PURE__ */
|
|
7158
|
-
/* @__PURE__ */
|
|
7169
|
+
/* @__PURE__ */ jsx69("path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }),
|
|
7170
|
+
/* @__PURE__ */ jsx69("path", { d: "m15 5 4 4" })
|
|
7159
7171
|
] })
|
|
7160
7172
|
);
|
|
7161
7173
|
var botSizes = { sm: 14, md: 16, lg: 18 };
|
|
7162
7174
|
function ChatAgentAvatar({ size: size2 = "md", label, className }) {
|
|
7163
|
-
return /* @__PURE__ */
|
|
7175
|
+
return /* @__PURE__ */ jsx69(
|
|
7164
7176
|
"span",
|
|
7165
7177
|
{
|
|
7166
7178
|
className: cx("ow-chat-avatar", size2 !== "md" && `ow-chat-avatar--${size2}`, className),
|
|
7167
7179
|
role: label ? "img" : void 0,
|
|
7168
7180
|
"aria-label": label,
|
|
7169
7181
|
"aria-hidden": label ? void 0 : true,
|
|
7170
|
-
children: /* @__PURE__ */
|
|
7182
|
+
children: /* @__PURE__ */ jsx69(BotIcon, { size: botSizes[size2] })
|
|
7171
7183
|
}
|
|
7172
7184
|
);
|
|
7173
7185
|
}
|
|
@@ -7192,10 +7204,10 @@ function formattersFor(locale) {
|
|
|
7192
7204
|
function MessageTime({ time, locale }) {
|
|
7193
7205
|
const date = typeof time === "string" ? new Date(time) : time;
|
|
7194
7206
|
if (Number.isNaN(date.getTime())) {
|
|
7195
|
-
return /* @__PURE__ */
|
|
7207
|
+
return /* @__PURE__ */ jsx69("time", { className: "ow-chat-message__time", children: String(time) });
|
|
7196
7208
|
}
|
|
7197
7209
|
const { short, full } = formattersFor(locale);
|
|
7198
|
-
return /* @__PURE__ */
|
|
7210
|
+
return /* @__PURE__ */ jsx69("time", { className: "ow-chat-message__time", dateTime: date.toISOString(), title: full.format(date), children: short.format(date) });
|
|
7199
7211
|
}
|
|
7200
7212
|
var skipCaret = '[aria-hidden="true"], .ow-visually-hidden';
|
|
7201
7213
|
function useStreamingCaret(bodyRef, contentRef, caretRef, active) {
|
|
@@ -7255,7 +7267,7 @@ var ChatMessage = /* @__PURE__ */ forwardRef27(function ChatMessage2({ from, chi
|
|
|
7255
7267
|
useEffect29(() => conversation?.register(id), [conversation, id]);
|
|
7256
7268
|
useStreamingCaret(bodyRef, contentRef, caretRef, streaming && from !== "system");
|
|
7257
7269
|
if (from === "system") {
|
|
7258
|
-
return /* @__PURE__ */
|
|
7270
|
+
return /* @__PURE__ */ jsx69(
|
|
7259
7271
|
"div",
|
|
7260
7272
|
{
|
|
7261
7273
|
ref,
|
|
@@ -7264,15 +7276,15 @@ var ChatMessage = /* @__PURE__ */ forwardRef27(function ChatMessage2({ from, chi
|
|
|
7264
7276
|
children: /* @__PURE__ */ jsxs51("span", { className: "ow-chat-message__system-text", children: [
|
|
7265
7277
|
children,
|
|
7266
7278
|
time !== void 0 ? /* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7267
|
-
/* @__PURE__ */
|
|
7268
|
-
/* @__PURE__ */
|
|
7279
|
+
/* @__PURE__ */ jsx69("span", { "aria-hidden": "true", children: " \xB7 " }),
|
|
7280
|
+
/* @__PURE__ */ jsx69(MessageTime, { time, locale })
|
|
7269
7281
|
] }) : null
|
|
7270
7282
|
] })
|
|
7271
7283
|
}
|
|
7272
7284
|
);
|
|
7273
7285
|
}
|
|
7274
7286
|
const isUser = from === "user";
|
|
7275
|
-
const avatarNode = avatar !== void 0 ? avatar : isUser ? null : /* @__PURE__ */
|
|
7287
|
+
const avatarNode = avatar !== void 0 ? avatar : isUser ? null : /* @__PURE__ */ jsx69(ChatAgentAvatar, {});
|
|
7276
7288
|
const hasHeader = name != null || time !== void 0;
|
|
7277
7289
|
const errorText = error ?? (isUser ? "Couldn't send this message." : "The answer didn't finish.");
|
|
7278
7290
|
return /* @__PURE__ */ jsxs51(
|
|
@@ -7291,22 +7303,22 @@ var ChatMessage = /* @__PURE__ */ forwardRef27(function ChatMessage2({ from, chi
|
|
|
7291
7303
|
"aria-busy": streaming || void 0,
|
|
7292
7304
|
...props,
|
|
7293
7305
|
children: [
|
|
7294
|
-
avatarNode != null && avatarNode !== false ? /* @__PURE__ */
|
|
7306
|
+
avatarNode != null && avatarNode !== false ? /* @__PURE__ */ jsx69("div", { className: "ow-chat-message__avatar", children: avatarNode }) : null,
|
|
7295
7307
|
/* @__PURE__ */ jsxs51("div", { className: "ow-chat-message__main", children: [
|
|
7296
7308
|
hasHeader ? /* @__PURE__ */ jsxs51("div", { className: "ow-chat-message__header", children: [
|
|
7297
|
-
name != null ? /* @__PURE__ */
|
|
7298
|
-
time !== void 0 ? /* @__PURE__ */
|
|
7299
|
-
] }) : /* @__PURE__ */
|
|
7309
|
+
name != null ? /* @__PURE__ */ jsx69("span", { className: "ow-chat-message__name", children: name }) : /* @__PURE__ */ jsx69("span", { className: "ow-visually-hidden", children: isUser ? "You" : "Agent" }),
|
|
7310
|
+
time !== void 0 ? /* @__PURE__ */ jsx69(MessageTime, { time, locale }) : null
|
|
7311
|
+
] }) : /* @__PURE__ */ jsx69("span", { className: "ow-visually-hidden", children: isUser ? "You" : "Agent" }),
|
|
7300
7312
|
/* @__PURE__ */ jsxs51("div", { ref: bodyRef, className: "ow-chat-message__body", children: [
|
|
7301
|
-
/* @__PURE__ */
|
|
7302
|
-
streaming ? /* @__PURE__ */
|
|
7313
|
+
/* @__PURE__ */ jsx69("div", { ref: contentRef, className: "ow-chat-message__content", children }),
|
|
7314
|
+
streaming ? /* @__PURE__ */ jsx69("span", { ref: caretRef, className: "ow-chat-message__caret", "aria-hidden": "true" }) : null
|
|
7303
7315
|
] }),
|
|
7304
7316
|
status === "error" ? /* @__PURE__ */ jsxs51("div", { className: cx("ow-chat-message__error", onRetry && "ow-chat-message__error--retry"), children: [
|
|
7305
|
-
/* @__PURE__ */
|
|
7306
|
-
/* @__PURE__ */
|
|
7307
|
-
onRetry ? /* @__PURE__ */
|
|
7317
|
+
/* @__PURE__ */ jsx69(CircleAlertIcon, { size: 16, className: "ow-chat-message__error-icon" }),
|
|
7318
|
+
/* @__PURE__ */ jsx69("span", { className: "ow-chat-message__error-text", children: errorText }),
|
|
7319
|
+
onRetry ? /* @__PURE__ */ jsx69(Button, { size: "sm", startIcon: /* @__PURE__ */ jsx69(RotateCcwIcon, { size: 16 }), onClick: onRetry, children: retryLabel }) : null
|
|
7308
7320
|
] }) : null,
|
|
7309
|
-
actions && !streaming ? /* @__PURE__ */
|
|
7321
|
+
actions && !streaming ? /* @__PURE__ */ jsx69("div", { className: "ow-chat-message__actions", children: actions }) : null
|
|
7310
7322
|
] })
|
|
7311
7323
|
]
|
|
7312
7324
|
}
|
|
@@ -7319,7 +7331,7 @@ function CopyAction({ text, label, copiedLabel }) {
|
|
|
7319
7331
|
useEffect29(() => () => window.clearTimeout(timer.current), []);
|
|
7320
7332
|
const current = copied ? copiedLabel : label;
|
|
7321
7333
|
return /* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7322
|
-
/* @__PURE__ */
|
|
7334
|
+
/* @__PURE__ */ jsx69(Tooltip, { label: current, children: /* @__PURE__ */ jsx69(
|
|
7323
7335
|
Button,
|
|
7324
7336
|
{
|
|
7325
7337
|
variant: "ghost",
|
|
@@ -7335,12 +7347,12 @@ function CopyAction({ text, label, copiedLabel }) {
|
|
|
7335
7347
|
}
|
|
7336
7348
|
},
|
|
7337
7349
|
children: /* @__PURE__ */ jsxs51("span", { className: "ow-chat-actions__copy-icon", children: [
|
|
7338
|
-
/* @__PURE__ */
|
|
7339
|
-
/* @__PURE__ */
|
|
7350
|
+
/* @__PURE__ */ jsx69(CopyIcon, { size: 16 }),
|
|
7351
|
+
/* @__PURE__ */ jsx69(CheckIcon, { size: 16 })
|
|
7340
7352
|
] })
|
|
7341
7353
|
}
|
|
7342
7354
|
) }),
|
|
7343
|
-
/* @__PURE__ */
|
|
7355
|
+
/* @__PURE__ */ jsx69("span", { className: "ow-visually-hidden", "aria-live": "polite", children: copied ? copiedLabel : "" })
|
|
7344
7356
|
] });
|
|
7345
7357
|
}
|
|
7346
7358
|
function ChatMessageActions({
|
|
@@ -7359,7 +7371,7 @@ function ChatMessageActions({
|
|
|
7359
7371
|
const [current, setCurrent] = useControllableState(rating, defaultRating, onRate);
|
|
7360
7372
|
const rate = (value, label, Icon) => {
|
|
7361
7373
|
const pressed = current === value;
|
|
7362
|
-
return /* @__PURE__ */
|
|
7374
|
+
return /* @__PURE__ */ jsx69(Tooltip, { label, children: /* @__PURE__ */ jsx69(
|
|
7363
7375
|
ToggleButton,
|
|
7364
7376
|
{
|
|
7365
7377
|
variant: "ghost",
|
|
@@ -7369,14 +7381,14 @@ function ChatMessageActions({
|
|
|
7369
7381
|
pressed,
|
|
7370
7382
|
className: "ow-chat-actions__rate",
|
|
7371
7383
|
onPressedChange: () => setCurrent(pressed ? null : value),
|
|
7372
|
-
children: /* @__PURE__ */
|
|
7384
|
+
children: /* @__PURE__ */ jsx69(Icon, { size: 16 })
|
|
7373
7385
|
}
|
|
7374
7386
|
) });
|
|
7375
7387
|
};
|
|
7376
7388
|
return /* @__PURE__ */ jsxs51(Toolbar, { variant: "plain", size: "sm", "aria-label": ariaLabel, className: cx("ow-chat-actions", className), children: [
|
|
7377
|
-
text !== void 0 ? /* @__PURE__ */
|
|
7378
|
-
onEdit ? /* @__PURE__ */
|
|
7379
|
-
onRetry ? /* @__PURE__ */
|
|
7389
|
+
text !== void 0 ? /* @__PURE__ */ jsx69(CopyAction, { text, label: words.copy, copiedLabel: words.copied }) : null,
|
|
7390
|
+
onEdit ? /* @__PURE__ */ jsx69(Tooltip, { label: words.edit, children: /* @__PURE__ */ jsx69(Button, { variant: "ghost", size: "sm", iconOnly: true, "aria-label": words.edit, onClick: onEdit, children: /* @__PURE__ */ jsx69(PencilIcon, { size: 16 }) }) }) : null,
|
|
7391
|
+
onRetry ? /* @__PURE__ */ jsx69(Tooltip, { label: words.retry, children: /* @__PURE__ */ jsx69(Button, { variant: "ghost", size: "sm", iconOnly: true, "aria-label": words.retry, onClick: onRetry, children: /* @__PURE__ */ jsx69(RotateCcwIcon, { size: 16 }) }) }) : null,
|
|
7380
7392
|
onRate ? /* @__PURE__ */ jsxs51(Fragment10, { children: [
|
|
7381
7393
|
rate("up", words.good, ThumbsUpIcon),
|
|
7382
7394
|
rate("down", words.bad, ThumbsDownIcon)
|
|
@@ -7386,31 +7398,31 @@ function ChatMessageActions({
|
|
|
7386
7398
|
}
|
|
7387
7399
|
|
|
7388
7400
|
// src/components/Chat/ChatLoader.tsx
|
|
7389
|
-
import { jsx as
|
|
7401
|
+
import { jsx as jsx70, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
7390
7402
|
function ChatLoader({ label, inline = false, name, avatar, srLabel = "Working\u2026", className }) {
|
|
7391
7403
|
const entering = useChatEntrance();
|
|
7392
|
-
const indicator = label != null ? /* @__PURE__ */
|
|
7393
|
-
/* @__PURE__ */
|
|
7394
|
-
/* @__PURE__ */
|
|
7395
|
-
/* @__PURE__ */
|
|
7396
|
-
/* @__PURE__ */
|
|
7404
|
+
const indicator = label != null ? /* @__PURE__ */ jsx70(TextShimmer, { className: "ow-chat-loader__label", children: label }) : /* @__PURE__ */ jsxs52("span", { className: "ow-chat-loader__dots", children: [
|
|
7405
|
+
/* @__PURE__ */ jsx70("span", { className: "ow-chat-loader__dot", "aria-hidden": "true" }),
|
|
7406
|
+
/* @__PURE__ */ jsx70("span", { className: "ow-chat-loader__dot", "aria-hidden": "true" }),
|
|
7407
|
+
/* @__PURE__ */ jsx70("span", { className: "ow-chat-loader__dot", "aria-hidden": "true" }),
|
|
7408
|
+
/* @__PURE__ */ jsx70("span", { className: "ow-visually-hidden", children: srLabel })
|
|
7397
7409
|
] });
|
|
7398
7410
|
if (inline) {
|
|
7399
|
-
return /* @__PURE__ */
|
|
7411
|
+
return /* @__PURE__ */ jsx70("span", { role: "status", className: cx("ow-chat-loader", "ow-chat-loader--inline", className), children: indicator });
|
|
7400
7412
|
}
|
|
7401
|
-
const avatarNode = avatar === void 0 ? /* @__PURE__ */
|
|
7413
|
+
const avatarNode = avatar === void 0 ? /* @__PURE__ */ jsx70(ChatAgentAvatar, {}) : avatar;
|
|
7402
7414
|
return /* @__PURE__ */ jsxs52("div", { role: "status", className: cx("ow-chat-message", "ow-chat-message--assistant", "ow-chat-loader", entering && "ow-chat-loader--enter", className), children: [
|
|
7403
|
-
avatarNode != null && avatarNode !== false ? /* @__PURE__ */
|
|
7415
|
+
avatarNode != null && avatarNode !== false ? /* @__PURE__ */ jsx70("div", { className: "ow-chat-message__avatar", children: avatarNode }) : null,
|
|
7404
7416
|
/* @__PURE__ */ jsxs52("div", { className: "ow-chat-message__main", children: [
|
|
7405
|
-
name != null ? /* @__PURE__ */
|
|
7406
|
-
/* @__PURE__ */
|
|
7417
|
+
name != null ? /* @__PURE__ */ jsx70("div", { className: "ow-chat-message__header", children: /* @__PURE__ */ jsx70("span", { className: "ow-chat-message__name", children: name }) }) : null,
|
|
7418
|
+
/* @__PURE__ */ jsx70("div", { className: "ow-chat-loader__line", children: indicator })
|
|
7407
7419
|
] })
|
|
7408
7420
|
] });
|
|
7409
7421
|
}
|
|
7410
7422
|
|
|
7411
7423
|
// src/components/ChatTool/ChatTool.tsx
|
|
7412
7424
|
import { forwardRef as forwardRef28, useEffect as useEffect30, useId as useId24, useRef as useRef38, useState as useState32 } from "react";
|
|
7413
|
-
import { Fragment as Fragment11, jsx as
|
|
7425
|
+
import { Fragment as Fragment11, jsx as jsx71, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
7414
7426
|
var statusWords = {
|
|
7415
7427
|
pending: "Not started",
|
|
7416
7428
|
running: "Running",
|
|
@@ -7420,7 +7432,7 @@ var statusWords = {
|
|
|
7420
7432
|
cancelled: "Cancelled"
|
|
7421
7433
|
};
|
|
7422
7434
|
function SlashIcon() {
|
|
7423
|
-
return /* @__PURE__ */
|
|
7435
|
+
return /* @__PURE__ */ jsx71(
|
|
7424
7436
|
"svg",
|
|
7425
7437
|
{
|
|
7426
7438
|
width: 12,
|
|
@@ -7432,7 +7444,7 @@ function SlashIcon() {
|
|
|
7432
7444
|
strokeLinecap: "round",
|
|
7433
7445
|
"aria-hidden": "true",
|
|
7434
7446
|
focusable: "false",
|
|
7435
|
-
children: /* @__PURE__ */
|
|
7447
|
+
children: /* @__PURE__ */ jsx71("path", { d: "M7 17 17 7" })
|
|
7436
7448
|
}
|
|
7437
7449
|
);
|
|
7438
7450
|
}
|
|
@@ -7450,17 +7462,17 @@ function ExclamationIcon() {
|
|
|
7450
7462
|
"aria-hidden": "true",
|
|
7451
7463
|
focusable: "false",
|
|
7452
7464
|
children: [
|
|
7453
|
-
/* @__PURE__ */
|
|
7454
|
-
/* @__PURE__ */
|
|
7465
|
+
/* @__PURE__ */ jsx71("path", { d: "M12 5v9" }),
|
|
7466
|
+
/* @__PURE__ */ jsx71("path", { d: "M12 19h.01" })
|
|
7455
7467
|
]
|
|
7456
7468
|
}
|
|
7457
7469
|
);
|
|
7458
7470
|
}
|
|
7459
7471
|
function ChatStatusMarker({ status, icon: icon2 }) {
|
|
7460
7472
|
const showsIcon = Boolean(icon2) && (status === "success" || status === "pending");
|
|
7461
|
-
const glyph = status === "running" ? /* @__PURE__ */
|
|
7473
|
+
const glyph = status === "running" ? /* @__PURE__ */ jsx71(Spinner, { size: "sm", label: "" }) : status === "error" ? /* @__PURE__ */ jsx71(XIcon, { size: 12, strokeWidth: 3 }) : status === "approval" ? /* @__PURE__ */ jsx71(ExclamationIcon, {}) : status === "cancelled" ? /* @__PURE__ */ jsx71(SlashIcon, {}) : showsIcon ? icon2 : status === "success" ? /* @__PURE__ */ jsx71(CheckIcon, { size: 12, strokeWidth: 3 }) : null;
|
|
7462
7474
|
return /* @__PURE__ */ jsxs53("span", { className: cx("ow-chat-status", `ow-chat-status--${status}`, showsIcon && "ow-chat-status--icon"), children: [
|
|
7463
|
-
/* @__PURE__ */
|
|
7475
|
+
/* @__PURE__ */ jsx71("span", { className: "ow-chat-status__glyph", "aria-hidden": "true", children: glyph }),
|
|
7464
7476
|
/* @__PURE__ */ jsxs53("span", { className: "ow-visually-hidden", children: [
|
|
7465
7477
|
statusWords[status],
|
|
7466
7478
|
": "
|
|
@@ -7484,7 +7496,7 @@ function formatDuration(ms, locale) {
|
|
|
7484
7496
|
return rest ? `${number(hours)} h ${number(rest)} min` : `${number(hours)} h`;
|
|
7485
7497
|
}
|
|
7486
7498
|
function ChatDuration({ ms, locale, className }) {
|
|
7487
|
-
return /* @__PURE__ */
|
|
7499
|
+
return /* @__PURE__ */ jsx71("time", { dateTime: `PT${Math.max(0, Math.round(ms)) / 1e3}S`, className, children: formatDuration(ms, locale) });
|
|
7488
7500
|
}
|
|
7489
7501
|
function useStatusExpansion({
|
|
7490
7502
|
expanded,
|
|
@@ -7527,7 +7539,7 @@ function ChatCollapse({
|
|
|
7527
7539
|
useEffect30(() => {
|
|
7528
7540
|
if (ref.current) ref.current.inert = !open;
|
|
7529
7541
|
}, [open]);
|
|
7530
|
-
return /* @__PURE__ */
|
|
7542
|
+
return /* @__PURE__ */ jsx71("div", { ref, id, className: cx("ow-chat-collapse", bleed && "ow-chat-collapse--bleed"), "data-open": open, children: /* @__PURE__ */ jsx71("div", { className: "ow-chat-collapse__clip", children: /* @__PURE__ */ jsx71("div", { className, children }) }) });
|
|
7531
7543
|
}
|
|
7532
7544
|
var codeMaxHeight = 280;
|
|
7533
7545
|
function formatInput(input) {
|
|
@@ -7597,20 +7609,20 @@ var ChatTool = /* @__PURE__ */ forwardRef28(function ChatTool2({
|
|
|
7597
7609
|
}, [needsApproval]);
|
|
7598
7610
|
const running = status === "running";
|
|
7599
7611
|
const header = /* @__PURE__ */ jsxs53(Fragment11, { children: [
|
|
7600
|
-
/* @__PURE__ */
|
|
7601
|
-
icon2 ? /* @__PURE__ */
|
|
7612
|
+
/* @__PURE__ */ jsx71(ChatStatusMarker, { status }),
|
|
7613
|
+
icon2 ? /* @__PURE__ */ jsx71("span", { className: "ow-chat-tool__icon", "aria-hidden": "true", children: icon2 }) : null,
|
|
7602
7614
|
/* @__PURE__ */ jsxs53("span", { className: "ow-chat-tool__main", children: [
|
|
7603
7615
|
/* @__PURE__ */ jsxs53("span", { className: "ow-chat-tool__heading", children: [
|
|
7604
|
-
/* @__PURE__ */
|
|
7605
|
-
name ? /* @__PURE__ */
|
|
7616
|
+
/* @__PURE__ */ jsx71("span", { className: "ow-chat-tool__title", children: running ? /* @__PURE__ */ jsx71(TextShimmer, { children: title }) : title }),
|
|
7617
|
+
name ? /* @__PURE__ */ jsx71(Code, { className: "ow-chat-tool__name", children: name }) : null
|
|
7606
7618
|
] }),
|
|
7607
7619
|
hasMeta ? /* @__PURE__ */ jsxs53("span", { className: "ow-chat-tool__meta", children: [
|
|
7608
|
-
summary ? /* @__PURE__ */
|
|
7609
|
-
summary && duration !== void 0 ? /* @__PURE__ */
|
|
7610
|
-
duration !== void 0 ? /* @__PURE__ */
|
|
7620
|
+
summary ? /* @__PURE__ */ jsx71("span", { className: "ow-chat-tool__summary", children: summary }) : null,
|
|
7621
|
+
summary && duration !== void 0 ? /* @__PURE__ */ jsx71("span", { className: "ow-chat-tool__dot", "aria-hidden": "true", children: "\xB7" }) : null,
|
|
7622
|
+
duration !== void 0 ? /* @__PURE__ */ jsx71(ChatDuration, { ms: duration, locale, className: "ow-chat-tool__duration" }) : null
|
|
7611
7623
|
] }) : null
|
|
7612
7624
|
] }),
|
|
7613
|
-
hasDetails ? /* @__PURE__ */
|
|
7625
|
+
hasDetails ? /* @__PURE__ */ jsx71("span", { className: "ow-chat-tool__chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx71(ChevronRightIcon, { size: 14 }) }) : null
|
|
7614
7626
|
] });
|
|
7615
7627
|
return /* @__PURE__ */ jsxs53(
|
|
7616
7628
|
"div",
|
|
@@ -7627,7 +7639,7 @@ var ChatTool = /* @__PURE__ */ forwardRef28(function ChatTool2({
|
|
|
7627
7639
|
tabIndex: hasDetails ? void 0 : -1,
|
|
7628
7640
|
...props,
|
|
7629
7641
|
children: [
|
|
7630
|
-
hasDetails ? /* @__PURE__ */
|
|
7642
|
+
hasDetails ? /* @__PURE__ */ jsx71(
|
|
7631
7643
|
"button",
|
|
7632
7644
|
{
|
|
7633
7645
|
ref: triggerRef,
|
|
@@ -7639,28 +7651,28 @@ var ChatTool = /* @__PURE__ */ forwardRef28(function ChatTool2({
|
|
|
7639
7651
|
onClick: toggle,
|
|
7640
7652
|
children: header
|
|
7641
7653
|
}
|
|
7642
|
-
) : /* @__PURE__ */
|
|
7654
|
+
) : /* @__PURE__ */ jsx71("div", { className: "ow-chat-tool__header", children: header }),
|
|
7643
7655
|
hasDetails ? /* @__PURE__ */ jsxs53(ChatCollapse, { id: `${id}-details`, open: isOpen, className: "ow-chat-tool__details", children: [
|
|
7644
7656
|
hasInput ? /* @__PURE__ */ jsxs53("div", { className: "ow-chat-tool__section", children: [
|
|
7645
|
-
/* @__PURE__ */
|
|
7646
|
-
typeof input === "string" && !input.includes("\n") ? /* @__PURE__ */
|
|
7657
|
+
/* @__PURE__ */ jsx71("span", { className: "ow-chat-tool__label", children: "Input" }),
|
|
7658
|
+
typeof input === "string" && !input.includes("\n") ? /* @__PURE__ */ jsx71(Snippet, { value: input, prompt: null }) : /* @__PURE__ */ jsx71(CodeBlock, { code: formatInput(input), language: typeof input === "string" ? void 0 : "json", maxHeight: codeMaxHeight })
|
|
7647
7659
|
] }) : null,
|
|
7648
7660
|
hasOutput ? /* @__PURE__ */ jsxs53("div", { className: "ow-chat-tool__section", children: [
|
|
7649
|
-
/* @__PURE__ */
|
|
7650
|
-
typeof output === "string" ? /* @__PURE__ */
|
|
7661
|
+
/* @__PURE__ */ jsx71("span", { className: "ow-chat-tool__label", children: "Output" }),
|
|
7662
|
+
typeof output === "string" ? /* @__PURE__ */ jsx71(CodeBlock, { code: output, maxHeight: codeMaxHeight }) : /* @__PURE__ */ jsx71("div", { className: "ow-chat-tool__output", children: output })
|
|
7651
7663
|
] }) : null,
|
|
7652
7664
|
hasError ? /* @__PURE__ */ jsxs53("div", { className: "ow-chat-tool__section", children: [
|
|
7653
|
-
/* @__PURE__ */
|
|
7654
|
-
/* @__PURE__ */
|
|
7665
|
+
/* @__PURE__ */ jsx71("span", { className: "ow-chat-tool__label", children: "Error" }),
|
|
7666
|
+
/* @__PURE__ */ jsx71("div", { className: "ow-chat-tool__error", children: error })
|
|
7655
7667
|
] }) : null
|
|
7656
7668
|
] }) : null,
|
|
7657
7669
|
needsApproval ? /* @__PURE__ */ jsxs53("div", { className: "ow-chat-tool__approval", role: "group", "aria-labelledby": `${id}-request`, children: [
|
|
7658
|
-
/* @__PURE__ */
|
|
7670
|
+
/* @__PURE__ */ jsx71("p", { ref: messageRef, id: `${id}-request`, className: "ow-chat-tool__request", children: approvalMessage ?? (name ? /* @__PURE__ */ jsxs53(Fragment11, { children: [
|
|
7659
7671
|
"Wants to run ",
|
|
7660
|
-
/* @__PURE__ */
|
|
7672
|
+
/* @__PURE__ */ jsx71(Code, { children: name })
|
|
7661
7673
|
] }) : "Wants to go ahead") }),
|
|
7662
7674
|
/* @__PURE__ */ jsxs53("div", { className: "ow-chat-tool__actions", children: [
|
|
7663
|
-
/* @__PURE__ */
|
|
7675
|
+
/* @__PURE__ */ jsx71(
|
|
7664
7676
|
Button,
|
|
7665
7677
|
{
|
|
7666
7678
|
variant: "primary",
|
|
@@ -7672,7 +7684,7 @@ var ChatTool = /* @__PURE__ */ forwardRef28(function ChatTool2({
|
|
|
7672
7684
|
children: approveLabel
|
|
7673
7685
|
}
|
|
7674
7686
|
),
|
|
7675
|
-
/* @__PURE__ */
|
|
7687
|
+
/* @__PURE__ */ jsx71(
|
|
7676
7688
|
Button,
|
|
7677
7689
|
{
|
|
7678
7690
|
size: "sm",
|
|
@@ -7685,7 +7697,7 @@ var ChatTool = /* @__PURE__ */ forwardRef28(function ChatTool2({
|
|
|
7685
7697
|
)
|
|
7686
7698
|
] })
|
|
7687
7699
|
] }) : null,
|
|
7688
|
-
/* @__PURE__ */
|
|
7700
|
+
/* @__PURE__ */ jsx71("span", { className: "ow-visually-hidden", "aria-live": "polite", children: announcement })
|
|
7689
7701
|
]
|
|
7690
7702
|
}
|
|
7691
7703
|
);
|
|
@@ -7693,7 +7705,7 @@ var ChatTool = /* @__PURE__ */ forwardRef28(function ChatTool2({
|
|
|
7693
7705
|
|
|
7694
7706
|
// src/components/ChainOfThought/ChainOfThought.tsx
|
|
7695
7707
|
import { forwardRef as forwardRef29, useId as useId25 } from "react";
|
|
7696
|
-
import { jsx as
|
|
7708
|
+
import { jsx as jsx72, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
7697
7709
|
var plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
7698
7710
|
var ChainOfThought = /* @__PURE__ */ forwardRef29(function ChainOfThought2({
|
|
7699
7711
|
steps = [],
|
|
@@ -7726,9 +7738,9 @@ var ChainOfThought = /* @__PURE__ */ forwardRef29(function ChainOfThought2({
|
|
|
7726
7738
|
const heading = label ?? (running ? "Thinking\u2026" : duration !== void 0 ? `Thought for ${formatDuration(duration, locale)}` : "Reasoning");
|
|
7727
7739
|
const count = steps.length > 0 ? running ? `${finished} of ${plural(steps.length, "step")}` : plural(steps.length, "step") : null;
|
|
7728
7740
|
const headerText = /* @__PURE__ */ jsxs54("span", { className: "ow-chat-toggle__text", children: [
|
|
7729
|
-
/* @__PURE__ */
|
|
7741
|
+
/* @__PURE__ */ jsx72("span", { className: "ow-chain-of-thought__label", children: running ? /* @__PURE__ */ jsx72(TextShimmer, { children: heading }) : heading }),
|
|
7730
7742
|
count ? /* @__PURE__ */ jsxs54("span", { className: "ow-chat-toggle__meta", children: [
|
|
7731
|
-
/* @__PURE__ */
|
|
7743
|
+
/* @__PURE__ */ jsx72("span", { "aria-hidden": "true", children: "\xB7 " }),
|
|
7732
7744
|
count,
|
|
7733
7745
|
failed > 0 ? /* @__PURE__ */ jsxs54("span", { className: "ow-chain-of-thought__failed", children: [
|
|
7734
7746
|
", ",
|
|
@@ -7739,16 +7751,16 @@ var ChainOfThought = /* @__PURE__ */ forwardRef29(function ChainOfThought2({
|
|
|
7739
7751
|
] });
|
|
7740
7752
|
return /* @__PURE__ */ jsxs54("div", { ref, className: cx("ow-chain-of-thought", className), "data-status": status, "aria-busy": running || void 0, ...props, children: [
|
|
7741
7753
|
hasBody ? /* @__PURE__ */ jsxs54("button", { type: "button", className: "ow-chat-toggle", "aria-expanded": isOpen, "aria-controls": `${id}-body`, onClick: toggle, children: [
|
|
7742
|
-
/* @__PURE__ */
|
|
7754
|
+
/* @__PURE__ */ jsx72("span", { className: "ow-chat-toggle__chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx72(ChevronRightIcon, { size: 14 }) }),
|
|
7743
7755
|
headerText
|
|
7744
|
-
] }) : /* @__PURE__ */
|
|
7756
|
+
] }) : /* @__PURE__ */ jsx72("div", { className: "ow-chat-toggle ow-chain-of-thought__static", children: headerText }),
|
|
7745
7757
|
hasBody ? /* @__PURE__ */ jsxs54(ChatCollapse, { id: `${id}-body`, open: isOpen, bleed: true, className: "ow-chain-of-thought__body", children: [
|
|
7746
|
-
hasReasoning ? /* @__PURE__ */
|
|
7747
|
-
steps.length > 0 ? /* @__PURE__ */
|
|
7748
|
-
/* @__PURE__ */
|
|
7758
|
+
hasReasoning ? /* @__PURE__ */ jsx72("div", { className: "ow-chain-of-thought__reasoning", children }) : null,
|
|
7759
|
+
steps.length > 0 ? /* @__PURE__ */ jsx72("ol", { className: "ow-chain-of-thought__steps", children: steps.map((step) => /* @__PURE__ */ jsxs54("li", { className: "ow-chain-of-thought__step", "data-status": step.status, children: [
|
|
7760
|
+
/* @__PURE__ */ jsx72(ChatStatusMarker, { status: step.status, icon: step.icon }),
|
|
7749
7761
|
/* @__PURE__ */ jsxs54("div", { className: "ow-chain-of-thought__step-body", children: [
|
|
7750
|
-
/* @__PURE__ */
|
|
7751
|
-
step.detail !== void 0 && step.detail !== null ? /* @__PURE__ */
|
|
7762
|
+
/* @__PURE__ */ jsx72("span", { className: "ow-chain-of-thought__step-title", children: step.status === "running" ? /* @__PURE__ */ jsx72(TextShimmer, { children: step.title }) : step.title }),
|
|
7763
|
+
step.detail !== void 0 && step.detail !== null ? /* @__PURE__ */ jsx72("div", { className: "ow-chain-of-thought__detail", children: step.detail }) : null
|
|
7752
7764
|
] })
|
|
7753
7765
|
] }, step.id)) }) : null
|
|
7754
7766
|
] }) : null
|
|
@@ -7757,7 +7769,7 @@ var ChainOfThought = /* @__PURE__ */ forwardRef29(function ChainOfThought2({
|
|
|
7757
7769
|
|
|
7758
7770
|
// src/components/ChatSource/ChatSource.tsx
|
|
7759
7771
|
import { forwardRef as forwardRef30, useCallback as useCallback11, useEffect as useEffect31, useId as useId26, useRef as useRef39, useState as useState33 } from "react";
|
|
7760
|
-
import { Fragment as Fragment12, jsx as
|
|
7772
|
+
import { Fragment as Fragment12, jsx as jsx73, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
7761
7773
|
var openDelay = 250;
|
|
7762
7774
|
var closeDelay = 150;
|
|
7763
7775
|
var ChatSource = /* @__PURE__ */ forwardRef30(function ChatSource2({
|
|
@@ -7826,7 +7838,7 @@ var ChatSource = /* @__PURE__ */ forwardRef30(function ChatSource2({
|
|
|
7826
7838
|
onClick?.(event);
|
|
7827
7839
|
}
|
|
7828
7840
|
};
|
|
7829
|
-
const chipText = /* @__PURE__ */
|
|
7841
|
+
const chipText = /* @__PURE__ */ jsx73("span", { className: "ow-chat-source__chip-text", children: index ?? label });
|
|
7830
7842
|
return /* @__PURE__ */ jsxs55(
|
|
7831
7843
|
"span",
|
|
7832
7844
|
{
|
|
@@ -7839,19 +7851,19 @@ var ChatSource = /* @__PURE__ */ forwardRef30(function ChatSource2({
|
|
|
7839
7851
|
if (event.pointerType === "mouse") schedule(false, closeDelay);
|
|
7840
7852
|
},
|
|
7841
7853
|
children: [
|
|
7842
|
-
href ? /* @__PURE__ */
|
|
7854
|
+
href ? /* @__PURE__ */ jsx73("a", { href, ...externalProps, ...chipProps, children: chipText }) : /* @__PURE__ */ jsx73("button", { type: "button", ...chipProps, children: chipText }),
|
|
7843
7855
|
/* @__PURE__ */ jsxs55("span", { ref: cardRef, ...manualPopover, hidden: !mounted, "data-state": state, className: "ow-chat-source-card ow-floating", style, children: [
|
|
7844
7856
|
/* @__PURE__ */ jsxs55("span", { className: "ow-chat-source-card__header", children: [
|
|
7845
|
-
icon2 ? /* @__PURE__ */
|
|
7846
|
-
/* @__PURE__ */
|
|
7857
|
+
icon2 ? /* @__PURE__ */ jsx73("span", { className: "ow-chat-source-card__icon", "aria-hidden": "true", children: icon2 }) : null,
|
|
7858
|
+
/* @__PURE__ */ jsx73("span", { id: `${id}-title`, className: "ow-chat-source-card__title", children: title })
|
|
7847
7859
|
] }),
|
|
7848
|
-
source ? /* @__PURE__ */
|
|
7849
|
-
snippet ? /* @__PURE__ */
|
|
7860
|
+
source ? /* @__PURE__ */ jsx73("span", { id: `${id}-source`, className: "ow-chat-source-card__source", children: source }) : null,
|
|
7861
|
+
snippet ? /* @__PURE__ */ jsx73("span", { id: `${id}-snippet`, className: cx("ow-chat-source-card__snippet", `ow-chat-source-card__snippet--${snippetFormat}`), children: snippet }) : null,
|
|
7850
7862
|
href ? (
|
|
7851
7863
|
// The chip is the same link, so this one stays out of the tab order.
|
|
7852
7864
|
/* @__PURE__ */ jsxs55("a", { href, ...externalProps, tabIndex: -1, className: cx(linkClassName({ variant: "standalone" }), "ow-chat-source-card__open"), children: [
|
|
7853
7865
|
openLabel,
|
|
7854
|
-
/* @__PURE__ */
|
|
7866
|
+
/* @__PURE__ */ jsx73(ArrowUpRightIcon, { size: 13 })
|
|
7855
7867
|
] })
|
|
7856
7868
|
) : null
|
|
7857
7869
|
] })
|
|
@@ -7865,28 +7877,28 @@ var ChatSources = /* @__PURE__ */ forwardRef30(function ChatSources2({ sources,
|
|
|
7865
7877
|
if (sources.length === 0) return null;
|
|
7866
7878
|
return /* @__PURE__ */ jsxs55("div", { ref, className: cx("ow-chat-sources", className), ...props, children: [
|
|
7867
7879
|
/* @__PURE__ */ jsxs55("button", { type: "button", className: "ow-chat-toggle", "aria-expanded": isOpen, "aria-controls": `${id}-list`, onClick: () => setOpen(!isOpen), children: [
|
|
7868
|
-
/* @__PURE__ */
|
|
7869
|
-
/* @__PURE__ */
|
|
7880
|
+
/* @__PURE__ */ jsx73("span", { className: "ow-chat-toggle__chevron", "aria-hidden": "true", children: /* @__PURE__ */ jsx73(ChevronRightIcon, { size: 14 }) }),
|
|
7881
|
+
/* @__PURE__ */ jsx73("span", { className: "ow-chat-toggle__text", children: label ?? `${sources.length} ${sources.length === 1 ? "source" : "sources"}` })
|
|
7870
7882
|
] }),
|
|
7871
|
-
/* @__PURE__ */
|
|
7883
|
+
/* @__PURE__ */ jsx73(ChatCollapse, { id: `${id}-list`, open: isOpen, bleed: true, className: "ow-chat-sources__body", children: /* @__PURE__ */ jsx73("ul", { className: "ow-chat-sources__list", children: sources.map((item, position) => {
|
|
7872
7884
|
const content = /* @__PURE__ */ jsxs55(Fragment12, { children: [
|
|
7873
7885
|
/* @__PURE__ */ jsxs55("span", { className: "ow-chat-sources__lead", children: [
|
|
7874
7886
|
item.index !== void 0 ? /* @__PURE__ */ jsxs55("span", { className: "ow-chat-sources__index", children: [
|
|
7875
|
-
/* @__PURE__ */
|
|
7887
|
+
/* @__PURE__ */ jsx73("span", { className: "ow-visually-hidden", children: "Source " }),
|
|
7876
7888
|
item.index
|
|
7877
7889
|
] }) : null,
|
|
7878
|
-
item.icon || item.index === void 0 ? /* @__PURE__ */
|
|
7890
|
+
item.icon || item.index === void 0 ? /* @__PURE__ */ jsx73("span", { className: "ow-chat-sources__icon", "aria-hidden": "true", children: item.icon ?? /* @__PURE__ */ jsx73(FileIcon, { size: 15 }) }) : null
|
|
7879
7891
|
] }),
|
|
7880
7892
|
/* @__PURE__ */ jsxs55("span", { className: "ow-chat-sources__text", children: [
|
|
7881
|
-
/* @__PURE__ */
|
|
7882
|
-
item.source ? /* @__PURE__ */
|
|
7893
|
+
/* @__PURE__ */ jsx73("span", { className: "ow-chat-sources__title", children: item.title }),
|
|
7894
|
+
item.source ? /* @__PURE__ */ jsx73("span", { className: "ow-chat-sources__source", children: item.source }) : null
|
|
7883
7895
|
] }),
|
|
7884
7896
|
item.href && item.external ? /* @__PURE__ */ jsxs55(Fragment12, { children: [
|
|
7885
|
-
/* @__PURE__ */
|
|
7886
|
-
/* @__PURE__ */
|
|
7897
|
+
/* @__PURE__ */ jsx73("span", { className: "ow-chat-sources__external", "aria-hidden": "true", children: /* @__PURE__ */ jsx73(ArrowUpRightIcon, { size: 14 }) }),
|
|
7898
|
+
/* @__PURE__ */ jsx73("span", { className: "ow-visually-hidden", children: " (opens in a new tab)" })
|
|
7887
7899
|
] }) : null
|
|
7888
7900
|
] });
|
|
7889
|
-
return /* @__PURE__ */
|
|
7901
|
+
return /* @__PURE__ */ jsx73("li", { children: item.href ? /* @__PURE__ */ jsx73(
|
|
7890
7902
|
"a",
|
|
7891
7903
|
{
|
|
7892
7904
|
href: item.href,
|
|
@@ -7894,7 +7906,7 @@ var ChatSources = /* @__PURE__ */ forwardRef30(function ChatSources2({ sources,
|
|
|
7894
7906
|
...item.external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
7895
7907
|
children: content
|
|
7896
7908
|
}
|
|
7897
|
-
) : /* @__PURE__ */
|
|
7909
|
+
) : /* @__PURE__ */ jsx73("div", { className: "ow-chat-sources__card", children: content }) }, item.id ?? item.index ?? position);
|
|
7898
7910
|
}) }) })
|
|
7899
7911
|
] });
|
|
7900
7912
|
});
|
|
@@ -7902,7 +7914,7 @@ var ChatSources = /* @__PURE__ */ forwardRef30(function ChatSources2({ sources,
|
|
|
7902
7914
|
// src/components/ColorPicker/ColorPicker.tsx
|
|
7903
7915
|
import { forwardRef as forwardRef31, useCallback as useCallback12, useEffect as useEffect32, useId as useId27, useRef as useRef40, useState as useState34 } from "react";
|
|
7904
7916
|
import { HexAlphaColorPicker, HexColorInput, HexColorPicker } from "react-colorful";
|
|
7905
|
-
import { Fragment as Fragment13, jsx as
|
|
7917
|
+
import { Fragment as Fragment13, jsx as jsx74, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
7906
7918
|
var swatchColor = (swatch) => typeof swatch === "string" ? swatch : swatch.color;
|
|
7907
7919
|
var swatchName = (swatch) => typeof swatch === "string" ? swatch : swatch.name;
|
|
7908
7920
|
var same = (a, b) => a.toLowerCase().replace(/^#/, "") === b.toLowerCase().replace(/^#/, "");
|
|
@@ -7938,12 +7950,12 @@ function ColorPicker({
|
|
|
7938
7950
|
}
|
|
7939
7951
|
}
|
|
7940
7952
|
return /* @__PURE__ */ jsxs56("div", { ref: rootRef, role: "group", "aria-label": ariaLabel, className: cx("ow-color-picker", className), children: [
|
|
7941
|
-
/* @__PURE__ */
|
|
7953
|
+
/* @__PURE__ */ jsx74(Picker, { color, onChange: change }),
|
|
7942
7954
|
showInput || eyeDropper && canPick ? /* @__PURE__ */ jsxs56("div", { className: "ow-color-picker__row", children: [
|
|
7943
|
-
eyeDropper && canPick ? /* @__PURE__ */
|
|
7955
|
+
eyeDropper && canPick ? /* @__PURE__ */ jsx74("button", { type: "button", className: "ow-color-picker__dropper", "aria-label": "Pick a colour from the screen", onClick: pickFromScreen, children: /* @__PURE__ */ jsx74(PipetteIcon, { size: 15 }) }) : null,
|
|
7944
7956
|
showInput ? /* @__PURE__ */ jsxs56("span", { className: "ow-input-group ow-input-group--sm ow-color-picker__input", children: [
|
|
7945
|
-
/* @__PURE__ */
|
|
7946
|
-
/* @__PURE__ */
|
|
7957
|
+
/* @__PURE__ */ jsx74("span", { className: "ow-input-group__addon", "aria-hidden": "true", children: "#" }),
|
|
7958
|
+
/* @__PURE__ */ jsx74(
|
|
7947
7959
|
HexColorInput,
|
|
7948
7960
|
{
|
|
7949
7961
|
className: "ow-input-group__input",
|
|
@@ -7955,11 +7967,11 @@ function ColorPicker({
|
|
|
7955
7967
|
}
|
|
7956
7968
|
)
|
|
7957
7969
|
] }) : null,
|
|
7958
|
-
/* @__PURE__ */
|
|
7970
|
+
/* @__PURE__ */ jsx74("span", { className: "ow-color-picker__preview", style: { "--ow-color-picker-value": color }, "aria-hidden": "true" })
|
|
7959
7971
|
] }) : null,
|
|
7960
|
-
swatches?.length ? /* @__PURE__ */
|
|
7972
|
+
swatches?.length ? /* @__PURE__ */ jsx74("div", { className: "ow-color-picker__swatches", role: "group", "aria-label": "Swatches", children: swatches.map((swatch) => {
|
|
7961
7973
|
const swatchValue = swatchColor(swatch);
|
|
7962
|
-
return /* @__PURE__ */
|
|
7974
|
+
return /* @__PURE__ */ jsx74(
|
|
7963
7975
|
"button",
|
|
7964
7976
|
{
|
|
7965
7977
|
type: "button",
|
|
@@ -8044,13 +8056,13 @@ var ColorField = /* @__PURE__ */ forwardRef31(function ColorField2({
|
|
|
8044
8056
|
}
|
|
8045
8057
|
},
|
|
8046
8058
|
children: [
|
|
8047
|
-
/* @__PURE__ */
|
|
8048
|
-
/* @__PURE__ */
|
|
8049
|
-
/* @__PURE__ */
|
|
8059
|
+
/* @__PURE__ */ jsx74("span", { className: "ow-color-field__swatch", style: { "--ow-color-picker-value": color }, "aria-hidden": "true" }),
|
|
8060
|
+
/* @__PURE__ */ jsx74("span", { id: `${panelId}-value`, className: "ow-select__value ow-color-field__value", children: color.toUpperCase() }),
|
|
8061
|
+
/* @__PURE__ */ jsx74(ChevronDownIcon, { size: size2 === "sm" ? 14 : 16, className: "ow-select__chevron" })
|
|
8050
8062
|
]
|
|
8051
8063
|
}
|
|
8052
8064
|
),
|
|
8053
|
-
mounted ? /* @__PURE__ */
|
|
8065
|
+
mounted ? /* @__PURE__ */ jsx74(
|
|
8054
8066
|
"div",
|
|
8055
8067
|
{
|
|
8056
8068
|
ref: panelRef,
|
|
@@ -8064,7 +8076,7 @@ var ColorField = /* @__PURE__ */ forwardRef31(function ColorField2({
|
|
|
8064
8076
|
onKeyDown: (event) => {
|
|
8065
8077
|
if (event.key === "Enter" && event.target.closest(".react-colorful")) close();
|
|
8066
8078
|
},
|
|
8067
|
-
children: /* @__PURE__ */
|
|
8079
|
+
children: /* @__PURE__ */ jsx74(ColorPicker, { ...pickerProps, value: color, onChange: setColor })
|
|
8068
8080
|
}
|
|
8069
8081
|
) : null
|
|
8070
8082
|
] });
|
|
@@ -8255,7 +8267,7 @@ var hueHex = (h) => toHex(hsvToRgb({ h, s: 100, v: 100, a: 1 }));
|
|
|
8255
8267
|
var hueStops = "#ff0000 0%, #ffff00 16.67%, #00ff00 33.33%, #00ffff 50%, #0000ff 66.67%, #ff00ff 83.33%, #ff0000 100%";
|
|
8256
8268
|
|
|
8257
8269
|
// src/components/ColorPicker/ColorArea.tsx
|
|
8258
|
-
import { jsx as
|
|
8270
|
+
import { jsx as jsx75, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
8259
8271
|
var size = (length) => typeof length === "number" ? `${length}px` : length;
|
|
8260
8272
|
function assignRef8(ref, value) {
|
|
8261
8273
|
if (typeof ref === "function") ref(value);
|
|
@@ -8336,7 +8348,7 @@ var ColorArea = /* @__PURE__ */ forwardRef32(function ColorArea2({
|
|
|
8336
8348
|
const saturation = `Saturation ${percent.format(hsv.s / 100)}`;
|
|
8337
8349
|
const brightness = `brightness ${percent.format(hsv.v / 100)}`;
|
|
8338
8350
|
const colorName = describeColor(rgba);
|
|
8339
|
-
const input = (which) => /* @__PURE__ */
|
|
8351
|
+
const input = (which) => /* @__PURE__ */ jsx75(
|
|
8340
8352
|
"input",
|
|
8341
8353
|
{
|
|
8342
8354
|
ref: (element) => {
|
|
@@ -8395,7 +8407,7 @@ var ColorArea = /* @__PURE__ */ forwardRef32(function ColorArea2({
|
|
|
8395
8407
|
]
|
|
8396
8408
|
}
|
|
8397
8409
|
),
|
|
8398
|
-
name ? /* @__PURE__ */
|
|
8410
|
+
name ? /* @__PURE__ */ jsx75("input", { type: "hidden", name, value: hex }) : null
|
|
8399
8411
|
]
|
|
8400
8412
|
}
|
|
8401
8413
|
);
|
|
@@ -8403,7 +8415,7 @@ var ColorArea = /* @__PURE__ */ forwardRef32(function ColorArea2({
|
|
|
8403
8415
|
|
|
8404
8416
|
// src/components/ColorPicker/ColorSlider.tsx
|
|
8405
8417
|
import { forwardRef as forwardRef33, useId as useId28, useRef as useRef43 } from "react";
|
|
8406
|
-
import { jsx as
|
|
8418
|
+
import { jsx as jsx76, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
8407
8419
|
var channels = {
|
|
8408
8420
|
hue: { name: "Hue", max: 360, unit: "degree" },
|
|
8409
8421
|
saturation: { name: "Saturation", max: 100, unit: "percent" },
|
|
@@ -8534,10 +8546,10 @@ var ColorSlider = /* @__PURE__ */ forwardRef33(function ColorSlider2({
|
|
|
8534
8546
|
),
|
|
8535
8547
|
children: [
|
|
8536
8548
|
label || showValue ? /* @__PURE__ */ jsxs58("div", { className: "ow-color-slider__header", children: [
|
|
8537
|
-
label ? /* @__PURE__ */
|
|
8538
|
-
showValue ? /* @__PURE__ */
|
|
8549
|
+
label ? /* @__PURE__ */ jsx76("span", { id: labelId, className: "ow-color-slider__label", children: label }) : /* @__PURE__ */ jsx76("span", {}),
|
|
8550
|
+
showValue ? /* @__PURE__ */ jsx76("output", { className: "ow-color-slider__value", "aria-hidden": "true", children: shown }) : null
|
|
8539
8551
|
] }) : null,
|
|
8540
|
-
/* @__PURE__ */
|
|
8552
|
+
/* @__PURE__ */ jsx76(
|
|
8541
8553
|
"div",
|
|
8542
8554
|
{
|
|
8543
8555
|
ref: trackRef,
|
|
@@ -8546,12 +8558,12 @@ var ColorSlider = /* @__PURE__ */ forwardRef33(function ColorSlider2({
|
|
|
8546
8558
|
"--ow-color-slider-gradient": `linear-gradient(var(--ow-color-slider-direction), ${gradient(channel, color.value, rgba)})`
|
|
8547
8559
|
},
|
|
8548
8560
|
...drag.handlers,
|
|
8549
|
-
children: /* @__PURE__ */
|
|
8561
|
+
children: /* @__PURE__ */ jsx76(
|
|
8550
8562
|
"div",
|
|
8551
8563
|
{
|
|
8552
8564
|
className: "ow-color-slider__thumb",
|
|
8553
8565
|
style: { "--ow-color-slider-position": `${current / spec.max * 100}%`, "--ow-color-slider-thumb": fill },
|
|
8554
|
-
children: /* @__PURE__ */
|
|
8566
|
+
children: /* @__PURE__ */ jsx76(
|
|
8555
8567
|
"input",
|
|
8556
8568
|
{
|
|
8557
8569
|
ref: (element) => {
|
|
@@ -8583,7 +8595,7 @@ var ColorSlider = /* @__PURE__ */ forwardRef33(function ColorSlider2({
|
|
|
8583
8595
|
)
|
|
8584
8596
|
}
|
|
8585
8597
|
),
|
|
8586
|
-
name ? /* @__PURE__ */
|
|
8598
|
+
name ? /* @__PURE__ */ jsx76("input", { type: "hidden", name, value: color.hex }) : null
|
|
8587
8599
|
]
|
|
8588
8600
|
}
|
|
8589
8601
|
);
|
|
@@ -8591,7 +8603,7 @@ var ColorSlider = /* @__PURE__ */ forwardRef33(function ColorSlider2({
|
|
|
8591
8603
|
|
|
8592
8604
|
// src/components/ColorPicker/ColorSwatchPicker.tsx
|
|
8593
8605
|
import { forwardRef as forwardRef34, useRef as useRef44 } from "react";
|
|
8594
|
-
import { jsx as
|
|
8606
|
+
import { jsx as jsx77, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
8595
8607
|
var ColorSwatchPicker = /* @__PURE__ */ forwardRef34(function ColorSwatchPicker2({ options, value, defaultValue, onChange, size: size2 = "md", shape = "square", disabled = false, name, className, ...aria }, ref) {
|
|
8596
8608
|
const [current, setCurrent] = useControllableState(value, defaultValue ?? "", onChange);
|
|
8597
8609
|
const refs = useRef44([]);
|
|
@@ -8645,7 +8657,7 @@ var ColorSwatchPicker = /* @__PURE__ */ forwardRef34(function ColorSwatchPicker2
|
|
|
8645
8657
|
items2.map((item, index) => {
|
|
8646
8658
|
const isSelected = index === selectedIndex;
|
|
8647
8659
|
const isDisabled = disabled || Boolean(item.disabled);
|
|
8648
|
-
return /* @__PURE__ */
|
|
8660
|
+
return /* @__PURE__ */ jsx77(
|
|
8649
8661
|
"div",
|
|
8650
8662
|
{
|
|
8651
8663
|
ref: (element) => {
|
|
@@ -8662,12 +8674,12 @@ var ColorSwatchPicker = /* @__PURE__ */ forwardRef34(function ColorSwatchPicker2
|
|
|
8662
8674
|
style: { "--ow-color-swatch-picker-value": item.value },
|
|
8663
8675
|
onClick: () => choose(index),
|
|
8664
8676
|
onKeyDown: (event) => onKeyDown(event, index),
|
|
8665
|
-
children: /* @__PURE__ */
|
|
8677
|
+
children: /* @__PURE__ */ jsx77(CheckIcon, { size: size2 === "sm" ? 14 : 16, strokeWidth: 2.5, className: "ow-color-swatch-picker__check", "aria-hidden": "true" })
|
|
8666
8678
|
},
|
|
8667
8679
|
`${item.value}-${index}`
|
|
8668
8680
|
);
|
|
8669
8681
|
}),
|
|
8670
|
-
name ? /* @__PURE__ */
|
|
8682
|
+
name ? /* @__PURE__ */ jsx77("input", { type: "hidden", name, value: selectedIndex >= 0 ? items2[selectedIndex].value : "" }) : null
|
|
8671
8683
|
]
|
|
8672
8684
|
}
|
|
8673
8685
|
);
|
|
@@ -8902,6 +8914,7 @@ export {
|
|
|
8902
8914
|
Combobox,
|
|
8903
8915
|
CommandPalette,
|
|
8904
8916
|
ConfirmDialog,
|
|
8917
|
+
Container,
|
|
8905
8918
|
CopyButton,
|
|
8906
8919
|
DateField,
|
|
8907
8920
|
DatePicker,
|
|
@@ -8943,6 +8956,7 @@ export {
|
|
|
8943
8956
|
RangeCalendar,
|
|
8944
8957
|
ScrollShadow,
|
|
8945
8958
|
SearchField,
|
|
8959
|
+
Section,
|
|
8946
8960
|
SectionHeading,
|
|
8947
8961
|
SegmentedControl,
|
|
8948
8962
|
Select,
|