@openwarelabs/ui 0.10.0 → 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/README.md +5 -1
- package/dist/components/Avatar/Avatar.d.cts +2 -13
- package/dist/components/Avatar/Avatar.d.ts +2 -13
- package/dist/components/Avatar/Avatar.types.d.cts +13 -0
- package/dist/components/Avatar/Avatar.types.d.ts +13 -0
- package/dist/components/Calendar/DatePicker.d.cts +2 -19
- package/dist/components/Calendar/DatePicker.d.ts +2 -19
- package/dist/components/Calendar/DatePicker.types.d.cts +19 -0
- package/dist/components/Calendar/DatePicker.types.d.ts +19 -0
- package/dist/components/Calendar/DateRangePicker.d.cts +2 -34
- package/dist/components/Calendar/DateRangePicker.d.ts +2 -34
- package/dist/components/Calendar/DateRangePicker.types.d.cts +34 -0
- package/dist/components/Calendar/DateRangePicker.types.d.ts +34 -0
- package/dist/components/ColorPicker/ColorPicker.d.cts +2 -55
- package/dist/components/ColorPicker/ColorPicker.d.ts +2 -55
- package/dist/components/ColorPicker/ColorPicker.types.d.cts +54 -0
- package/dist/components/ColorPicker/ColorPicker.types.d.ts +54 -0
- 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/ListBox/ListBox.d.cts +3 -61
- package/dist/components/ListBox/ListBox.d.ts +3 -61
- package/dist/components/ListBox/ListBox.types.d.cts +61 -0
- package/dist/components/ListBox/ListBox.types.d.ts +61 -0
- package/dist/components/Prose/Prose.d.cts +2 -16
- package/dist/components/Prose/Prose.d.ts +2 -16
- package/dist/components/Prose/Prose.types.d.cts +16 -0
- package/dist/components/Prose/Prose.types.d.ts +16 -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 +83 -0
- package/dist/index.cjs +333 -298
- 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 +320 -285
- package/dist/index.js.map +4 -4
- package/dist/openware-ui.iife.js +7 -7
- package/dist/styles.css +86 -0
- package/dist/tokens.css +3 -0
- package/dist/tokens.json +15 -0
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ __export(index_exports, {
|
|
|
56
56
|
Combobox: () => Combobox,
|
|
57
57
|
CommandPalette: () => CommandPalette,
|
|
58
58
|
ConfirmDialog: () => ConfirmDialog,
|
|
59
|
+
Container: () => Container,
|
|
59
60
|
CopyButton: () => CopyButton,
|
|
60
61
|
DateField: () => DateField,
|
|
61
62
|
DatePicker: () => DatePicker,
|
|
@@ -97,6 +98,7 @@ __export(index_exports, {
|
|
|
97
98
|
RangeCalendar: () => RangeCalendar,
|
|
98
99
|
ScrollShadow: () => ScrollShadow,
|
|
99
100
|
SearchField: () => SearchField,
|
|
101
|
+
Section: () => Section,
|
|
100
102
|
SectionHeading: () => SectionHeading,
|
|
101
103
|
SegmentedControl: () => SegmentedControl,
|
|
102
104
|
Select: () => Select,
|
|
@@ -3431,7 +3433,7 @@ function ListBoxWithRef({
|
|
|
3431
3433
|
);
|
|
3432
3434
|
};
|
|
3433
3435
|
const isEmpty = flat.length === 0;
|
|
3434
|
-
const describedBy =
|
|
3436
|
+
const describedBy = ariaDescribedBy;
|
|
3435
3437
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3436
3438
|
"div",
|
|
3437
3439
|
{
|
|
@@ -3474,7 +3476,10 @@ function ListBoxWithRef({
|
|
|
3474
3476
|
item.options.map(renderOption)
|
|
3475
3477
|
] }, `group-${item.label}-${groupIndex}`) : renderOption(item)
|
|
3476
3478
|
),
|
|
3477
|
-
isEmpty ?
|
|
3479
|
+
isEmpty ? (
|
|
3480
|
+
// A listbox holds options, so an empty one says so with one that can't be chosen.
|
|
3481
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { id: emptyId, className: "ow-listbox__empty", role: "option", "aria-disabled": "true", "aria-selected": "false", children: emptyMessage })
|
|
3482
|
+
) : null
|
|
3478
3483
|
]
|
|
3479
3484
|
}
|
|
3480
3485
|
);
|
|
@@ -4235,9 +4240,9 @@ var DatePicker = /* @__PURE__ */ (0, import_react32.forwardRef)(function DatePic
|
|
|
4235
4240
|
"aria-haspopup": "dialog",
|
|
4236
4241
|
"aria-expanded": isOpen,
|
|
4237
4242
|
"aria-controls": isOpen ? panelId : void 0,
|
|
4238
|
-
"aria-label": ariaLabel,
|
|
4239
|
-
"aria-labelledby": ariaLabelledBy,
|
|
4240
|
-
"aria-describedby":
|
|
4243
|
+
"aria-label": ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${label}` : void 0,
|
|
4244
|
+
"aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : void 0,
|
|
4245
|
+
"aria-describedby": ariaDescribedBy,
|
|
4241
4246
|
"aria-invalid": isInvalid || void 0,
|
|
4242
4247
|
disabled,
|
|
4243
4248
|
className: cx(
|
|
@@ -4540,9 +4545,9 @@ var DateRangePicker = /* @__PURE__ */ (0, import_react34.forwardRef)(function Da
|
|
|
4540
4545
|
"aria-haspopup": "dialog",
|
|
4541
4546
|
"aria-expanded": isOpen,
|
|
4542
4547
|
"aria-controls": isOpen ? panelId : void 0,
|
|
4543
|
-
"aria-label": ariaLabel,
|
|
4544
|
-
"aria-labelledby": ariaLabelledBy,
|
|
4545
|
-
"aria-describedby":
|
|
4548
|
+
"aria-label": ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${label}` : void 0,
|
|
4549
|
+
"aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : void 0,
|
|
4550
|
+
"aria-describedby": ariaDescribedBy,
|
|
4546
4551
|
"aria-invalid": isInvalid || void 0,
|
|
4547
4552
|
disabled,
|
|
4548
4553
|
className: cx("ow-select", "ow-date-range-picker__trigger", `ow-select--${size2}`, {
|
|
@@ -6256,7 +6261,8 @@ function Avatar({ name, src, size: size2 = "md", label, className }) {
|
|
|
6256
6261
|
className: cx("ow-avatar", sizing.className, !initials && !showImage && "ow-avatar--empty", className),
|
|
6257
6262
|
style: sizing.style,
|
|
6258
6263
|
...label ? { role: "img", "aria-label": label } : { "aria-hidden": true },
|
|
6259
|
-
|
|
6264
|
+
"data-initials": !showImage && initials ? initials : void 0,
|
|
6265
|
+
children: showImage ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("img", { src, alt: "", className: "ow-avatar__image", onError: () => setFailedImage(src) }) : initials ? null : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(UserIcon, { size: Math.round(sizing.pixels * 0.52) })
|
|
6260
6266
|
}
|
|
6261
6267
|
);
|
|
6262
6268
|
}
|
|
@@ -6426,11 +6432,23 @@ function VisuallyHidden({ className, ...props }) {
|
|
|
6426
6432
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: cx("ow-visually-hidden", className), ...props });
|
|
6427
6433
|
}
|
|
6428
6434
|
|
|
6435
|
+
// src/components/Container/Container.tsx
|
|
6436
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6437
|
+
function Container({ size: size2 = "page", as: Element2 = "div", className, ...props }) {
|
|
6438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Element2, { className: cx("ow-container", `ow-container--${size2}`, className), ...props });
|
|
6439
|
+
}
|
|
6440
|
+
|
|
6441
|
+
// src/components/Section/Section.tsx
|
|
6442
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
6443
|
+
function Section({ tone = "paper", spacing = "md", size: size2 = "page", as: Element2 = "section", className, children, ...props }) {
|
|
6444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Element2, { className: cx("ow-section", `ow-section--${tone}`, `ow-section--space-${spacing}`, className), ...props, children: size2 === false ? children : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Container, { size: size2, children }) });
|
|
6445
|
+
}
|
|
6446
|
+
|
|
6429
6447
|
// src/components/Marketing/Marketing.tsx
|
|
6430
6448
|
var import_react56 = require("react");
|
|
6431
|
-
var
|
|
6449
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
6432
6450
|
function Chip({ className, ...props }) {
|
|
6433
|
-
return /* @__PURE__ */ (0,
|
|
6451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: cx("ow-chip", className), ...props });
|
|
6434
6452
|
}
|
|
6435
6453
|
function SectionHeading({
|
|
6436
6454
|
eyebrow,
|
|
@@ -6440,17 +6458,17 @@ function SectionHeading({
|
|
|
6440
6458
|
as: Heading = "h2",
|
|
6441
6459
|
className
|
|
6442
6460
|
}) {
|
|
6443
|
-
return /* @__PURE__ */ (0,
|
|
6444
|
-
eyebrow ? /* @__PURE__ */ (0,
|
|
6445
|
-
/* @__PURE__ */ (0,
|
|
6446
|
-
intro ? /* @__PURE__ */ (0,
|
|
6461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: cx("ow-section-heading", align === "center" && "ow-section-heading--center", className), children: [
|
|
6462
|
+
eyebrow ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Chip, { children: eyebrow }) : null,
|
|
6463
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Heading, { className: "ow-section-heading__title", children: title }),
|
|
6464
|
+
intro ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "ow-section-heading__intro", children: intro }) : null
|
|
6447
6465
|
] });
|
|
6448
6466
|
}
|
|
6449
6467
|
function SiteHeader({ brand, nav, actions, className }) {
|
|
6450
|
-
return /* @__PURE__ */ (0,
|
|
6451
|
-
/* @__PURE__ */ (0,
|
|
6452
|
-
nav ? /* @__PURE__ */ (0,
|
|
6453
|
-
actions ? /* @__PURE__ */ (0,
|
|
6468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("header", { className: cx("ow-site-header", className), children: [
|
|
6469
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ow-site-header__brand", children: brand }),
|
|
6470
|
+
nav ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("nav", { className: "ow-site-header__nav", children: nav }) : null,
|
|
6471
|
+
actions ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ow-site-header__actions", children: actions }) : null
|
|
6454
6472
|
] });
|
|
6455
6473
|
}
|
|
6456
6474
|
function DotGrid({ fade = false, interactive = false, className, children, onPointerMove, ...props }) {
|
|
@@ -6463,7 +6481,7 @@ function DotGrid({ fade = false, interactive = false, className, children, onPoi
|
|
|
6463
6481
|
element.style.setProperty("--ow-pointer-x", `${event.clientX - rect.left}px`);
|
|
6464
6482
|
element.style.setProperty("--ow-pointer-y", `${event.clientY - rect.top}px`);
|
|
6465
6483
|
}
|
|
6466
|
-
return /* @__PURE__ */ (0,
|
|
6484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
6467
6485
|
"div",
|
|
6468
6486
|
{
|
|
6469
6487
|
ref,
|
|
@@ -6471,9 +6489,9 @@ function DotGrid({ fade = false, interactive = false, className, children, onPoi
|
|
|
6471
6489
|
onPointerMove: track,
|
|
6472
6490
|
...props,
|
|
6473
6491
|
children: [
|
|
6474
|
-
/* @__PURE__ */ (0,
|
|
6475
|
-
interactive ? /* @__PURE__ */ (0,
|
|
6476
|
-
/* @__PURE__ */ (0,
|
|
6492
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "ow-dot-grid__dots", "aria-hidden": "true" }),
|
|
6493
|
+
interactive ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "ow-dot-grid__brass", "aria-hidden": "true" }) : null,
|
|
6494
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ow-dot-grid__content", children })
|
|
6477
6495
|
]
|
|
6478
6496
|
}
|
|
6479
6497
|
);
|
|
@@ -6481,13 +6499,30 @@ function DotGrid({ fade = false, interactive = false, className, children, onPoi
|
|
|
6481
6499
|
|
|
6482
6500
|
// src/components/Prose/Prose.tsx
|
|
6483
6501
|
var import_react57 = require("react");
|
|
6484
|
-
var
|
|
6502
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6485
6503
|
var Prose = /* @__PURE__ */ (0, import_react57.forwardRef)(function Prose2({ size: size2 = "md", fullWidth = false, as = "div", className, children, ...props }, ref) {
|
|
6486
6504
|
const Element2 = as;
|
|
6487
|
-
|
|
6505
|
+
const root = (0, import_react57.useRef)(null);
|
|
6506
|
+
(0, import_react57.useEffect)(() => {
|
|
6507
|
+
const element = root.current;
|
|
6508
|
+
if (!element) return;
|
|
6509
|
+
for (const scroller of element.querySelectorAll("pre, .ow-table-wrap")) {
|
|
6510
|
+
if (scroller.scrollWidth > scroller.clientWidth && !scroller.hasAttribute("tabindex")) scroller.tabIndex = 0;
|
|
6511
|
+
}
|
|
6512
|
+
for (const box of element.querySelectorAll('li > input[type="checkbox"], li > p > input[type="checkbox"]')) {
|
|
6513
|
+
if (box.labels?.length || box.hasAttribute("aria-label") || box.hasAttribute("aria-labelledby")) continue;
|
|
6514
|
+
const text = box.closest("li")?.textContent?.trim();
|
|
6515
|
+
if (text) box.setAttribute("aria-label", text);
|
|
6516
|
+
}
|
|
6517
|
+
});
|
|
6518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6488
6519
|
Element2,
|
|
6489
6520
|
{
|
|
6490
|
-
ref
|
|
6521
|
+
ref: (node) => {
|
|
6522
|
+
root.current = node;
|
|
6523
|
+
if (typeof ref === "function") ref(node);
|
|
6524
|
+
else if (ref) ref.current = node;
|
|
6525
|
+
},
|
|
6491
6526
|
className: cx("ow-prose", `ow-prose--${size2}`, size2 === "md" ? "ow-type-prose" : "ow-type-copy", fullWidth && "ow-prose--full", className),
|
|
6492
6527
|
...props,
|
|
6493
6528
|
children
|
|
@@ -6496,10 +6531,10 @@ var Prose = /* @__PURE__ */ (0, import_react57.forwardRef)(function Prose2({ siz
|
|
|
6496
6531
|
});
|
|
6497
6532
|
|
|
6498
6533
|
// src/components/TextShimmer/TextShimmer.tsx
|
|
6499
|
-
var
|
|
6534
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6500
6535
|
function TextShimmer({ children, as = "span", duration = 2, active = true, className }) {
|
|
6501
6536
|
const Element2 = as;
|
|
6502
|
-
return /* @__PURE__ */ (0,
|
|
6537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
6503
6538
|
Element2,
|
|
6504
6539
|
{
|
|
6505
6540
|
className: cx("ow-shimmer", active && "ow-shimmer--active", className),
|
|
@@ -6511,12 +6546,12 @@ function TextShimmer({ children, as = "span", duration = 2, active = true, class
|
|
|
6511
6546
|
|
|
6512
6547
|
// src/components/PromptInput/PromptInput.tsx
|
|
6513
6548
|
var import_react58 = require("react");
|
|
6514
|
-
var
|
|
6549
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6515
6550
|
var noAttachments = [];
|
|
6516
6551
|
var counterFrom = 0.8;
|
|
6517
6552
|
var announceDelay = 1e3;
|
|
6518
6553
|
function Glyph({ children }) {
|
|
6519
|
-
return /* @__PURE__ */ (0,
|
|
6554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6520
6555
|
"svg",
|
|
6521
6556
|
{
|
|
6522
6557
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6536,29 +6571,29 @@ function Glyph({ children }) {
|
|
|
6536
6571
|
}
|
|
6537
6572
|
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";
|
|
6538
6573
|
var fold = "M14 2v5a1 1 0 0 0 1 1h5";
|
|
6539
|
-
var PaperclipIcon = () => /* @__PURE__ */ (0,
|
|
6540
|
-
var StopIcon = () => /* @__PURE__ */ (0,
|
|
6574
|
+
var PaperclipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Glyph, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("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" }) });
|
|
6575
|
+
var StopIcon = () => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Glyph, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2", fill: "currentColor", stroke: "none" }) });
|
|
6541
6576
|
var fileIcons = {
|
|
6542
|
-
image: /* @__PURE__ */ (0,
|
|
6543
|
-
/* @__PURE__ */ (0,
|
|
6544
|
-
/* @__PURE__ */ (0,
|
|
6545
|
-
/* @__PURE__ */ (0,
|
|
6546
|
-
/* @__PURE__ */ (0,
|
|
6577
|
+
image: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Glyph, { children: [
|
|
6578
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: sheet }),
|
|
6579
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: fold }),
|
|
6580
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("circle", { cx: "10", cy: "12", r: "2" }),
|
|
6581
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22" })
|
|
6547
6582
|
] }),
|
|
6548
|
-
code: /* @__PURE__ */ (0,
|
|
6549
|
-
/* @__PURE__ */ (0,
|
|
6550
|
-
/* @__PURE__ */ (0,
|
|
6551
|
-
/* @__PURE__ */ (0,
|
|
6552
|
-
/* @__PURE__ */ (0,
|
|
6583
|
+
code: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Glyph, { children: [
|
|
6584
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: sheet }),
|
|
6585
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: fold }),
|
|
6586
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "M10 12.5 8 15l2 2.5" }),
|
|
6587
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "m14 12.5 2 2.5-2 2.5" })
|
|
6553
6588
|
] }),
|
|
6554
|
-
text: /* @__PURE__ */ (0,
|
|
6555
|
-
/* @__PURE__ */ (0,
|
|
6556
|
-
/* @__PURE__ */ (0,
|
|
6557
|
-
/* @__PURE__ */ (0,
|
|
6558
|
-
/* @__PURE__ */ (0,
|
|
6559
|
-
/* @__PURE__ */ (0,
|
|
6589
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Glyph, { children: [
|
|
6590
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: sheet }),
|
|
6591
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: fold }),
|
|
6592
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "M10 9H8" }),
|
|
6593
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "M16 13H8" }),
|
|
6594
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("path", { d: "M16 17H8" })
|
|
6560
6595
|
] }),
|
|
6561
|
-
file: /* @__PURE__ */ (0,
|
|
6596
|
+
file: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FileIcon, { size: 16 })
|
|
6562
6597
|
};
|
|
6563
6598
|
function kindOf({ name, type = "" }) {
|
|
6564
6599
|
const lower = name.toLowerCase();
|
|
@@ -6751,7 +6786,7 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
|
|
|
6751
6786
|
event.preventDefault();
|
|
6752
6787
|
textAreaRef.current?.focus();
|
|
6753
6788
|
}
|
|
6754
|
-
const attachButton = onAttach ? /* @__PURE__ */ (0,
|
|
6789
|
+
const attachButton = onAttach ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Tooltip, { label: "Attach files", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6755
6790
|
Button,
|
|
6756
6791
|
{
|
|
6757
6792
|
className: "ow-prompt-input__attach",
|
|
@@ -6761,11 +6796,11 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
|
|
|
6761
6796
|
"aria-label": multiple ? "Attach files" : "Attach a file",
|
|
6762
6797
|
disabled,
|
|
6763
6798
|
onClick: () => pickerRef.current?.click(),
|
|
6764
|
-
children: /* @__PURE__ */ (0,
|
|
6799
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(PaperclipIcon, {})
|
|
6765
6800
|
}
|
|
6766
6801
|
) }) : null;
|
|
6767
6802
|
const actionLabel = isStreaming ? "Stop" : "Send";
|
|
6768
|
-
const actionButton = /* @__PURE__ */ (0,
|
|
6803
|
+
const actionButton = /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Tooltip, { label: actionLabel, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6769
6804
|
Button,
|
|
6770
6805
|
{
|
|
6771
6806
|
ref: actionRef,
|
|
@@ -6780,10 +6815,10 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
|
|
|
6780
6815
|
else submit();
|
|
6781
6816
|
textAreaRef.current?.focus();
|
|
6782
6817
|
},
|
|
6783
|
-
children: isStreaming ? /* @__PURE__ */ (0,
|
|
6818
|
+
children: isStreaming ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(StopIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ArrowUpIcon, { size: 16 })
|
|
6784
6819
|
}
|
|
6785
6820
|
) });
|
|
6786
|
-
return /* @__PURE__ */ (0,
|
|
6821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
6787
6822
|
"div",
|
|
6788
6823
|
{
|
|
6789
6824
|
className: cx(
|
|
@@ -6797,7 +6832,7 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
|
|
|
6797
6832
|
),
|
|
6798
6833
|
style: { "--ow-prompt-min-rows": rows, "--ow-prompt-max-rows": maxRowCount },
|
|
6799
6834
|
children: [
|
|
6800
|
-
/* @__PURE__ */ (0,
|
|
6835
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
6801
6836
|
"fieldset",
|
|
6802
6837
|
{
|
|
6803
6838
|
role: "presentation",
|
|
@@ -6827,12 +6862,12 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
|
|
|
6827
6862
|
take(Array.from(event.dataTransfer.files));
|
|
6828
6863
|
},
|
|
6829
6864
|
children: [
|
|
6830
|
-
attachments.length ? /* @__PURE__ */ (0,
|
|
6865
|
+
attachments.length ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("ul", { ref: listRef, className: "ow-prompt-input__attachments", "aria-label": "Attachments", children: attachments.map((attachment, index) => {
|
|
6831
6866
|
const [base, extension] = splitName(attachment.name);
|
|
6832
|
-
return /* @__PURE__ */ (0,
|
|
6833
|
-
/* @__PURE__ */ (0,
|
|
6867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("li", { className: "ow-prompt-input__attachment", children: [
|
|
6868
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { className: "ow-prompt-input__thumb", "aria-hidden": "true", children: [
|
|
6834
6869
|
fileIcons[kindOf(attachment)],
|
|
6835
|
-
attachment.previewUrl ? /* @__PURE__ */ (0,
|
|
6870
|
+
attachment.previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6836
6871
|
"img",
|
|
6837
6872
|
{
|
|
6838
6873
|
src: attachment.previewUrl,
|
|
@@ -6843,26 +6878,26 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
|
|
|
6843
6878
|
}
|
|
6844
6879
|
) : null
|
|
6845
6880
|
] }),
|
|
6846
|
-
/* @__PURE__ */ (0,
|
|
6847
|
-
/* @__PURE__ */ (0,
|
|
6848
|
-
/* @__PURE__ */ (0,
|
|
6881
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { className: "ow-prompt-input__file", children: [
|
|
6882
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { className: "ow-prompt-input__file-name", title: attachment.name, children: [
|
|
6883
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "ow-prompt-input__file-base", children: base }),
|
|
6849
6884
|
extension
|
|
6850
6885
|
] }),
|
|
6851
|
-
attachment.size !== void 0 ? /* @__PURE__ */ (0,
|
|
6886
|
+
attachment.size !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "ow-prompt-input__file-size", children: formatBytes(attachment.size, locale) }) : null
|
|
6852
6887
|
] }),
|
|
6853
|
-
onRemoveAttachment ? /* @__PURE__ */ (0,
|
|
6888
|
+
onRemoveAttachment ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6854
6889
|
"button",
|
|
6855
6890
|
{
|
|
6856
6891
|
type: "button",
|
|
6857
6892
|
className: "ow-prompt-input__remove",
|
|
6858
6893
|
"aria-label": `Remove ${attachment.name}`,
|
|
6859
6894
|
onClick: () => remove(attachment, index),
|
|
6860
|
-
children: /* @__PURE__ */ (0,
|
|
6895
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(XIcon, { size: 14 })
|
|
6861
6896
|
}
|
|
6862
6897
|
) : null
|
|
6863
6898
|
] }, attachment.id);
|
|
6864
6899
|
}) }) : null,
|
|
6865
|
-
/* @__PURE__ */ (0,
|
|
6900
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6866
6901
|
Textarea,
|
|
6867
6902
|
{
|
|
6868
6903
|
ref: setTextAreaRef,
|
|
@@ -6893,13 +6928,13 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
|
|
|
6893
6928
|
}
|
|
6894
6929
|
}
|
|
6895
6930
|
),
|
|
6896
|
-
/* @__PURE__ */ (0,
|
|
6897
|
-
toolbarStart ? /* @__PURE__ */ (0,
|
|
6931
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "ow-prompt-input__toolbar", "data-prompt-blank": "", children: [
|
|
6932
|
+
toolbarStart ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "ow-prompt-input__start", "data-prompt-blank": "", children: [
|
|
6898
6933
|
attachButton,
|
|
6899
6934
|
startActions
|
|
6900
6935
|
] }) : null,
|
|
6901
|
-
/* @__PURE__ */ (0,
|
|
6902
|
-
showCounter ? /* @__PURE__ */ (0,
|
|
6936
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "ow-prompt-input__end", "data-prompt-blank": "", children: [
|
|
6937
|
+
showCounter ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("span", { className: cx("ow-prompt-input__counter", remaining === 0 && "ow-prompt-input__counter--full"), "aria-hidden": "true", children: [
|
|
6903
6938
|
number(text.length),
|
|
6904
6939
|
" / ",
|
|
6905
6940
|
number(maxLength)
|
|
@@ -6908,7 +6943,7 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
|
|
|
6908
6943
|
actionButton
|
|
6909
6944
|
] })
|
|
6910
6945
|
] }),
|
|
6911
|
-
onAttach ? /* @__PURE__ */ (0,
|
|
6946
|
+
onAttach ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6912
6947
|
"input",
|
|
6913
6948
|
{
|
|
6914
6949
|
ref: pickerRef,
|
|
@@ -6924,14 +6959,14 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
|
|
|
6924
6959
|
}
|
|
6925
6960
|
}
|
|
6926
6961
|
) : null,
|
|
6927
|
-
isDragging ? /* @__PURE__ */ (0,
|
|
6928
|
-
/* @__PURE__ */ (0,
|
|
6962
|
+
isDragging ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "ow-prompt-input__drop", "aria-hidden": "true", children: [
|
|
6963
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(UploadIcon, { size: 16 }),
|
|
6929
6964
|
"Drop to attach"
|
|
6930
6965
|
] }) : null
|
|
6931
6966
|
]
|
|
6932
6967
|
}
|
|
6933
6968
|
),
|
|
6934
|
-
shownHint ? /* @__PURE__ */ (0,
|
|
6969
|
+
shownHint ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
6935
6970
|
"div",
|
|
6936
6971
|
{
|
|
6937
6972
|
className: cx("ow-prompt-input__hint", notice && "ow-prompt-input__hint--notice"),
|
|
@@ -6940,7 +6975,7 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
|
|
|
6940
6975
|
children: shownHint
|
|
6941
6976
|
}
|
|
6942
6977
|
) : null,
|
|
6943
|
-
/* @__PURE__ */ (0,
|
|
6978
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "ow-visually-hidden", role: "status", children: announcement })
|
|
6944
6979
|
]
|
|
6945
6980
|
}
|
|
6946
6981
|
);
|
|
@@ -6948,18 +6983,18 @@ var PromptInput = /* @__PURE__ */ (0, import_react58.forwardRef)(function Prompt
|
|
|
6948
6983
|
|
|
6949
6984
|
// src/components/PromptInput/PromptSuggestion.tsx
|
|
6950
6985
|
var import_react59 = require("react");
|
|
6951
|
-
var
|
|
6986
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
6952
6987
|
var PromptSuggestion = /* @__PURE__ */ (0, import_react59.forwardRef)(function PromptSuggestion2({ children, icon: icon2, description, variant = description ? "card" : "pill", type = "button", className, ...buttonProps }, ref) {
|
|
6953
6988
|
if (variant === "card") {
|
|
6954
|
-
return /* @__PURE__ */ (0,
|
|
6955
|
-
icon2 ? /* @__PURE__ */ (0,
|
|
6956
|
-
/* @__PURE__ */ (0,
|
|
6957
|
-
/* @__PURE__ */ (0,
|
|
6958
|
-
description ? /* @__PURE__ */ (0,
|
|
6989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("button", { ref, type, className: cx("ow-prompt-suggestion", "ow-prompt-suggestion--card", className), ...buttonProps, children: [
|
|
6990
|
+
icon2 ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ow-prompt-suggestion__icon", children: icon2 }) : null,
|
|
6991
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("span", { className: "ow-prompt-suggestion__text", children: [
|
|
6992
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ow-prompt-suggestion__title", children }),
|
|
6993
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ow-prompt-suggestion__description", children: description }) : null
|
|
6959
6994
|
] })
|
|
6960
6995
|
] });
|
|
6961
6996
|
}
|
|
6962
|
-
return /* @__PURE__ */ (0,
|
|
6997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
6963
6998
|
"button",
|
|
6964
6999
|
{
|
|
6965
7000
|
ref,
|
|
@@ -6972,8 +7007,8 @@ var PromptSuggestion = /* @__PURE__ */ (0, import_react59.forwardRef)(function P
|
|
|
6972
7007
|
),
|
|
6973
7008
|
...buttonProps,
|
|
6974
7009
|
children: [
|
|
6975
|
-
icon2 ? /* @__PURE__ */ (0,
|
|
6976
|
-
/* @__PURE__ */ (0,
|
|
7010
|
+
icon2 ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ow-prompt-suggestion__icon", children: icon2 }) : null,
|
|
7011
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "ow-prompt-suggestion__label", children })
|
|
6977
7012
|
]
|
|
6978
7013
|
}
|
|
6979
7014
|
);
|
|
@@ -6988,7 +7023,7 @@ function PromptSuggestions({
|
|
|
6988
7023
|
style,
|
|
6989
7024
|
...props
|
|
6990
7025
|
}) {
|
|
6991
|
-
return /* @__PURE__ */ (0,
|
|
7026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
6992
7027
|
"div",
|
|
6993
7028
|
{
|
|
6994
7029
|
role: "group",
|
|
@@ -7003,7 +7038,7 @@ function PromptSuggestions({
|
|
|
7003
7038
|
|
|
7004
7039
|
// src/components/Chat/ChatConversation.tsx
|
|
7005
7040
|
var import_react60 = require("react");
|
|
7006
|
-
var
|
|
7041
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
7007
7042
|
var ChatConversationContext = /* @__PURE__ */ (0, import_react60.createContext)(null);
|
|
7008
7043
|
var stickyDistance = 32;
|
|
7009
7044
|
var defaultCount = (count) => `${count} new`;
|
|
@@ -7098,9 +7133,9 @@ var ChatConversation = /* @__PURE__ */ (0, import_react60.forwardRef)(function C
|
|
|
7098
7133
|
);
|
|
7099
7134
|
const showJump = !isFollowing && !isEmpty;
|
|
7100
7135
|
const jump = usePresence(showJump);
|
|
7101
|
-
return /* @__PURE__ */ (0,
|
|
7102
|
-
/* @__PURE__ */ (0,
|
|
7103
|
-
/* @__PURE__ */ (0,
|
|
7136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: cx("ow-chat-conversation", width === "full" && "ow-chat-conversation--full", className), ...props, children: [
|
|
7137
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "ow-chat-conversation__viewport", children: [
|
|
7138
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
7104
7139
|
"div",
|
|
7105
7140
|
{
|
|
7106
7141
|
ref: scrollerRef,
|
|
@@ -7112,17 +7147,17 @@ var ChatConversation = /* @__PURE__ */ (0, import_react60.forwardRef)(function C
|
|
|
7112
7147
|
"aria-labelledby": ariaLabelledBy,
|
|
7113
7148
|
tabIndex: isEmpty ? void 0 : 0,
|
|
7114
7149
|
onScroll,
|
|
7115
|
-
children: /* @__PURE__ */ (0,
|
|
7150
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { ref: contentRef, className: "ow-chat-conversation__content", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ChatConversationContext.Provider, { value: context, children }) })
|
|
7116
7151
|
}
|
|
7117
7152
|
),
|
|
7118
|
-
isEmpty && empty ? /* @__PURE__ */ (0,
|
|
7119
|
-
jump.mounted ? /* @__PURE__ */ (0,
|
|
7153
|
+
isEmpty && empty ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ow-chat-conversation__empty", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ow-chat-conversation__empty-inner", children: empty }) }) : null,
|
|
7154
|
+
jump.mounted ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ow-chat-conversation__jump", "data-state": jump.state, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
7120
7155
|
Button,
|
|
7121
7156
|
{
|
|
7122
7157
|
ref: jumpRef,
|
|
7123
7158
|
size: "sm",
|
|
7124
7159
|
shape: "pill",
|
|
7125
|
-
startIcon: /* @__PURE__ */ (0,
|
|
7160
|
+
startIcon: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ArrowDownIcon, { size: 16 }),
|
|
7126
7161
|
"aria-label": newCount > 0 ? `${jumpLabel}, ${formatNewCount(newCount)}` : jumpLabel,
|
|
7127
7162
|
tabIndex: showJump ? void 0 : -1,
|
|
7128
7163
|
onClick: () => {
|
|
@@ -7131,21 +7166,21 @@ var ChatConversation = /* @__PURE__ */ (0, import_react60.forwardRef)(function C
|
|
|
7131
7166
|
},
|
|
7132
7167
|
children: [
|
|
7133
7168
|
jumpLabel,
|
|
7134
|
-
newCount > 0 ? /* @__PURE__ */ (0,
|
|
7169
|
+
newCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "ow-chat-conversation__count", children: formatNewCount(newCount) }) : null
|
|
7135
7170
|
]
|
|
7136
7171
|
}
|
|
7137
7172
|
) }) : null
|
|
7138
7173
|
] }),
|
|
7139
|
-
footer != null && footer !== false ? /* @__PURE__ */ (0,
|
|
7174
|
+
footer != null && footer !== false ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ow-chat-conversation__footer", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "ow-chat-conversation__footer-inner", children: footer }) }) : null
|
|
7140
7175
|
] });
|
|
7141
7176
|
});
|
|
7142
7177
|
|
|
7143
7178
|
// src/components/Chat/ChatMessage.tsx
|
|
7144
7179
|
var import_react61 = require("react");
|
|
7145
|
-
var
|
|
7180
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
7146
7181
|
function lucide(paths) {
|
|
7147
7182
|
return function Icon({ size: size2 = 16, strokeWidth = 2, ...props }) {
|
|
7148
|
-
return /* @__PURE__ */ (0,
|
|
7183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
7149
7184
|
"svg",
|
|
7150
7185
|
{
|
|
7151
7186
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -7166,49 +7201,49 @@ function lucide(paths) {
|
|
|
7166
7201
|
};
|
|
7167
7202
|
}
|
|
7168
7203
|
var BotIcon = /* @__PURE__ */ lucide(
|
|
7169
|
-
/* @__PURE__ */ (0,
|
|
7170
|
-
/* @__PURE__ */ (0,
|
|
7171
|
-
/* @__PURE__ */ (0,
|
|
7172
|
-
/* @__PURE__ */ (0,
|
|
7173
|
-
/* @__PURE__ */ (0,
|
|
7174
|
-
/* @__PURE__ */ (0,
|
|
7175
|
-
/* @__PURE__ */ (0,
|
|
7204
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
7205
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M12 8V4H8" }),
|
|
7206
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("rect", { width: "16", height: "12", x: "4", y: "8", rx: "2" }),
|
|
7207
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M2 14h2" }),
|
|
7208
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M20 14h2" }),
|
|
7209
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M15 13v2" }),
|
|
7210
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M9 13v2" })
|
|
7176
7211
|
] })
|
|
7177
7212
|
);
|
|
7178
7213
|
var RotateCcwIcon = /* @__PURE__ */ lucide(
|
|
7179
|
-
/* @__PURE__ */ (0,
|
|
7180
|
-
/* @__PURE__ */ (0,
|
|
7181
|
-
/* @__PURE__ */ (0,
|
|
7214
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
7215
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
|
|
7216
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M3 3v5h5" })
|
|
7182
7217
|
] })
|
|
7183
7218
|
);
|
|
7184
7219
|
var ThumbsUpIcon = /* @__PURE__ */ lucide(
|
|
7185
|
-
/* @__PURE__ */ (0,
|
|
7186
|
-
/* @__PURE__ */ (0,
|
|
7187
|
-
/* @__PURE__ */ (0,
|
|
7220
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
7221
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("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" }),
|
|
7222
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M7 10v12" })
|
|
7188
7223
|
] })
|
|
7189
7224
|
);
|
|
7190
7225
|
var ThumbsDownIcon = /* @__PURE__ */ lucide(
|
|
7191
|
-
/* @__PURE__ */ (0,
|
|
7192
|
-
/* @__PURE__ */ (0,
|
|
7193
|
-
/* @__PURE__ */ (0,
|
|
7226
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
7227
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("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" }),
|
|
7228
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "M17 14V2" })
|
|
7194
7229
|
] })
|
|
7195
7230
|
);
|
|
7196
7231
|
var PencilIcon = /* @__PURE__ */ lucide(
|
|
7197
|
-
/* @__PURE__ */ (0,
|
|
7198
|
-
/* @__PURE__ */ (0,
|
|
7199
|
-
/* @__PURE__ */ (0,
|
|
7232
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
7233
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("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" }),
|
|
7234
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("path", { d: "m15 5 4 4" })
|
|
7200
7235
|
] })
|
|
7201
7236
|
);
|
|
7202
7237
|
var botSizes = { sm: 14, md: 16, lg: 18 };
|
|
7203
7238
|
function ChatAgentAvatar({ size: size2 = "md", label, className }) {
|
|
7204
|
-
return /* @__PURE__ */ (0,
|
|
7239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
7205
7240
|
"span",
|
|
7206
7241
|
{
|
|
7207
7242
|
className: cx("ow-chat-avatar", size2 !== "md" && `ow-chat-avatar--${size2}`, className),
|
|
7208
7243
|
role: label ? "img" : void 0,
|
|
7209
7244
|
"aria-label": label,
|
|
7210
7245
|
"aria-hidden": label ? void 0 : true,
|
|
7211
|
-
children: /* @__PURE__ */ (0,
|
|
7246
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(BotIcon, { size: botSizes[size2] })
|
|
7212
7247
|
}
|
|
7213
7248
|
);
|
|
7214
7249
|
}
|
|
@@ -7233,10 +7268,10 @@ function formattersFor(locale) {
|
|
|
7233
7268
|
function MessageTime({ time, locale }) {
|
|
7234
7269
|
const date = typeof time === "string" ? new Date(time) : time;
|
|
7235
7270
|
if (Number.isNaN(date.getTime())) {
|
|
7236
|
-
return /* @__PURE__ */ (0,
|
|
7271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("time", { className: "ow-chat-message__time", children: String(time) });
|
|
7237
7272
|
}
|
|
7238
7273
|
const { short, full } = formattersFor(locale);
|
|
7239
|
-
return /* @__PURE__ */ (0,
|
|
7274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("time", { className: "ow-chat-message__time", dateTime: date.toISOString(), title: full.format(date), children: short.format(date) });
|
|
7240
7275
|
}
|
|
7241
7276
|
var skipCaret = '[aria-hidden="true"], .ow-visually-hidden';
|
|
7242
7277
|
function useStreamingCaret(bodyRef, contentRef, caretRef, active) {
|
|
@@ -7296,27 +7331,27 @@ var ChatMessage = /* @__PURE__ */ (0, import_react61.forwardRef)(function ChatMe
|
|
|
7296
7331
|
(0, import_react61.useEffect)(() => conversation?.register(id), [conversation, id]);
|
|
7297
7332
|
useStreamingCaret(bodyRef, contentRef, caretRef, streaming && from !== "system");
|
|
7298
7333
|
if (from === "system") {
|
|
7299
|
-
return /* @__PURE__ */ (0,
|
|
7334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
7300
7335
|
"div",
|
|
7301
7336
|
{
|
|
7302
7337
|
ref,
|
|
7303
7338
|
className: cx("ow-chat-message", "ow-chat-message--system", entering && "ow-chat-message--enter", className),
|
|
7304
7339
|
...props,
|
|
7305
|
-
children: /* @__PURE__ */ (0,
|
|
7340
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "ow-chat-message__system-text", children: [
|
|
7306
7341
|
children,
|
|
7307
|
-
time !== void 0 ? /* @__PURE__ */ (0,
|
|
7308
|
-
/* @__PURE__ */ (0,
|
|
7309
|
-
/* @__PURE__ */ (0,
|
|
7342
|
+
time !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
7343
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { "aria-hidden": "true", children: " \xB7 " }),
|
|
7344
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(MessageTime, { time, locale })
|
|
7310
7345
|
] }) : null
|
|
7311
7346
|
] })
|
|
7312
7347
|
}
|
|
7313
7348
|
);
|
|
7314
7349
|
}
|
|
7315
7350
|
const isUser = from === "user";
|
|
7316
|
-
const avatarNode = avatar !== void 0 ? avatar : isUser ? null : /* @__PURE__ */ (0,
|
|
7351
|
+
const avatarNode = avatar !== void 0 ? avatar : isUser ? null : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChatAgentAvatar, {});
|
|
7317
7352
|
const hasHeader = name != null || time !== void 0;
|
|
7318
7353
|
const errorText = error ?? (isUser ? "Couldn't send this message." : "The answer didn't finish.");
|
|
7319
|
-
return /* @__PURE__ */ (0,
|
|
7354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
7320
7355
|
"article",
|
|
7321
7356
|
{
|
|
7322
7357
|
ref,
|
|
@@ -7332,22 +7367,22 @@ var ChatMessage = /* @__PURE__ */ (0, import_react61.forwardRef)(function ChatMe
|
|
|
7332
7367
|
"aria-busy": streaming || void 0,
|
|
7333
7368
|
...props,
|
|
7334
7369
|
children: [
|
|
7335
|
-
avatarNode != null && avatarNode !== false ? /* @__PURE__ */ (0,
|
|
7336
|
-
/* @__PURE__ */ (0,
|
|
7337
|
-
hasHeader ? /* @__PURE__ */ (0,
|
|
7338
|
-
name != null ? /* @__PURE__ */ (0,
|
|
7339
|
-
time !== void 0 ? /* @__PURE__ */ (0,
|
|
7340
|
-
] }) : /* @__PURE__ */ (0,
|
|
7341
|
-
/* @__PURE__ */ (0,
|
|
7342
|
-
/* @__PURE__ */ (0,
|
|
7343
|
-
streaming ? /* @__PURE__ */ (0,
|
|
7370
|
+
avatarNode != null && avatarNode !== false ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ow-chat-message__avatar", children: avatarNode }) : null,
|
|
7371
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ow-chat-message__main", children: [
|
|
7372
|
+
hasHeader ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "ow-chat-message__header", children: [
|
|
7373
|
+
name != null ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ow-chat-message__name", children: name }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ow-visually-hidden", children: isUser ? "You" : "Agent" }),
|
|
7374
|
+
time !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(MessageTime, { time, locale }) : null
|
|
7375
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ow-visually-hidden", children: isUser ? "You" : "Agent" }),
|
|
7376
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { ref: bodyRef, className: "ow-chat-message__body", children: [
|
|
7377
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { ref: contentRef, className: "ow-chat-message__content", children }),
|
|
7378
|
+
streaming ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { ref: caretRef, className: "ow-chat-message__caret", "aria-hidden": "true" }) : null
|
|
7344
7379
|
] }),
|
|
7345
|
-
status === "error" ? /* @__PURE__ */ (0,
|
|
7346
|
-
/* @__PURE__ */ (0,
|
|
7347
|
-
/* @__PURE__ */ (0,
|
|
7348
|
-
onRetry ? /* @__PURE__ */ (0,
|
|
7380
|
+
status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: cx("ow-chat-message__error", onRetry && "ow-chat-message__error--retry"), children: [
|
|
7381
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(CircleAlertIcon, { size: 16, className: "ow-chat-message__error-icon" }),
|
|
7382
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ow-chat-message__error-text", children: errorText }),
|
|
7383
|
+
onRetry ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Button, { size: "sm", startIcon: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(RotateCcwIcon, { size: 16 }), onClick: onRetry, children: retryLabel }) : null
|
|
7349
7384
|
] }) : null,
|
|
7350
|
-
actions && !streaming ? /* @__PURE__ */ (0,
|
|
7385
|
+
actions && !streaming ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "ow-chat-message__actions", children: actions }) : null
|
|
7351
7386
|
] })
|
|
7352
7387
|
]
|
|
7353
7388
|
}
|
|
@@ -7359,8 +7394,8 @@ function CopyAction({ text, label, copiedLabel }) {
|
|
|
7359
7394
|
const timer = (0, import_react61.useRef)(0);
|
|
7360
7395
|
(0, import_react61.useEffect)(() => () => window.clearTimeout(timer.current), []);
|
|
7361
7396
|
const current = copied ? copiedLabel : label;
|
|
7362
|
-
return /* @__PURE__ */ (0,
|
|
7363
|
-
/* @__PURE__ */ (0,
|
|
7397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
7398
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Tooltip, { label: current, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
7364
7399
|
Button,
|
|
7365
7400
|
{
|
|
7366
7401
|
variant: "ghost",
|
|
@@ -7375,13 +7410,13 @@ function CopyAction({ text, label, copiedLabel }) {
|
|
|
7375
7410
|
timer.current = window.setTimeout(() => setCopied(false), 2e3);
|
|
7376
7411
|
}
|
|
7377
7412
|
},
|
|
7378
|
-
children: /* @__PURE__ */ (0,
|
|
7379
|
-
/* @__PURE__ */ (0,
|
|
7380
|
-
/* @__PURE__ */ (0,
|
|
7413
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("span", { className: "ow-chat-actions__copy-icon", children: [
|
|
7414
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(CopyIcon, { size: 16 }),
|
|
7415
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(CheckIcon, { size: 16 })
|
|
7381
7416
|
] })
|
|
7382
7417
|
}
|
|
7383
7418
|
) }),
|
|
7384
|
-
/* @__PURE__ */ (0,
|
|
7419
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "ow-visually-hidden", "aria-live": "polite", children: copied ? copiedLabel : "" })
|
|
7385
7420
|
] });
|
|
7386
7421
|
}
|
|
7387
7422
|
function ChatMessageActions({
|
|
@@ -7400,7 +7435,7 @@ function ChatMessageActions({
|
|
|
7400
7435
|
const [current, setCurrent] = useControllableState(rating, defaultRating, onRate);
|
|
7401
7436
|
const rate = (value, label, Icon) => {
|
|
7402
7437
|
const pressed = current === value;
|
|
7403
|
-
return /* @__PURE__ */ (0,
|
|
7438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Tooltip, { label, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
7404
7439
|
ToggleButton,
|
|
7405
7440
|
{
|
|
7406
7441
|
variant: "ghost",
|
|
@@ -7410,15 +7445,15 @@ function ChatMessageActions({
|
|
|
7410
7445
|
pressed,
|
|
7411
7446
|
className: "ow-chat-actions__rate",
|
|
7412
7447
|
onPressedChange: () => setCurrent(pressed ? null : value),
|
|
7413
|
-
children: /* @__PURE__ */ (0,
|
|
7448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Icon, { size: 16 })
|
|
7414
7449
|
}
|
|
7415
7450
|
) });
|
|
7416
7451
|
};
|
|
7417
|
-
return /* @__PURE__ */ (0,
|
|
7418
|
-
text !== void 0 ? /* @__PURE__ */ (0,
|
|
7419
|
-
onEdit ? /* @__PURE__ */ (0,
|
|
7420
|
-
onRetry ? /* @__PURE__ */ (0,
|
|
7421
|
-
onRate ? /* @__PURE__ */ (0,
|
|
7452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Toolbar, { variant: "plain", size: "sm", "aria-label": ariaLabel, className: cx("ow-chat-actions", className), children: [
|
|
7453
|
+
text !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(CopyAction, { text, label: words.copy, copiedLabel: words.copied }) : null,
|
|
7454
|
+
onEdit ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Tooltip, { label: words.edit, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Button, { variant: "ghost", size: "sm", iconOnly: true, "aria-label": words.edit, onClick: onEdit, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(PencilIcon, { size: 16 }) }) }) : null,
|
|
7455
|
+
onRetry ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Tooltip, { label: words.retry, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Button, { variant: "ghost", size: "sm", iconOnly: true, "aria-label": words.retry, onClick: onRetry, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(RotateCcwIcon, { size: 16 }) }) }) : null,
|
|
7456
|
+
onRate ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
7422
7457
|
rate("up", words.good, ThumbsUpIcon),
|
|
7423
7458
|
rate("down", words.bad, ThumbsDownIcon)
|
|
7424
7459
|
] }) : null,
|
|
@@ -7427,31 +7462,31 @@ function ChatMessageActions({
|
|
|
7427
7462
|
}
|
|
7428
7463
|
|
|
7429
7464
|
// src/components/Chat/ChatLoader.tsx
|
|
7430
|
-
var
|
|
7465
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
7431
7466
|
function ChatLoader({ label, inline = false, name, avatar, srLabel = "Working\u2026", className }) {
|
|
7432
7467
|
const entering = useChatEntrance();
|
|
7433
|
-
const indicator = label != null ? /* @__PURE__ */ (0,
|
|
7434
|
-
/* @__PURE__ */ (0,
|
|
7435
|
-
/* @__PURE__ */ (0,
|
|
7436
|
-
/* @__PURE__ */ (0,
|
|
7437
|
-
/* @__PURE__ */ (0,
|
|
7468
|
+
const indicator = label != null ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TextShimmer, { className: "ow-chat-loader__label", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("span", { className: "ow-chat-loader__dots", children: [
|
|
7469
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ow-chat-loader__dot", "aria-hidden": "true" }),
|
|
7470
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ow-chat-loader__dot", "aria-hidden": "true" }),
|
|
7471
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ow-chat-loader__dot", "aria-hidden": "true" }),
|
|
7472
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ow-visually-hidden", children: srLabel })
|
|
7438
7473
|
] });
|
|
7439
7474
|
if (inline) {
|
|
7440
|
-
return /* @__PURE__ */ (0,
|
|
7475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { role: "status", className: cx("ow-chat-loader", "ow-chat-loader--inline", className), children: indicator });
|
|
7441
7476
|
}
|
|
7442
|
-
const avatarNode = avatar === void 0 ? /* @__PURE__ */ (0,
|
|
7443
|
-
return /* @__PURE__ */ (0,
|
|
7444
|
-
avatarNode != null && avatarNode !== false ? /* @__PURE__ */ (0,
|
|
7445
|
-
/* @__PURE__ */ (0,
|
|
7446
|
-
name != null ? /* @__PURE__ */ (0,
|
|
7447
|
-
/* @__PURE__ */ (0,
|
|
7477
|
+
const avatarNode = avatar === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ChatAgentAvatar, {}) : avatar;
|
|
7478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { role: "status", className: cx("ow-chat-message", "ow-chat-message--assistant", "ow-chat-loader", entering && "ow-chat-loader--enter", className), children: [
|
|
7479
|
+
avatarNode != null && avatarNode !== false ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ow-chat-message__avatar", children: avatarNode }) : null,
|
|
7480
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "ow-chat-message__main", children: [
|
|
7481
|
+
name != null ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ow-chat-message__header", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "ow-chat-message__name", children: name }) }) : null,
|
|
7482
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "ow-chat-loader__line", children: indicator })
|
|
7448
7483
|
] })
|
|
7449
7484
|
] });
|
|
7450
7485
|
}
|
|
7451
7486
|
|
|
7452
7487
|
// src/components/ChatTool/ChatTool.tsx
|
|
7453
7488
|
var import_react62 = require("react");
|
|
7454
|
-
var
|
|
7489
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
7455
7490
|
var statusWords = {
|
|
7456
7491
|
pending: "Not started",
|
|
7457
7492
|
running: "Running",
|
|
@@ -7461,7 +7496,7 @@ var statusWords = {
|
|
|
7461
7496
|
cancelled: "Cancelled"
|
|
7462
7497
|
};
|
|
7463
7498
|
function SlashIcon() {
|
|
7464
|
-
return /* @__PURE__ */ (0,
|
|
7499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7465
7500
|
"svg",
|
|
7466
7501
|
{
|
|
7467
7502
|
width: 12,
|
|
@@ -7473,12 +7508,12 @@ function SlashIcon() {
|
|
|
7473
7508
|
strokeLinecap: "round",
|
|
7474
7509
|
"aria-hidden": "true",
|
|
7475
7510
|
focusable: "false",
|
|
7476
|
-
children: /* @__PURE__ */ (0,
|
|
7511
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M7 17 17 7" })
|
|
7477
7512
|
}
|
|
7478
7513
|
);
|
|
7479
7514
|
}
|
|
7480
7515
|
function ExclamationIcon() {
|
|
7481
|
-
return /* @__PURE__ */ (0,
|
|
7516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
7482
7517
|
"svg",
|
|
7483
7518
|
{
|
|
7484
7519
|
width: 12,
|
|
@@ -7491,18 +7526,18 @@ function ExclamationIcon() {
|
|
|
7491
7526
|
"aria-hidden": "true",
|
|
7492
7527
|
focusable: "false",
|
|
7493
7528
|
children: [
|
|
7494
|
-
/* @__PURE__ */ (0,
|
|
7495
|
-
/* @__PURE__ */ (0,
|
|
7529
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M12 5v9" }),
|
|
7530
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("path", { d: "M12 19h.01" })
|
|
7496
7531
|
]
|
|
7497
7532
|
}
|
|
7498
7533
|
);
|
|
7499
7534
|
}
|
|
7500
7535
|
function ChatStatusMarker({ status, icon: icon2 }) {
|
|
7501
7536
|
const showsIcon = Boolean(icon2) && (status === "success" || status === "pending");
|
|
7502
|
-
const glyph = status === "running" ? /* @__PURE__ */ (0,
|
|
7503
|
-
return /* @__PURE__ */ (0,
|
|
7504
|
-
/* @__PURE__ */ (0,
|
|
7505
|
-
/* @__PURE__ */ (0,
|
|
7537
|
+
const glyph = status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Spinner, { size: "sm", label: "" }) : status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(XIcon, { size: 12, strokeWidth: 3 }) : status === "approval" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ExclamationIcon, {}) : status === "cancelled" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SlashIcon, {}) : showsIcon ? icon2 : status === "success" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(CheckIcon, { size: 12, strokeWidth: 3 }) : null;
|
|
7538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: cx("ow-chat-status", `ow-chat-status--${status}`, showsIcon && "ow-chat-status--icon"), children: [
|
|
7539
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-status__glyph", "aria-hidden": "true", children: glyph }),
|
|
7540
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "ow-visually-hidden", children: [
|
|
7506
7541
|
statusWords[status],
|
|
7507
7542
|
": "
|
|
7508
7543
|
] })
|
|
@@ -7525,7 +7560,7 @@ function formatDuration(ms, locale) {
|
|
|
7525
7560
|
return rest ? `${number(hours)} h ${number(rest)} min` : `${number(hours)} h`;
|
|
7526
7561
|
}
|
|
7527
7562
|
function ChatDuration({ ms, locale, className }) {
|
|
7528
|
-
return /* @__PURE__ */ (0,
|
|
7563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("time", { dateTime: `PT${Math.max(0, Math.round(ms)) / 1e3}S`, className, children: formatDuration(ms, locale) });
|
|
7529
7564
|
}
|
|
7530
7565
|
function useStatusExpansion({
|
|
7531
7566
|
expanded,
|
|
@@ -7568,7 +7603,7 @@ function ChatCollapse({
|
|
|
7568
7603
|
(0, import_react62.useEffect)(() => {
|
|
7569
7604
|
if (ref.current) ref.current.inert = !open;
|
|
7570
7605
|
}, [open]);
|
|
7571
|
-
return /* @__PURE__ */ (0,
|
|
7606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { ref, id, className: cx("ow-chat-collapse", bleed && "ow-chat-collapse--bleed"), "data-open": open, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ow-chat-collapse__clip", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className, children }) }) });
|
|
7572
7607
|
}
|
|
7573
7608
|
var codeMaxHeight = 280;
|
|
7574
7609
|
function formatInput(input) {
|
|
@@ -7637,23 +7672,23 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
|
|
|
7637
7672
|
if (!active || active === document.body) (triggerRef.current ?? rootRef.current)?.focus();
|
|
7638
7673
|
}, [needsApproval]);
|
|
7639
7674
|
const running = status === "running";
|
|
7640
|
-
const header = /* @__PURE__ */ (0,
|
|
7641
|
-
/* @__PURE__ */ (0,
|
|
7642
|
-
icon2 ? /* @__PURE__ */ (0,
|
|
7643
|
-
/* @__PURE__ */ (0,
|
|
7644
|
-
/* @__PURE__ */ (0,
|
|
7645
|
-
/* @__PURE__ */ (0,
|
|
7646
|
-
name ? /* @__PURE__ */ (0,
|
|
7675
|
+
const header = /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
7676
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChatStatusMarker, { status }),
|
|
7677
|
+
icon2 ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__icon", "aria-hidden": "true", children: icon2 }) : null,
|
|
7678
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "ow-chat-tool__main", children: [
|
|
7679
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "ow-chat-tool__heading", children: [
|
|
7680
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__title", children: running ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(TextShimmer, { children: title }) : title }),
|
|
7681
|
+
name ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Code, { className: "ow-chat-tool__name", children: name }) : null
|
|
7647
7682
|
] }),
|
|
7648
|
-
hasMeta ? /* @__PURE__ */ (0,
|
|
7649
|
-
summary ? /* @__PURE__ */ (0,
|
|
7650
|
-
summary && duration !== void 0 ? /* @__PURE__ */ (0,
|
|
7651
|
-
duration !== void 0 ? /* @__PURE__ */ (0,
|
|
7683
|
+
hasMeta ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "ow-chat-tool__meta", children: [
|
|
7684
|
+
summary ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__summary", children: summary }) : null,
|
|
7685
|
+
summary && duration !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__dot", "aria-hidden": "true", children: "\xB7" }) : null,
|
|
7686
|
+
duration !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChatDuration, { ms: duration, locale, className: "ow-chat-tool__duration" }) : null
|
|
7652
7687
|
] }) : null
|
|
7653
7688
|
] }),
|
|
7654
|
-
hasDetails ? /* @__PURE__ */ (0,
|
|
7689
|
+
hasDetails ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ChevronRightIcon, { size: 14 }) }) : null
|
|
7655
7690
|
] });
|
|
7656
|
-
return /* @__PURE__ */ (0,
|
|
7691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
7657
7692
|
"div",
|
|
7658
7693
|
{
|
|
7659
7694
|
ref: (element) => {
|
|
@@ -7668,7 +7703,7 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
|
|
|
7668
7703
|
tabIndex: hasDetails ? void 0 : -1,
|
|
7669
7704
|
...props,
|
|
7670
7705
|
children: [
|
|
7671
|
-
hasDetails ? /* @__PURE__ */ (0,
|
|
7706
|
+
hasDetails ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7672
7707
|
"button",
|
|
7673
7708
|
{
|
|
7674
7709
|
ref: triggerRef,
|
|
@@ -7680,28 +7715,28 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
|
|
|
7680
7715
|
onClick: toggle,
|
|
7681
7716
|
children: header
|
|
7682
7717
|
}
|
|
7683
|
-
) : /* @__PURE__ */ (0,
|
|
7684
|
-
hasDetails ? /* @__PURE__ */ (0,
|
|
7685
|
-
hasInput ? /* @__PURE__ */ (0,
|
|
7686
|
-
/* @__PURE__ */ (0,
|
|
7687
|
-
typeof input === "string" && !input.includes("\n") ? /* @__PURE__ */ (0,
|
|
7718
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ow-chat-tool__header", children: header }),
|
|
7719
|
+
hasDetails ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(ChatCollapse, { id: `${id}-details`, open: isOpen, className: "ow-chat-tool__details", children: [
|
|
7720
|
+
hasInput ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ow-chat-tool__section", children: [
|
|
7721
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__label", children: "Input" }),
|
|
7722
|
+
typeof input === "string" && !input.includes("\n") ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Snippet, { value: input, prompt: null }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(CodeBlock, { code: formatInput(input), language: typeof input === "string" ? void 0 : "json", maxHeight: codeMaxHeight })
|
|
7688
7723
|
] }) : null,
|
|
7689
|
-
hasOutput ? /* @__PURE__ */ (0,
|
|
7690
|
-
/* @__PURE__ */ (0,
|
|
7691
|
-
typeof output === "string" ? /* @__PURE__ */ (0,
|
|
7724
|
+
hasOutput ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ow-chat-tool__section", children: [
|
|
7725
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__label", children: "Output" }),
|
|
7726
|
+
typeof output === "string" ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(CodeBlock, { code: output, maxHeight: codeMaxHeight }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ow-chat-tool__output", children: output })
|
|
7692
7727
|
] }) : null,
|
|
7693
|
-
hasError ? /* @__PURE__ */ (0,
|
|
7694
|
-
/* @__PURE__ */ (0,
|
|
7695
|
-
/* @__PURE__ */ (0,
|
|
7728
|
+
hasError ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ow-chat-tool__section", children: [
|
|
7729
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-chat-tool__label", children: "Error" }),
|
|
7730
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "ow-chat-tool__error", children: error })
|
|
7696
7731
|
] }) : null
|
|
7697
7732
|
] }) : null,
|
|
7698
|
-
needsApproval ? /* @__PURE__ */ (0,
|
|
7699
|
-
/* @__PURE__ */ (0,
|
|
7733
|
+
needsApproval ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ow-chat-tool__approval", role: "group", "aria-labelledby": `${id}-request`, children: [
|
|
7734
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("p", { ref: messageRef, id: `${id}-request`, className: "ow-chat-tool__request", children: approvalMessage ?? (name ? /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
7700
7735
|
"Wants to run ",
|
|
7701
|
-
/* @__PURE__ */ (0,
|
|
7736
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Code, { children: name })
|
|
7702
7737
|
] }) : "Wants to go ahead") }),
|
|
7703
|
-
/* @__PURE__ */ (0,
|
|
7704
|
-
/* @__PURE__ */ (0,
|
|
7738
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "ow-chat-tool__actions", children: [
|
|
7739
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7705
7740
|
Button,
|
|
7706
7741
|
{
|
|
7707
7742
|
variant: "primary",
|
|
@@ -7713,7 +7748,7 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
|
|
|
7713
7748
|
children: approveLabel
|
|
7714
7749
|
}
|
|
7715
7750
|
),
|
|
7716
|
-
/* @__PURE__ */ (0,
|
|
7751
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7717
7752
|
Button,
|
|
7718
7753
|
{
|
|
7719
7754
|
size: "sm",
|
|
@@ -7726,7 +7761,7 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
|
|
|
7726
7761
|
)
|
|
7727
7762
|
] })
|
|
7728
7763
|
] }) : null,
|
|
7729
|
-
/* @__PURE__ */ (0,
|
|
7764
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "ow-visually-hidden", "aria-live": "polite", children: announcement })
|
|
7730
7765
|
]
|
|
7731
7766
|
}
|
|
7732
7767
|
);
|
|
@@ -7734,7 +7769,7 @@ var ChatTool = /* @__PURE__ */ (0, import_react62.forwardRef)(function ChatTool2
|
|
|
7734
7769
|
|
|
7735
7770
|
// src/components/ChainOfThought/ChainOfThought.tsx
|
|
7736
7771
|
var import_react63 = require("react");
|
|
7737
|
-
var
|
|
7772
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
7738
7773
|
var plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
7739
7774
|
var ChainOfThought = /* @__PURE__ */ (0, import_react63.forwardRef)(function ChainOfThought2({
|
|
7740
7775
|
steps = [],
|
|
@@ -7766,30 +7801,30 @@ var ChainOfThought = /* @__PURE__ */ (0, import_react63.forwardRef)(function Cha
|
|
|
7766
7801
|
const failed = steps.filter((step) => step.status === "error").length;
|
|
7767
7802
|
const heading = label ?? (running ? "Thinking\u2026" : duration !== void 0 ? `Thought for ${formatDuration(duration, locale)}` : "Reasoning");
|
|
7768
7803
|
const count = steps.length > 0 ? running ? `${finished} of ${plural(steps.length, "step")}` : plural(steps.length, "step") : null;
|
|
7769
|
-
const headerText = /* @__PURE__ */ (0,
|
|
7770
|
-
/* @__PURE__ */ (0,
|
|
7771
|
-
count ? /* @__PURE__ */ (0,
|
|
7772
|
-
/* @__PURE__ */ (0,
|
|
7804
|
+
const headerText = /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "ow-chat-toggle__text", children: [
|
|
7805
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "ow-chain-of-thought__label", children: running ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(TextShimmer, { children: heading }) : heading }),
|
|
7806
|
+
count ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "ow-chat-toggle__meta", children: [
|
|
7807
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { "aria-hidden": "true", children: "\xB7 " }),
|
|
7773
7808
|
count,
|
|
7774
|
-
failed > 0 ? /* @__PURE__ */ (0,
|
|
7809
|
+
failed > 0 ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("span", { className: "ow-chain-of-thought__failed", children: [
|
|
7775
7810
|
", ",
|
|
7776
7811
|
failed,
|
|
7777
7812
|
" failed"
|
|
7778
7813
|
] }) : null
|
|
7779
7814
|
] }) : null
|
|
7780
7815
|
] });
|
|
7781
|
-
return /* @__PURE__ */ (0,
|
|
7782
|
-
hasBody ? /* @__PURE__ */ (0,
|
|
7783
|
-
/* @__PURE__ */ (0,
|
|
7816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { ref, className: cx("ow-chain-of-thought", className), "data-status": status, "aria-busy": running || void 0, ...props, children: [
|
|
7817
|
+
hasBody ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("button", { type: "button", className: "ow-chat-toggle", "aria-expanded": isOpen, "aria-controls": `${id}-body`, onClick: toggle, children: [
|
|
7818
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "ow-chat-toggle__chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChevronRightIcon, { size: 14 }) }),
|
|
7784
7819
|
headerText
|
|
7785
|
-
] }) : /* @__PURE__ */ (0,
|
|
7786
|
-
hasBody ? /* @__PURE__ */ (0,
|
|
7787
|
-
hasReasoning ? /* @__PURE__ */ (0,
|
|
7788
|
-
steps.length > 0 ? /* @__PURE__ */ (0,
|
|
7789
|
-
/* @__PURE__ */ (0,
|
|
7790
|
-
/* @__PURE__ */ (0,
|
|
7791
|
-
/* @__PURE__ */ (0,
|
|
7792
|
-
step.detail !== void 0 && step.detail !== null ? /* @__PURE__ */ (0,
|
|
7820
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "ow-chat-toggle ow-chain-of-thought__static", children: headerText }),
|
|
7821
|
+
hasBody ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(ChatCollapse, { id: `${id}-body`, open: isOpen, bleed: true, className: "ow-chain-of-thought__body", children: [
|
|
7822
|
+
hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "ow-chain-of-thought__reasoning", children }) : null,
|
|
7823
|
+
steps.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("ol", { className: "ow-chain-of-thought__steps", children: steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("li", { className: "ow-chain-of-thought__step", "data-status": step.status, children: [
|
|
7824
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ChatStatusMarker, { status: step.status, icon: step.icon }),
|
|
7825
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "ow-chain-of-thought__step-body", children: [
|
|
7826
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "ow-chain-of-thought__step-title", children: step.status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(TextShimmer, { children: step.title }) : step.title }),
|
|
7827
|
+
step.detail !== void 0 && step.detail !== null ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "ow-chain-of-thought__detail", children: step.detail }) : null
|
|
7793
7828
|
] })
|
|
7794
7829
|
] }, step.id)) }) : null
|
|
7795
7830
|
] }) : null
|
|
@@ -7798,7 +7833,7 @@ var ChainOfThought = /* @__PURE__ */ (0, import_react63.forwardRef)(function Cha
|
|
|
7798
7833
|
|
|
7799
7834
|
// src/components/ChatSource/ChatSource.tsx
|
|
7800
7835
|
var import_react64 = require("react");
|
|
7801
|
-
var
|
|
7836
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
7802
7837
|
var openDelay = 250;
|
|
7803
7838
|
var closeDelay = 150;
|
|
7804
7839
|
var ChatSource = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSource2({
|
|
@@ -7867,8 +7902,8 @@ var ChatSource = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSou
|
|
|
7867
7902
|
onClick?.(event);
|
|
7868
7903
|
}
|
|
7869
7904
|
};
|
|
7870
|
-
const chipText = /* @__PURE__ */ (0,
|
|
7871
|
-
return /* @__PURE__ */ (0,
|
|
7905
|
+
const chipText = /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-source__chip-text", children: index ?? label });
|
|
7906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
7872
7907
|
"span",
|
|
7873
7908
|
{
|
|
7874
7909
|
ref: wrapperRef,
|
|
@@ -7880,19 +7915,19 @@ var ChatSource = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSou
|
|
|
7880
7915
|
if (event.pointerType === "mouse") schedule(false, closeDelay);
|
|
7881
7916
|
},
|
|
7882
7917
|
children: [
|
|
7883
|
-
href ? /* @__PURE__ */ (0,
|
|
7884
|
-
/* @__PURE__ */ (0,
|
|
7885
|
-
/* @__PURE__ */ (0,
|
|
7886
|
-
icon2 ? /* @__PURE__ */ (0,
|
|
7887
|
-
/* @__PURE__ */ (0,
|
|
7918
|
+
href ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("a", { href, ...externalProps, ...chipProps, children: chipText }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("button", { type: "button", ...chipProps, children: chipText }),
|
|
7919
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { ref: cardRef, ...manualPopover, hidden: !mounted, "data-state": state, className: "ow-chat-source-card ow-floating", style, children: [
|
|
7920
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ow-chat-source-card__header", children: [
|
|
7921
|
+
icon2 ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-source-card__icon", "aria-hidden": "true", children: icon2 }) : null,
|
|
7922
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { id: `${id}-title`, className: "ow-chat-source-card__title", children: title })
|
|
7888
7923
|
] }),
|
|
7889
|
-
source ? /* @__PURE__ */ (0,
|
|
7890
|
-
snippet ? /* @__PURE__ */ (0,
|
|
7924
|
+
source ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { id: `${id}-source`, className: "ow-chat-source-card__source", children: source }) : null,
|
|
7925
|
+
snippet ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { id: `${id}-snippet`, className: cx("ow-chat-source-card__snippet", `ow-chat-source-card__snippet--${snippetFormat}`), children: snippet }) : null,
|
|
7891
7926
|
href ? (
|
|
7892
7927
|
// The chip is the same link, so this one stays out of the tab order.
|
|
7893
|
-
/* @__PURE__ */ (0,
|
|
7928
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("a", { href, ...externalProps, tabIndex: -1, className: cx(linkClassName({ variant: "standalone" }), "ow-chat-source-card__open"), children: [
|
|
7894
7929
|
openLabel,
|
|
7895
|
-
/* @__PURE__ */ (0,
|
|
7930
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ArrowUpRightIcon, { size: 13 })
|
|
7896
7931
|
] })
|
|
7897
7932
|
) : null
|
|
7898
7933
|
] })
|
|
@@ -7904,30 +7939,30 @@ var ChatSources = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSo
|
|
|
7904
7939
|
const id = (0, import_react64.useId)();
|
|
7905
7940
|
const [isOpen, setOpen] = useControllableState(expanded, defaultExpanded, onExpandedChange);
|
|
7906
7941
|
if (sources.length === 0) return null;
|
|
7907
|
-
return /* @__PURE__ */ (0,
|
|
7908
|
-
/* @__PURE__ */ (0,
|
|
7909
|
-
/* @__PURE__ */ (0,
|
|
7910
|
-
/* @__PURE__ */ (0,
|
|
7942
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { ref, className: cx("ow-chat-sources", className), ...props, children: [
|
|
7943
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("button", { type: "button", className: "ow-chat-toggle", "aria-expanded": isOpen, "aria-controls": `${id}-list`, onClick: () => setOpen(!isOpen), children: [
|
|
7944
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-toggle__chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ChevronRightIcon, { size: 14 }) }),
|
|
7945
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-toggle__text", children: label ?? `${sources.length} ${sources.length === 1 ? "source" : "sources"}` })
|
|
7911
7946
|
] }),
|
|
7912
|
-
/* @__PURE__ */ (0,
|
|
7913
|
-
const content = /* @__PURE__ */ (0,
|
|
7914
|
-
/* @__PURE__ */ (0,
|
|
7915
|
-
item.index !== void 0 ? /* @__PURE__ */ (0,
|
|
7916
|
-
/* @__PURE__ */ (0,
|
|
7947
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ChatCollapse, { id: `${id}-list`, open: isOpen, bleed: true, className: "ow-chat-sources__body", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("ul", { className: "ow-chat-sources__list", children: sources.map((item, position) => {
|
|
7948
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
7949
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ow-chat-sources__lead", children: [
|
|
7950
|
+
item.index !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ow-chat-sources__index", children: [
|
|
7951
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-visually-hidden", children: "Source " }),
|
|
7917
7952
|
item.index
|
|
7918
7953
|
] }) : null,
|
|
7919
|
-
item.icon || item.index === void 0 ? /* @__PURE__ */ (0,
|
|
7954
|
+
item.icon || item.index === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-sources__icon", "aria-hidden": "true", children: item.icon ?? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(FileIcon, { size: 15 }) }) : null
|
|
7920
7955
|
] }),
|
|
7921
|
-
/* @__PURE__ */ (0,
|
|
7922
|
-
/* @__PURE__ */ (0,
|
|
7923
|
-
item.source ? /* @__PURE__ */ (0,
|
|
7956
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("span", { className: "ow-chat-sources__text", children: [
|
|
7957
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-sources__title", children: item.title }),
|
|
7958
|
+
item.source ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-sources__source", children: item.source }) : null
|
|
7924
7959
|
] }),
|
|
7925
|
-
item.href && item.external ? /* @__PURE__ */ (0,
|
|
7926
|
-
/* @__PURE__ */ (0,
|
|
7927
|
-
/* @__PURE__ */ (0,
|
|
7960
|
+
item.href && item.external ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
7961
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-chat-sources__external", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ArrowUpRightIcon, { size: 14 }) }),
|
|
7962
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "ow-visually-hidden", children: " (opens in a new tab)" })
|
|
7928
7963
|
] }) : null
|
|
7929
7964
|
] });
|
|
7930
|
-
return /* @__PURE__ */ (0,
|
|
7965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("li", { children: item.href ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
7931
7966
|
"a",
|
|
7932
7967
|
{
|
|
7933
7968
|
href: item.href,
|
|
@@ -7935,7 +7970,7 @@ var ChatSources = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSo
|
|
|
7935
7970
|
...item.external ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
7936
7971
|
children: content
|
|
7937
7972
|
}
|
|
7938
|
-
) : /* @__PURE__ */ (0,
|
|
7973
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "ow-chat-sources__card", children: content }) }, item.id ?? item.index ?? position);
|
|
7939
7974
|
}) }) })
|
|
7940
7975
|
] });
|
|
7941
7976
|
});
|
|
@@ -7943,7 +7978,7 @@ var ChatSources = /* @__PURE__ */ (0, import_react64.forwardRef)(function ChatSo
|
|
|
7943
7978
|
// src/components/ColorPicker/ColorPicker.tsx
|
|
7944
7979
|
var import_react65 = require("react");
|
|
7945
7980
|
var import_react_colorful = require("react-colorful");
|
|
7946
|
-
var
|
|
7981
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
7947
7982
|
var swatchColor = (swatch) => typeof swatch === "string" ? swatch : swatch.color;
|
|
7948
7983
|
var swatchName = (swatch) => typeof swatch === "string" ? swatch : swatch.name;
|
|
7949
7984
|
var same = (a, b) => a.toLowerCase().replace(/^#/, "") === b.toLowerCase().replace(/^#/, "");
|
|
@@ -7978,13 +8013,13 @@ function ColorPicker({
|
|
|
7978
8013
|
} catch {
|
|
7979
8014
|
}
|
|
7980
8015
|
}
|
|
7981
|
-
return /* @__PURE__ */ (0,
|
|
7982
|
-
/* @__PURE__ */ (0,
|
|
7983
|
-
showInput || eyeDropper && canPick ? /* @__PURE__ */ (0,
|
|
7984
|
-
eyeDropper && canPick ? /* @__PURE__ */ (0,
|
|
7985
|
-
showInput ? /* @__PURE__ */ (0,
|
|
7986
|
-
/* @__PURE__ */ (0,
|
|
7987
|
-
/* @__PURE__ */ (0,
|
|
8016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { ref: rootRef, role: "group", "aria-label": ariaLabel, className: cx("ow-color-picker", className), children: [
|
|
8017
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Picker, { color, onChange: change }),
|
|
8018
|
+
showInput || eyeDropper && canPick ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "ow-color-picker__row", children: [
|
|
8019
|
+
eyeDropper && canPick ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("button", { type: "button", className: "ow-color-picker__dropper", "aria-label": "Pick a colour from the screen", onClick: pickFromScreen, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(PipetteIcon, { size: 15 }) }) : null,
|
|
8020
|
+
showInput ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("span", { className: "ow-input-group ow-input-group--sm ow-color-picker__input", children: [
|
|
8021
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ow-input-group__addon", "aria-hidden": "true", children: "#" }),
|
|
8022
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7988
8023
|
import_react_colorful.HexColorInput,
|
|
7989
8024
|
{
|
|
7990
8025
|
className: "ow-input-group__input",
|
|
@@ -7996,11 +8031,11 @@ function ColorPicker({
|
|
|
7996
8031
|
}
|
|
7997
8032
|
)
|
|
7998
8033
|
] }) : null,
|
|
7999
|
-
/* @__PURE__ */ (0,
|
|
8034
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ow-color-picker__preview", style: { "--ow-color-picker-value": color }, "aria-hidden": "true" })
|
|
8000
8035
|
] }) : null,
|
|
8001
|
-
swatches?.length ? /* @__PURE__ */ (0,
|
|
8036
|
+
swatches?.length ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "ow-color-picker__swatches", role: "group", "aria-label": "Swatches", children: swatches.map((swatch) => {
|
|
8002
8037
|
const swatchValue = swatchColor(swatch);
|
|
8003
|
-
return /* @__PURE__ */ (0,
|
|
8038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8004
8039
|
"button",
|
|
8005
8040
|
{
|
|
8006
8041
|
type: "button",
|
|
@@ -8052,8 +8087,8 @@ var ColorField = /* @__PURE__ */ (0, import_react65.forwardRef)(function ColorFi
|
|
|
8052
8087
|
const frame = requestAnimationFrame(() => panelRef.current?.querySelector(".react-colorful__interactive")?.focus());
|
|
8053
8088
|
return () => cancelAnimationFrame(frame);
|
|
8054
8089
|
}, [isOpen]);
|
|
8055
|
-
return /* @__PURE__ */ (0,
|
|
8056
|
-
/* @__PURE__ */ (0,
|
|
8090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
8091
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
8057
8092
|
"button",
|
|
8058
8093
|
{
|
|
8059
8094
|
ref: (element) => {
|
|
@@ -8065,9 +8100,9 @@ var ColorField = /* @__PURE__ */ (0, import_react65.forwardRef)(function ColorFi
|
|
|
8065
8100
|
"aria-haspopup": "dialog",
|
|
8066
8101
|
"aria-expanded": isOpen,
|
|
8067
8102
|
"aria-controls": isOpen ? panelId : void 0,
|
|
8068
|
-
"aria-label": ariaLabel,
|
|
8069
|
-
"aria-labelledby": ariaLabelledBy,
|
|
8070
|
-
"aria-describedby":
|
|
8103
|
+
"aria-label": ariaLabel && !ariaLabelledBy ? `${ariaLabel}, ${color.toUpperCase()}` : void 0,
|
|
8104
|
+
"aria-labelledby": ariaLabelledBy ? `${ariaLabelledBy} ${panelId}-value` : void 0,
|
|
8105
|
+
"aria-describedby": ariaDescribedBy,
|
|
8071
8106
|
"aria-invalid": isInvalid || void 0,
|
|
8072
8107
|
disabled,
|
|
8073
8108
|
className: cx(
|
|
@@ -8085,13 +8120,13 @@ var ColorField = /* @__PURE__ */ (0, import_react65.forwardRef)(function ColorFi
|
|
|
8085
8120
|
}
|
|
8086
8121
|
},
|
|
8087
8122
|
children: [
|
|
8088
|
-
/* @__PURE__ */ (0,
|
|
8089
|
-
/* @__PURE__ */ (0,
|
|
8090
|
-
/* @__PURE__ */ (0,
|
|
8123
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "ow-color-field__swatch", style: { "--ow-color-picker-value": color }, "aria-hidden": "true" }),
|
|
8124
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { id: `${panelId}-value`, className: "ow-select__value ow-color-field__value", children: color.toUpperCase() }),
|
|
8125
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ChevronDownIcon, { size: size2 === "sm" ? 14 : 16, className: "ow-select__chevron" })
|
|
8091
8126
|
]
|
|
8092
8127
|
}
|
|
8093
8128
|
),
|
|
8094
|
-
mounted ? /* @__PURE__ */ (0,
|
|
8129
|
+
mounted ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
8095
8130
|
"div",
|
|
8096
8131
|
{
|
|
8097
8132
|
ref: panelRef,
|
|
@@ -8105,7 +8140,7 @@ var ColorField = /* @__PURE__ */ (0, import_react65.forwardRef)(function ColorFi
|
|
|
8105
8140
|
onKeyDown: (event) => {
|
|
8106
8141
|
if (event.key === "Enter" && event.target.closest(".react-colorful")) close();
|
|
8107
8142
|
},
|
|
8108
|
-
children: /* @__PURE__ */ (0,
|
|
8143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ColorPicker, { ...pickerProps, value: color, onChange: setColor })
|
|
8109
8144
|
}
|
|
8110
8145
|
) : null
|
|
8111
8146
|
] });
|
|
@@ -8296,7 +8331,7 @@ var hueHex = (h) => toHex(hsvToRgb({ h, s: 100, v: 100, a: 1 }));
|
|
|
8296
8331
|
var hueStops = "#ff0000 0%, #ffff00 16.67%, #00ff00 33.33%, #00ffff 50%, #0000ff 66.67%, #ff00ff 83.33%, #ff0000 100%";
|
|
8297
8332
|
|
|
8298
8333
|
// src/components/ColorPicker/ColorArea.tsx
|
|
8299
|
-
var
|
|
8334
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
8300
8335
|
var size = (length) => typeof length === "number" ? `${length}px` : length;
|
|
8301
8336
|
function assignRef8(ref, value) {
|
|
8302
8337
|
if (typeof ref === "function") ref(value);
|
|
@@ -8377,7 +8412,7 @@ var ColorArea = /* @__PURE__ */ (0, import_react67.forwardRef)(function ColorAre
|
|
|
8377
8412
|
const saturation = `Saturation ${percent.format(hsv.s / 100)}`;
|
|
8378
8413
|
const brightness = `brightness ${percent.format(hsv.v / 100)}`;
|
|
8379
8414
|
const colorName = describeColor(rgba);
|
|
8380
|
-
const input = (which) => /* @__PURE__ */ (0,
|
|
8415
|
+
const input = (which) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
8381
8416
|
"input",
|
|
8382
8417
|
{
|
|
8383
8418
|
ref: (element) => {
|
|
@@ -8404,7 +8439,7 @@ var ColorArea = /* @__PURE__ */ (0, import_react67.forwardRef)(function ColorAre
|
|
|
8404
8439
|
onKeyUp
|
|
8405
8440
|
}
|
|
8406
8441
|
);
|
|
8407
|
-
return /* @__PURE__ */ (0,
|
|
8442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
8408
8443
|
"div",
|
|
8409
8444
|
{
|
|
8410
8445
|
ref: rootRef,
|
|
@@ -8425,7 +8460,7 @@ var ColorArea = /* @__PURE__ */ (0, import_react67.forwardRef)(function ColorAre
|
|
|
8425
8460
|
},
|
|
8426
8461
|
...drag.handlers,
|
|
8427
8462
|
children: [
|
|
8428
|
-
/* @__PURE__ */ (0,
|
|
8463
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
8429
8464
|
"div",
|
|
8430
8465
|
{
|
|
8431
8466
|
className: "ow-color-area__thumb",
|
|
@@ -8436,7 +8471,7 @@ var ColorArea = /* @__PURE__ */ (0, import_react67.forwardRef)(function ColorAre
|
|
|
8436
8471
|
]
|
|
8437
8472
|
}
|
|
8438
8473
|
),
|
|
8439
|
-
name ? /* @__PURE__ */ (0,
|
|
8474
|
+
name ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("input", { type: "hidden", name, value: hex }) : null
|
|
8440
8475
|
]
|
|
8441
8476
|
}
|
|
8442
8477
|
);
|
|
@@ -8444,7 +8479,7 @@ var ColorArea = /* @__PURE__ */ (0, import_react67.forwardRef)(function ColorAre
|
|
|
8444
8479
|
|
|
8445
8480
|
// src/components/ColorPicker/ColorSlider.tsx
|
|
8446
8481
|
var import_react68 = require("react");
|
|
8447
|
-
var
|
|
8482
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
8448
8483
|
var channels = {
|
|
8449
8484
|
hue: { name: "Hue", max: 360, unit: "degree" },
|
|
8450
8485
|
saturation: { name: "Saturation", max: 100, unit: "percent" },
|
|
@@ -8559,7 +8594,7 @@ var ColorSlider = /* @__PURE__ */ (0, import_react68.forwardRef)(function ColorS
|
|
|
8559
8594
|
const shown = format.format(spec.unit === "percent" ? current / 100 : current);
|
|
8560
8595
|
const named = channel === "hue" ? describeColor(parseHex(hueHex(color.value.h))) : describeColor({ ...rgba, a: 1 });
|
|
8561
8596
|
const fill = channel === "hue" ? hueHex(color.value.h) : toHex(rgba, channel === "alpha");
|
|
8562
|
-
return /* @__PURE__ */ (0,
|
|
8597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
8563
8598
|
"div",
|
|
8564
8599
|
{
|
|
8565
8600
|
className: cx(
|
|
@@ -8574,11 +8609,11 @@ var ColorSlider = /* @__PURE__ */ (0, import_react68.forwardRef)(function ColorS
|
|
|
8574
8609
|
className
|
|
8575
8610
|
),
|
|
8576
8611
|
children: [
|
|
8577
|
-
label || showValue ? /* @__PURE__ */ (0,
|
|
8578
|
-
label ? /* @__PURE__ */ (0,
|
|
8579
|
-
showValue ? /* @__PURE__ */ (0,
|
|
8612
|
+
label || showValue ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "ow-color-slider__header", children: [
|
|
8613
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { id: labelId, className: "ow-color-slider__label", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", {}),
|
|
8614
|
+
showValue ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("output", { className: "ow-color-slider__value", "aria-hidden": "true", children: shown }) : null
|
|
8580
8615
|
] }) : null,
|
|
8581
|
-
/* @__PURE__ */ (0,
|
|
8616
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
8582
8617
|
"div",
|
|
8583
8618
|
{
|
|
8584
8619
|
ref: trackRef,
|
|
@@ -8587,12 +8622,12 @@ var ColorSlider = /* @__PURE__ */ (0, import_react68.forwardRef)(function ColorS
|
|
|
8587
8622
|
"--ow-color-slider-gradient": `linear-gradient(var(--ow-color-slider-direction), ${gradient(channel, color.value, rgba)})`
|
|
8588
8623
|
},
|
|
8589
8624
|
...drag.handlers,
|
|
8590
|
-
children: /* @__PURE__ */ (0,
|
|
8625
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
8591
8626
|
"div",
|
|
8592
8627
|
{
|
|
8593
8628
|
className: "ow-color-slider__thumb",
|
|
8594
8629
|
style: { "--ow-color-slider-position": `${current / spec.max * 100}%`, "--ow-color-slider-thumb": fill },
|
|
8595
|
-
children: /* @__PURE__ */ (0,
|
|
8630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
8596
8631
|
"input",
|
|
8597
8632
|
{
|
|
8598
8633
|
ref: (element) => {
|
|
@@ -8624,7 +8659,7 @@ var ColorSlider = /* @__PURE__ */ (0, import_react68.forwardRef)(function ColorS
|
|
|
8624
8659
|
)
|
|
8625
8660
|
}
|
|
8626
8661
|
),
|
|
8627
|
-
name ? /* @__PURE__ */ (0,
|
|
8662
|
+
name ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("input", { type: "hidden", name, value: color.hex }) : null
|
|
8628
8663
|
]
|
|
8629
8664
|
}
|
|
8630
8665
|
);
|
|
@@ -8632,7 +8667,7 @@ var ColorSlider = /* @__PURE__ */ (0, import_react68.forwardRef)(function ColorS
|
|
|
8632
8667
|
|
|
8633
8668
|
// src/components/ColorPicker/ColorSwatchPicker.tsx
|
|
8634
8669
|
var import_react69 = require("react");
|
|
8635
|
-
var
|
|
8670
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
8636
8671
|
var ColorSwatchPicker = /* @__PURE__ */ (0, import_react69.forwardRef)(function ColorSwatchPicker2({ options, value, defaultValue, onChange, size: size2 = "md", shape = "square", disabled = false, name, className, ...aria }, ref) {
|
|
8637
8672
|
const [current, setCurrent] = useControllableState(value, defaultValue ?? "", onChange);
|
|
8638
8673
|
const refs = (0, import_react69.useRef)([]);
|
|
@@ -8669,7 +8704,7 @@ var ColorSwatchPicker = /* @__PURE__ */ (0, import_react69.forwardRef)(function
|
|
|
8669
8704
|
refs.current[target]?.focus();
|
|
8670
8705
|
choose(target);
|
|
8671
8706
|
}
|
|
8672
|
-
return /* @__PURE__ */ (0,
|
|
8707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
8673
8708
|
"div",
|
|
8674
8709
|
{
|
|
8675
8710
|
ref,
|
|
@@ -8686,7 +8721,7 @@ var ColorSwatchPicker = /* @__PURE__ */ (0, import_react69.forwardRef)(function
|
|
|
8686
8721
|
items2.map((item, index) => {
|
|
8687
8722
|
const isSelected = index === selectedIndex;
|
|
8688
8723
|
const isDisabled = disabled || Boolean(item.disabled);
|
|
8689
|
-
return /* @__PURE__ */ (0,
|
|
8724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
8690
8725
|
"div",
|
|
8691
8726
|
{
|
|
8692
8727
|
ref: (element) => {
|
|
@@ -8703,12 +8738,12 @@ var ColorSwatchPicker = /* @__PURE__ */ (0, import_react69.forwardRef)(function
|
|
|
8703
8738
|
style: { "--ow-color-swatch-picker-value": item.value },
|
|
8704
8739
|
onClick: () => choose(index),
|
|
8705
8740
|
onKeyDown: (event) => onKeyDown(event, index),
|
|
8706
|
-
children: /* @__PURE__ */ (0,
|
|
8741
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(CheckIcon, { size: size2 === "sm" ? 14 : 16, strokeWidth: 2.5, className: "ow-color-swatch-picker__check", "aria-hidden": "true" })
|
|
8707
8742
|
},
|
|
8708
8743
|
`${item.value}-${index}`
|
|
8709
8744
|
);
|
|
8710
8745
|
}),
|
|
8711
|
-
name ? /* @__PURE__ */ (0,
|
|
8746
|
+
name ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("input", { type: "hidden", name, value: selectedIndex >= 0 ? items2[selectedIndex].value : "" }) : null
|
|
8712
8747
|
]
|
|
8713
8748
|
}
|
|
8714
8749
|
);
|