@lukeashford/aurelius 4.3.0 → 4.4.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/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1498,12 +1498,12 @@ var statusBorderClass = {
|
|
|
1498
1498
|
};
|
|
1499
1499
|
var statusHoverLabel = {
|
|
1500
1500
|
pending: null,
|
|
1501
|
-
uploading: "Uploading
|
|
1502
|
-
uploaded: "
|
|
1503
|
-
analyzing: "
|
|
1501
|
+
uploading: "Uploading",
|
|
1502
|
+
uploaded: "Analyzing",
|
|
1503
|
+
analyzing: "Analyzing",
|
|
1504
1504
|
analyzed: null,
|
|
1505
|
-
upload_failed: "Upload failed
|
|
1506
|
-
analysis_failed: "
|
|
1505
|
+
upload_failed: "Upload failed",
|
|
1506
|
+
analysis_failed: "Couldn't process this file"
|
|
1507
1507
|
};
|
|
1508
1508
|
function isErrorStatus(status) {
|
|
1509
1509
|
return status === "upload_failed" || status === "analysis_failed";
|
|
@@ -1529,7 +1529,9 @@ var FileChip = import_react16.default.forwardRef(
|
|
|
1529
1529
|
const showPreview = isImage && previewUrl;
|
|
1530
1530
|
const clickable = !!(artifactId && onOpen);
|
|
1531
1531
|
const hoverLabel = statusHoverLabel[status];
|
|
1532
|
-
const
|
|
1532
|
+
const tooltipContent = isErrorStatus(status) ? error ?? hoverLabel ?? null : hoverLabel;
|
|
1533
|
+
const [hovered, setHovered] = (0, import_react16.useState)(false);
|
|
1534
|
+
const [focused, setFocused] = (0, import_react16.useState)(false);
|
|
1533
1535
|
const showError = isErrorStatus(status);
|
|
1534
1536
|
const handleClick = () => {
|
|
1535
1537
|
if (clickable) {
|
|
@@ -1545,7 +1547,8 @@ var FileChip = import_react16.default.forwardRef(
|
|
|
1545
1547
|
onOpen(artifactId);
|
|
1546
1548
|
}
|
|
1547
1549
|
};
|
|
1548
|
-
|
|
1550
|
+
const tooltipOpen = tooltipContent !== null && (hovered || focused);
|
|
1551
|
+
const chip = /* @__PURE__ */ import_react16.default.createElement(
|
|
1549
1552
|
"div",
|
|
1550
1553
|
{
|
|
1551
1554
|
...rest,
|
|
@@ -1563,7 +1566,11 @@ var FileChip = import_react16.default.forwardRef(
|
|
|
1563
1566
|
tabIndex: clickable ? 0 : void 0,
|
|
1564
1567
|
onClick: clickable ? handleClick : void 0,
|
|
1565
1568
|
onKeyDown: clickable ? handleKeyDown : void 0,
|
|
1566
|
-
|
|
1569
|
+
onMouseEnter: () => setHovered(true),
|
|
1570
|
+
onMouseLeave: () => setHovered(false),
|
|
1571
|
+
onFocus: () => setFocused(true),
|
|
1572
|
+
onBlur: () => setFocused(false),
|
|
1573
|
+
title,
|
|
1567
1574
|
"aria-label": hoverLabel ? `${name}: ${hoverLabel}` : name
|
|
1568
1575
|
},
|
|
1569
1576
|
showPreview ? /* @__PURE__ */ import_react16.default.createElement("div", { className: "w-8 h-8 flex-shrink-0 overflow-hidden bg-slate" }, /* @__PURE__ */ import_react16.default.createElement(
|
|
@@ -1600,6 +1607,10 @@ var FileChip = import_react16.default.forwardRef(
|
|
|
1600
1607
|
/* @__PURE__ */ import_react16.default.createElement(import_lucide_react2.X, { className: "w-3.5 h-3.5" })
|
|
1601
1608
|
)
|
|
1602
1609
|
);
|
|
1610
|
+
if (tooltipContent === null) {
|
|
1611
|
+
return chip;
|
|
1612
|
+
}
|
|
1613
|
+
return /* @__PURE__ */ import_react16.default.createElement(Tooltip, { content: tooltipContent, open: tooltipOpen, side: "top" }, chip);
|
|
1603
1614
|
}
|
|
1604
1615
|
);
|
|
1605
1616
|
FileChip.displayName = "FileChip";
|