@luscii-healthtech/web-ui 46.2.3 → 46.2.4
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.development.js +68 -47
- package/dist/index.development.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/components/RangeCoverage/RangeCoverage.d.ts +12 -2
- package/dist/src/components/Tooltip/Tooltip.d.ts +2 -0
- package/dist/src/generated/components/RangeCoverage/RangeCoverage.d.ts +12 -2
- package/dist/src/generated/components/Tooltip/Tooltip.d.ts +2 -0
- package/dist/stories/RangeCoverage.stories.d.ts +2 -0
- package/dist/web-ui-tailwind.css +6 -0
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1798,8 +1798,24 @@ const SearchInput = React__namespace.default.forwardRef((props, ref) => {
|
|
|
1798
1798
|
});
|
|
1799
1799
|
|
|
1800
1800
|
const Content$2 = (_a) => {
|
|
1801
|
-
var { container, children, className } = _a, contentProps = __rest(_a, ["container", "children", "className"]);
|
|
1802
|
-
|
|
1801
|
+
var { container, children, className, backgroundColor } = _a, contentProps = __rest(_a, ["container", "children", "className", "backgroundColor"]);
|
|
1802
|
+
const getBackgroundColor = () => {
|
|
1803
|
+
switch (backgroundColor) {
|
|
1804
|
+
case "transparent":
|
|
1805
|
+
return void 0;
|
|
1806
|
+
default:
|
|
1807
|
+
return backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : "secondary-background";
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1810
|
+
const getArrowBackgroundColor = () => {
|
|
1811
|
+
switch (backgroundColor) {
|
|
1812
|
+
case "transparent":
|
|
1813
|
+
return "ui:fill-transparent";
|
|
1814
|
+
default:
|
|
1815
|
+
return "ui:fill-secondary-background";
|
|
1816
|
+
}
|
|
1817
|
+
};
|
|
1818
|
+
return jsxRuntime.jsx(Tooltip__namespace.Portal, { container, children: jsxRuntime.jsxs(Tooltip__namespace.Content, Object.assign({ className: classNames__default.default(className, "ui:max-w-55", "ui:z-20", "ui:data-[state=delayed-open]:animate-in ui:data-[state=closed]:animate-out ui:data-[state=closed]:fade-out-0 ui:data-[state=delayed-open]:fade-in-0 ui:data-[state=closed]:zoom-out-95 ui:data-[state=delayed-open]:zoom-in-95 ui:data-[side=bottom]:slide-in-from-top-2 ui:data-[side=left]:slide-in-from-right-2 ui:data-[side=right]:slide-in-from-left-2 ui:data-[side=top]:slide-in-from-bottom-2"), sideOffset: 4 }, contentProps, { children: [jsxRuntime.jsx(Box, { backgroundColor: getBackgroundColor(), px: "m", py: "xs", borderRadius: "xxxxs", children }), jsxRuntime.jsx(Tooltip__namespace.Arrow, { width: 8, height: 8, className: getArrowBackgroundColor() })] })) });
|
|
1803
1819
|
};
|
|
1804
1820
|
Content$2.displayName = "Tooltip.Content";
|
|
1805
1821
|
const Root$1 = (props) => jsxRuntime.jsx(Tooltip__namespace.Root, Object.assign({}, props));
|
|
@@ -6288,49 +6304,14 @@ const generateIntermediateTicks = (args) => {
|
|
|
6288
6304
|
}
|
|
6289
6305
|
return Array.from(tickSet).sort((a, b) => isDescending ? b - a : a - b);
|
|
6290
6306
|
};
|
|
6291
|
-
const
|
|
6292
|
-
const
|
|
6293
|
-
const bIsStriped = isColorTuple(colorB);
|
|
6294
|
-
if (aIsStriped !== bIsStriped) {
|
|
6295
|
-
return false;
|
|
6296
|
-
}
|
|
6297
|
-
if (aIsStriped && bIsStriped) {
|
|
6298
|
-
return colorA[0] === colorB[0] && colorA[1] === colorB[1];
|
|
6299
|
-
}
|
|
6300
|
-
return colorA === colorB;
|
|
6301
|
-
};
|
|
6302
|
-
const mergeAdjacentSections = (sections) => {
|
|
6303
|
-
if (sections.length === 0) {
|
|
6304
|
-
return [];
|
|
6305
|
-
}
|
|
6306
|
-
const sorted = [...sections].sort((a, b) => {
|
|
6307
|
-
const aStart = Math.min(a.from, a.to);
|
|
6308
|
-
const bStart = Math.min(b.from, b.to);
|
|
6309
|
-
return aStart - bStart;
|
|
6310
|
-
});
|
|
6311
|
-
const merged = [Object.assign({}, sorted[0])];
|
|
6312
|
-
for (let i = 1; i < sorted.length; i++) {
|
|
6313
|
-
const current = sorted[i];
|
|
6314
|
-
const previous = merged[merged.length - 1];
|
|
6315
|
-
const prevEnd = Math.max(previous.from, previous.to);
|
|
6316
|
-
const currentStart = Math.min(current.from, current.to);
|
|
6317
|
-
const currentEnd = Math.max(current.from, current.to);
|
|
6318
|
-
if (prevEnd === currentStart && colorsAreEqual(previous.color, current.color)) {
|
|
6319
|
-
previous.to = currentEnd;
|
|
6320
|
-
} else {
|
|
6321
|
-
merged.push(Object.assign({}, current));
|
|
6322
|
-
}
|
|
6323
|
-
}
|
|
6324
|
-
return merged;
|
|
6325
|
-
};
|
|
6326
|
-
const calculateSegments = (sections, start, end) => {
|
|
6307
|
+
const calculateSegments = (args) => {
|
|
6308
|
+
const { sections, start, end } = args;
|
|
6327
6309
|
const isDescending = start > end;
|
|
6328
6310
|
const rangeMin = Math.min(start, end);
|
|
6329
6311
|
const rangeMax = Math.max(start, end);
|
|
6330
6312
|
const totalRange = Math.abs(end - start);
|
|
6331
6313
|
const segments = [];
|
|
6332
|
-
const
|
|
6333
|
-
const normalizedSections = mergedSections.map((section) => {
|
|
6314
|
+
const normalizedSections = sections.map((section) => {
|
|
6334
6315
|
const clampedFrom = Math.max(rangeMin, Math.min(rangeMax, section.from));
|
|
6335
6316
|
const clampedTo = Math.max(rangeMin, Math.min(rangeMax, section.to));
|
|
6336
6317
|
const higher = Math.max(clampedFrom, clampedTo);
|
|
@@ -6340,7 +6321,8 @@ const calculateSegments = (sections, start, end) => {
|
|
|
6340
6321
|
return {
|
|
6341
6322
|
startPos,
|
|
6342
6323
|
width,
|
|
6343
|
-
color: section.color
|
|
6324
|
+
color: section.color,
|
|
6325
|
+
originalSection: section
|
|
6344
6326
|
};
|
|
6345
6327
|
}).filter((s) => s.width > 0).sort((a, b) => a.startPos - b.startPos);
|
|
6346
6328
|
let currentPos = 0;
|
|
@@ -6348,19 +6330,26 @@ const calculateSegments = (sections, start, end) => {
|
|
|
6348
6330
|
if (section.startPos > currentPos) {
|
|
6349
6331
|
segments.push({
|
|
6350
6332
|
widthPercent: section.startPos - currentPos,
|
|
6351
|
-
color: "transparent"
|
|
6333
|
+
color: "transparent",
|
|
6334
|
+
originalSection: section.originalSection
|
|
6352
6335
|
});
|
|
6353
6336
|
}
|
|
6354
6337
|
segments.push({
|
|
6355
6338
|
widthPercent: section.width,
|
|
6356
|
-
color: section.color
|
|
6339
|
+
color: section.color,
|
|
6340
|
+
originalSection: section.originalSection
|
|
6357
6341
|
});
|
|
6358
6342
|
currentPos = section.startPos + section.width;
|
|
6359
6343
|
}
|
|
6360
6344
|
if (currentPos < 100) {
|
|
6361
6345
|
segments.push({
|
|
6362
6346
|
widthPercent: 100 - currentPos,
|
|
6363
|
-
color: "transparent"
|
|
6347
|
+
color: "transparent",
|
|
6348
|
+
originalSection: {
|
|
6349
|
+
from: end,
|
|
6350
|
+
to: end,
|
|
6351
|
+
color: "transparent"
|
|
6352
|
+
}
|
|
6364
6353
|
});
|
|
6365
6354
|
}
|
|
6366
6355
|
return segments;
|
|
@@ -6424,11 +6413,11 @@ const ticksContainerStyle = {
|
|
|
6424
6413
|
height: "20px"
|
|
6425
6414
|
};
|
|
6426
6415
|
const RangeCoverageComponent = (_a) => {
|
|
6427
|
-
var { sections, start, end, ticks = [], tickFormatter, title, legendSwatches, translations, className } = _a, rest = __rest(_a, ["sections", "start", "end", "ticks", "tickFormatter", "title", "legendSwatches", "translations", "className"]);
|
|
6416
|
+
var { sections, start, end, ticks = [], tickFormatter, title, legendSwatches, onSectionFocus, translations, className, slots } = _a, rest = __rest(_a, ["sections", "start", "end", "ticks", "tickFormatter", "title", "legendSwatches", "onSectionFocus", "translations", "className", "slots"]);
|
|
6428
6417
|
if (hasSectionOverlaps(sections)) {
|
|
6429
6418
|
return jsxRuntime.jsx(Text, { variant: "strong", children: translations.sectionOverlapsMessage });
|
|
6430
6419
|
}
|
|
6431
|
-
const segments = calculateSegments(sections, start, end);
|
|
6420
|
+
const segments = calculateSegments({ sections, start, end });
|
|
6432
6421
|
return jsxRuntime.jsx(Box, Object.assign({ className }, rest, { children: jsxRuntime.jsxs(Stack, { gap: "xs", width: "full", align: "stretch", children: [jsxRuntime.jsxs(Stack, { justify: "between", axis: "x", align: "center", children: [jsxRuntime.jsx(Title, { variant: "xs", level: "3", children: title }), legendSwatches && (legendSwatches === null || legendSwatches === void 0 ? void 0 : legendSwatches.length) > 0 && jsxRuntime.jsx(Stack, { axis: "x", gap: "m", children: jsxRuntime.jsx(Stack, { axis: "x", gap: "xxs", align: "center", children: legendSwatches === null || legendSwatches === void 0 ? void 0 : legendSwatches.map((swatch) => {
|
|
6433
6422
|
const background = isColorTuple(swatch.color) ? createStripedPattern({
|
|
6434
6423
|
colorA: swatch.color[0],
|
|
@@ -6436,7 +6425,39 @@ const RangeCoverageComponent = (_a) => {
|
|
|
6436
6425
|
startOffset: -6
|
|
6437
6426
|
}) : swatch.color;
|
|
6438
6427
|
return jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx("div", { style: Object.assign(Object.assign({}, legendSwatchStyle), { background }) }), jsxRuntime.jsx(Text, { as: "span", children: swatch.label })] }, swatch.label);
|
|
6439
|
-
}) }) })] }), jsxRuntime.jsxs(Stack, { gap: "xs", width: "full", align: "stretch", children: [jsxRuntime.jsx("div", { style: barContainerStyle, children: jsxRuntime.jsx("div", { style: barStyle, children: segments.map((segment
|
|
6428
|
+
}) }) })] }), jsxRuntime.jsxs(Stack, { gap: "xs", width: "full", align: "stretch", children: [jsxRuntime.jsx("div", { style: barContainerStyle, children: jsxRuntime.jsx("div", { style: barStyle, children: segments.map((segment) => {
|
|
6429
|
+
var _a2;
|
|
6430
|
+
const sectionDataWithBackground = Object.assign(Object.assign({}, segment.originalSection), { background: getSegmentStyle(segment.color).background });
|
|
6431
|
+
const renderedTooltipContent = (_a2 = slots === null || slots === void 0 ? void 0 : slots.renderTooltipContent) === null || _a2 === void 0 ? void 0 : _a2.call(slots, sectionDataWithBackground);
|
|
6432
|
+
const segmentStyle = Object.assign({ flexBasis: `calc(${segment.widthPercent}% - 1px)`, flexGrow: 0, flexShrink: 0, marginRight: "1px" }, getSegmentStyle(segment.color));
|
|
6433
|
+
const ariaLabel = `${segment.originalSection.from} - ${segment.originalSection.to}`;
|
|
6434
|
+
if (!renderedTooltipContent && !onSectionFocus) {
|
|
6435
|
+
return jsxRuntime.jsx("div", { style: segmentStyle, "aria-label": ariaLabel }, ariaLabel);
|
|
6436
|
+
}
|
|
6437
|
+
if (!renderedTooltipContent) {
|
|
6438
|
+
return jsxRuntime.jsx("button", { style: segmentStyle, "aria-label": ariaLabel, onFocus: () => {
|
|
6439
|
+
onSectionFocus === null || onSectionFocus === void 0 ? void 0 : onSectionFocus(sectionDataWithBackground);
|
|
6440
|
+
}, onBlur: () => {
|
|
6441
|
+
onSectionFocus === null || onSectionFocus === void 0 ? void 0 : onSectionFocus(null);
|
|
6442
|
+
}, onMouseEnter: () => {
|
|
6443
|
+
onSectionFocus === null || onSectionFocus === void 0 ? void 0 : onSectionFocus(sectionDataWithBackground);
|
|
6444
|
+
}, onMouseLeave: () => {
|
|
6445
|
+
onSectionFocus === null || onSectionFocus === void 0 ? void 0 : onSectionFocus(null);
|
|
6446
|
+
} }, ariaLabel);
|
|
6447
|
+
}
|
|
6448
|
+
return (
|
|
6449
|
+
// Sections cannot overlap, so from-to should be unique
|
|
6450
|
+
jsxRuntime.jsxs(Tooltip.Root, { children: [jsxRuntime.jsx(Tooltip.Trigger, { asChild: true, children: jsxRuntime.jsx("button", { "aria-label": ariaLabel, style: segmentStyle, onFocus: () => {
|
|
6451
|
+
onSectionFocus === null || onSectionFocus === void 0 ? void 0 : onSectionFocus(sectionDataWithBackground);
|
|
6452
|
+
}, onBlur: () => {
|
|
6453
|
+
onSectionFocus === null || onSectionFocus === void 0 ? void 0 : onSectionFocus(null);
|
|
6454
|
+
}, onMouseEnter: () => {
|
|
6455
|
+
onSectionFocus === null || onSectionFocus === void 0 ? void 0 : onSectionFocus(sectionDataWithBackground);
|
|
6456
|
+
}, onMouseLeave: () => {
|
|
6457
|
+
onSectionFocus === null || onSectionFocus === void 0 ? void 0 : onSectionFocus(null);
|
|
6458
|
+
} }) }), jsxRuntime.jsx(Tooltip.Content, { backgroundColor: "transparent", side: "bottom", sideOffset: 16, children: jsxRuntime.jsx(Card, { border: true, elevation: "medium", children: renderedTooltipContent }) })] }, ariaLabel)
|
|
6459
|
+
);
|
|
6460
|
+
}) }) }), ticks.length > 0 && jsxRuntime.jsx("div", { style: ticksContainerStyle, children: ticks.map((tick, index) => {
|
|
6440
6461
|
const totalRange = Math.abs(end - start);
|
|
6441
6462
|
const isDescending = start > end;
|
|
6442
6463
|
const position = isDescending ? (start - tick) / totalRange * 100 : (tick - start) / totalRange * 100;
|