@dust-tt/sparkle 0.2.216 → 0.2.217
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/cjs/index.js +9 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +9 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/Breadcrumbs.tsx +26 -28
- package/src/stories/Breadcrumbs.stories.tsx +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -129188,12 +129188,14 @@ var ELLIPSIS_STRING = "...";
|
|
|
129188
129188
|
function Breadcrumbs(_a) {
|
|
129189
129189
|
var items = _a.items;
|
|
129190
129190
|
var components = React.useContext(SparkleContext).components;
|
|
129191
|
+
var Link = components.link;
|
|
129191
129192
|
var _b = items.reduce(function (acc, item, index) {
|
|
129192
129193
|
if (items.length <= 5 || index < 2 || index >= items.length - 2) {
|
|
129193
129194
|
acc.itemsShown.push(item);
|
|
129194
129195
|
}
|
|
129195
129196
|
else if (index === 2) {
|
|
129196
129197
|
acc.itemsShown.push({ label: ELLIPSIS_STRING });
|
|
129198
|
+
acc.itemsHidden.push(item);
|
|
129197
129199
|
}
|
|
129198
129200
|
else {
|
|
129199
129201
|
acc.itemsHidden.push(item);
|
|
@@ -129204,19 +129206,16 @@ function Breadcrumbs(_a) {
|
|
|
129204
129206
|
return (React.createElement("div", { key: "breadcrumbs-".concat(index), className: "s-flex s-flex-row s-items-center s-gap-1" },
|
|
129205
129207
|
React.createElement(Icon, { visual: item.icon, className: "s-text-brand" }),
|
|
129206
129208
|
item.label === ELLIPSIS_STRING ? (React.createElement(DropdownMenu, null,
|
|
129207
|
-
React.createElement(DropdownMenu.Button, null,
|
|
129208
|
-
|
|
129209
|
-
|
|
129210
|
-
|
|
129209
|
+
React.createElement(DropdownMenu.Button, null, ELLIPSIS_STRING),
|
|
129210
|
+
React.createElement(DropdownMenu.Items, { origin: "topLeft" }, itemsHidden.map(function (item, index) { return (React.createElement(DropdownMenu.Item, { icon: item.icon, label: item.label, href: item.href || "#", key: "breadcrumbs-hidden-".concat(index) }, truncateWithTooltip(item.label, LABEL_TRUNCATE_LENGTH_MIDDLE))); })))) : (React.createElement("div", null,
|
|
129211
|
+
React.createElement(Link, { href: item.href || "#", className: index === items.length - 1
|
|
129212
|
+
? "s-text-element-900"
|
|
129213
|
+
: "s-text-element-700" }, index === items.length - 1
|
|
129214
|
+
? truncateWithTooltip(item.label, LABEL_TRUNCATE_LENGTH_END)
|
|
129215
|
+
: truncateWithTooltip(item.label, LABEL_TRUNCATE_LENGTH_MIDDLE)))),
|
|
129211
129216
|
index === itemsShown.length - 1 ? null : (React.createElement(SvgChevronRight$1, { className: "s-text-element-500" }))));
|
|
129212
129217
|
})));
|
|
129213
129218
|
}
|
|
129214
|
-
function getLinkForItem(item, isLast, link) {
|
|
129215
|
-
var Link = item.href ? link : noHrefLink;
|
|
129216
|
-
return (React.createElement(Link, { href: item.href || "#", className: isLast ? "s-text-element-900" : "s-text-element-700" }, isLast
|
|
129217
|
-
? truncateWithTooltip(item.label, LABEL_TRUNCATE_LENGTH_END)
|
|
129218
|
-
: truncateWithTooltip(item.label, LABEL_TRUNCATE_LENGTH_MIDDLE)));
|
|
129219
|
-
}
|
|
129220
129219
|
function truncateWithTooltip(text, length) {
|
|
129221
129220
|
return text.length > length ? (React.createElement(Tooltip, { label: text, position: "below" }, "".concat(text.substring(0, length - 1), "\u2026"))) : (text);
|
|
129222
129221
|
}
|