@luscii-healthtech/web-ui 58.6.0 → 58.6.1
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 +104 -22
- 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 +37 -1
- package/dist/src/generated/components/RangeCoverage/RangeCoverage.d.ts +37 -1
- package/dist/stories/RangeCoverage.stories.d.ts +28 -1
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -6774,6 +6774,12 @@ const calculateHighlightPosition = (args) => {
|
|
|
6774
6774
|
const leftFraction = isDescending ? (start - higher) / totalRange : (lower - start) / totalRange;
|
|
6775
6775
|
return { leftFraction, widthFraction };
|
|
6776
6776
|
};
|
|
6777
|
+
const calculateTickPosition = (args) => {
|
|
6778
|
+
const { tick, start, end } = args;
|
|
6779
|
+
const totalRange = Math.abs(end - start);
|
|
6780
|
+
const isDescending = start > end;
|
|
6781
|
+
return isDescending ? (start - tick) / totalRange * 100 : (tick - start) / totalRange * 100;
|
|
6782
|
+
};
|
|
6777
6783
|
const createStripedPattern = (options) => {
|
|
6778
6784
|
const { colorA, colorB, startOffset = 0 } = options;
|
|
6779
6785
|
const STRIPE_THICKNESS = 4;
|
|
@@ -6782,7 +6788,7 @@ const createStripedPattern = (options) => {
|
|
|
6782
6788
|
};
|
|
6783
6789
|
const getSegmentStyle = (color) => {
|
|
6784
6790
|
const baseStyle = {
|
|
6785
|
-
height: "
|
|
6791
|
+
height: "24px",
|
|
6786
6792
|
boxSizing: "content-box"
|
|
6787
6793
|
};
|
|
6788
6794
|
if (isColorTuple(color)) {
|
|
@@ -6801,20 +6807,27 @@ const COLOR_GREY_DARK = "var(--ui-color-border-info-secondary-hovered)";
|
|
|
6801
6807
|
const COLOR_RED = "var(--ui-color-border-error-primary-default)";
|
|
6802
6808
|
const COLOR_AMBER = "var(--ui-color-icon-warning-secondary-default)";
|
|
6803
6809
|
const COLOR_BLUE = COLOR_GREY_LIGHT;
|
|
6804
|
-
const
|
|
6805
|
-
const
|
|
6806
|
-
const COLOR_GAP = [
|
|
6807
|
-
"var(--ui-color-background-info-secondary-hovered)",
|
|
6808
|
-
"var(--ui-color-background-info-primary-hovered)"
|
|
6809
|
-
];
|
|
6810
|
+
const BORDER_RADIUS = "var(--ui-semantic-radius-s, 4px)";
|
|
6811
|
+
const COLOR_GAP = "var(--ui-color-background-brand-secondary-default)";
|
|
6810
6812
|
const COLOR_OVERLAP = [
|
|
6811
6813
|
"var(--ui-color-background-info-secondary-hovered)",
|
|
6812
6814
|
"var(--ui-color-border-neutral-primary-default)"
|
|
6813
6815
|
];
|
|
6814
6816
|
const COLOR_FILL = "var(--ui-color-background-info-secondary-hovered)";
|
|
6817
|
+
const COLOR_ALERT_HIGH_SALMON = "var(--ui-color-icon-alerts-high-salmon)";
|
|
6818
|
+
const COLOR_ALERT_HIGH_CRIMSON = "var(--ui-color-icon-alerts-high-crimson)";
|
|
6819
|
+
const COLOR_ALERT_HIGH_RED = "var(--ui-color-icon-alerts-high-red)";
|
|
6820
|
+
const COLOR_ALERT_MEDIUM_SUN = "var(--ui-color-icon-alerts-medium-sun)";
|
|
6821
|
+
const COLOR_ALERT_MEDIUM_OAK = "var(--ui-color-icon-alerts-medium-oak)";
|
|
6822
|
+
const COLOR_ALERT_MEDIUM_AMBER = "var(--ui-color-icon-alerts-medium-amber)";
|
|
6823
|
+
const COLOR_ALERT_LOW_MINT = "var(--ui-color-icon-alerts-low-mint)";
|
|
6824
|
+
const COLOR_ALERT_LOW_LEAF = "var(--ui-color-icon-alerts-low-leaf)";
|
|
6825
|
+
const COLOR_ALERT_LOW_GREEN = "var(--ui-color-icon-alerts-low-green)";
|
|
6826
|
+
const COLOR_ALERT_NONE_FOG = "var(--ui-color-icon-alerts-neutral-fog)";
|
|
6827
|
+
const COLOR_ALERT_NONE_NEUTRAL = "var(--ui-color-icon-alerts-neutral-neutral)";
|
|
6828
|
+
const COLOR_ALERT_NONE_GRAPHITE = "var(--ui-color-icon-alerts-neutral-graphite)";
|
|
6815
6829
|
const barContainerStyle = {
|
|
6816
6830
|
width: "100%",
|
|
6817
|
-
border: `1px solid ${BORDER_COLOR}`,
|
|
6818
6831
|
borderRadius: BORDER_RADIUS,
|
|
6819
6832
|
overflow: "hidden"
|
|
6820
6833
|
};
|
|
@@ -6823,14 +6836,13 @@ const barStyle = {
|
|
|
6823
6836
|
alignItems: "center",
|
|
6824
6837
|
width: "100%",
|
|
6825
6838
|
height: "24px",
|
|
6826
|
-
|
|
6827
|
-
// 3px looks better than 4px
|
|
6839
|
+
// Must match the segments' own height so they fill the rounded container flush, with no gap.
|
|
6828
6840
|
boxSizing: "border-box"
|
|
6829
6841
|
};
|
|
6830
6842
|
const HIGHLIGHT_RING_COLOR = "var(--ui-color-border-brand-primary-selected)";
|
|
6831
6843
|
const HIGHLIGHT_RING_WIDTH = 2;
|
|
6832
6844
|
const HIGHLIGHT_RING_INSET = 4;
|
|
6833
|
-
const BAR_HORIZONTAL_PADDING =
|
|
6845
|
+
const BAR_HORIZONTAL_PADDING = 0;
|
|
6834
6846
|
const getHighlightStyle = (position) => ({
|
|
6835
6847
|
position: "absolute",
|
|
6836
6848
|
top: -HIGHLIGHT_RING_INSET,
|
|
@@ -6847,10 +6859,37 @@ const ticksContainerStyle = {
|
|
|
6847
6859
|
width: "100%",
|
|
6848
6860
|
height: "20px"
|
|
6849
6861
|
};
|
|
6862
|
+
const AXIS_LINE_COLOR = "var(--ui-color-border-neutral-secondary-default)";
|
|
6863
|
+
const TICK_MARK_HEIGHT = 8;
|
|
6864
|
+
const axisStyle = {
|
|
6865
|
+
position: "relative",
|
|
6866
|
+
width: "100%",
|
|
6867
|
+
height: `${TICK_MARK_HEIGHT}px`
|
|
6868
|
+
};
|
|
6869
|
+
const axisLineStyle = {
|
|
6870
|
+
position: "absolute",
|
|
6871
|
+
top: "50%",
|
|
6872
|
+
left: 0,
|
|
6873
|
+
right: 0,
|
|
6874
|
+
height: "1px",
|
|
6875
|
+
background: AXIS_LINE_COLOR,
|
|
6876
|
+
transform: "translateY(-50%)"
|
|
6877
|
+
};
|
|
6878
|
+
const tickMarkStyle = {
|
|
6879
|
+
position: "absolute",
|
|
6880
|
+
top: 0,
|
|
6881
|
+
bottom: 0,
|
|
6882
|
+
width: "1px",
|
|
6883
|
+
background: AXIS_LINE_COLOR,
|
|
6884
|
+
transform: "translateX(-50%)"
|
|
6885
|
+
};
|
|
6850
6886
|
const RangeCoverageComponent = (_a) => {
|
|
6851
|
-
var
|
|
6887
|
+
var _b, _c;
|
|
6888
|
+
var { sections, start, end, highlightedRange, ticks = [], tickFormatter, showEdgeTickMarks, title, legendSwatches, onSectionFocus, translations, className, slots } = _a, rest = __rest(_a, ["sections", "start", "end", "highlightedRange", "ticks", "tickFormatter", "showEdgeTickMarks", "title", "legendSwatches", "onSectionFocus", "translations", "className", "slots"]);
|
|
6852
6889
|
const { tooltipContent } = slots !== null && slots !== void 0 ? slots : {};
|
|
6853
6890
|
const idPrefix = React.useId();
|
|
6891
|
+
const showStartTickMark = (_b = showEdgeTickMarks === null || showEdgeTickMarks === void 0 ? void 0 : showEdgeTickMarks.start) !== null && _b !== void 0 ? _b : true;
|
|
6892
|
+
const showEndTickMark = (_c = showEdgeTickMarks === null || showEdgeTickMarks === void 0 ? void 0 : showEdgeTickMarks.end) !== null && _c !== void 0 ? _c : true;
|
|
6854
6893
|
if (hasSectionOverlaps(sections)) {
|
|
6855
6894
|
return jsxRuntime.jsx(Text, { variant: "strong", children: translations.sectionOverlapsMessage });
|
|
6856
6895
|
}
|
|
@@ -6867,11 +6906,19 @@ const RangeCoverageComponent = (_a) => {
|
|
|
6867
6906
|
startOffset: -6
|
|
6868
6907
|
}) : swatch.color;
|
|
6869
6908
|
return jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsx("div", { id: legendIdByLabel.get(swatch.label), role: "img", "aria-label": swatch.label, style: Object.assign(Object.assign({}, legendSwatchStyle), { background }) }), jsxRuntime.jsx(Text, { as: "span", children: swatch.label })] }, swatch.label);
|
|
6870
|
-
}) }) })] }), jsxRuntime.jsxs(Stack, { _gap: "m", width: "full", align: "stretch", children: [jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [jsxRuntime.jsx("div", { style: barContainerStyle, children: jsxRuntime.jsx("div", { style: barStyle, children: segments.map((segment) => {
|
|
6871
|
-
var _a2,
|
|
6909
|
+
}) }) })] }), jsxRuntime.jsxs(Stack, { _gap: "m", width: "full", align: "stretch", children: [jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [jsxRuntime.jsx("div", { style: barContainerStyle, children: jsxRuntime.jsx("div", { style: barStyle, children: segments.map((segment, index) => {
|
|
6910
|
+
var _a2, _b2;
|
|
6911
|
+
const isLastSegment = index === segments.length - 1;
|
|
6872
6912
|
const sectionDataWithBackground = Object.assign(Object.assign({}, segment.originalSection), { background: getSegmentStyle(segment.color).background });
|
|
6873
6913
|
const renderedTooltipContent = (_a2 = tooltipContent === null || tooltipContent === void 0 ? void 0 : tooltipContent.render) === null || _a2 === void 0 ? void 0 : _a2.call(tooltipContent, sectionDataWithBackground);
|
|
6874
|
-
const segmentStyle = Object.assign({
|
|
6914
|
+
const segmentStyle = Object.assign({
|
|
6915
|
+
// Subtract the gap from the width, except for the last segment,
|
|
6916
|
+
// which has no following gap and should reach the container's edge.
|
|
6917
|
+
flexBasis: isLastSegment ? `${segment.widthPercent}%` : `calc(${segment.widthPercent}% - 1px)`,
|
|
6918
|
+
flexGrow: 0,
|
|
6919
|
+
flexShrink: 0,
|
|
6920
|
+
marginRight: isLastSegment ? 0 : "1px"
|
|
6921
|
+
}, getSegmentStyle(segment.color));
|
|
6875
6922
|
const ariaLabel = `${segment.originalSection.from} - ${segment.originalSection.to}`;
|
|
6876
6923
|
const legendId = segment.originalSection.legendLabel ? legendIdByLabel.get(segment.originalSection.legendLabel) : void 0;
|
|
6877
6924
|
if (!renderedTooltipContent && !onSectionFocus) {
|
|
@@ -6890,7 +6937,7 @@ const RangeCoverageComponent = (_a) => {
|
|
|
6890
6937
|
}
|
|
6891
6938
|
return (
|
|
6892
6939
|
// Sections cannot overlap, so from-to should be unique
|
|
6893
|
-
jsxRuntime.jsxs(Tooltip.Root, { delayDuration: (
|
|
6940
|
+
jsxRuntime.jsxs(Tooltip.Root, { delayDuration: (_b2 = tooltipContent === null || tooltipContent === void 0 ? void 0 : tooltipContent.delayDuration) !== null && _b2 !== void 0 ? _b2 : 100, children: [jsxRuntime.jsx(Tooltip.Trigger, { asChild: true, children: jsxRuntime.jsx("button", { "aria-label": ariaLabel, "aria-describedby": legendId, style: segmentStyle, onFocus: () => {
|
|
6894
6941
|
onSectionFocus === null || onSectionFocus === void 0 ? void 0 : onSectionFocus(sectionDataWithBackground);
|
|
6895
6942
|
}, onBlur: () => {
|
|
6896
6943
|
onSectionFocus === null || onSectionFocus === void 0 ? void 0 : onSectionFocus(null);
|
|
@@ -6903,10 +6950,19 @@ const RangeCoverageComponent = (_a) => {
|
|
|
6903
6950
|
maxWidth: 600
|
|
6904
6951
|
}, children: jsxRuntime.jsx(Card, { border: true, elevation: "medium", width: "full", children: renderedTooltipContent }) })] }, ariaLabel)
|
|
6905
6952
|
);
|
|
6906
|
-
}) }) }), highlightPosition && highlightedRange && jsxRuntime.jsx("div", { role: "img", "aria-label": highlightedRange.label ? `${highlightedRange.label} (${highlightedRange.from} - ${highlightedRange.to})` : `${highlightedRange.from} - ${highlightedRange.to}`, style: getHighlightStyle(highlightPosition) })] }), ticks.length > 0 && jsxRuntime.
|
|
6907
|
-
const
|
|
6908
|
-
const
|
|
6909
|
-
|
|
6953
|
+
}) }) }), highlightPosition && highlightedRange && jsxRuntime.jsx("div", { role: "img", "aria-label": highlightedRange.label ? `${highlightedRange.label} (${highlightedRange.from} - ${highlightedRange.to})` : `${highlightedRange.from} - ${highlightedRange.to}`, style: getHighlightStyle(highlightPosition) })] }), ticks.length > 0 && jsxRuntime.jsxs(Stack, { _gap: "xs", width: "full", align: "stretch", children: [jsxRuntime.jsxs("div", { style: axisStyle, children: [jsxRuntime.jsx("div", { style: axisLineStyle }), ticks.map((tick, index) => {
|
|
6954
|
+
const isFirst = index === 0;
|
|
6955
|
+
const isLast = index === ticks.length - 1;
|
|
6956
|
+
if (isFirst && !showStartTickMark) {
|
|
6957
|
+
return null;
|
|
6958
|
+
}
|
|
6959
|
+
if (isLast && !showEndTickMark) {
|
|
6960
|
+
return null;
|
|
6961
|
+
}
|
|
6962
|
+
const position = calculateTickPosition({ tick, start, end });
|
|
6963
|
+
return jsxRuntime.jsx("div", { "aria-hidden": "true", style: Object.assign(Object.assign({}, tickMarkStyle), { left: `${position}%` }) }, tick);
|
|
6964
|
+
})] }), jsxRuntime.jsx("div", { style: ticksContainerStyle, children: ticks.map((tick, index) => {
|
|
6965
|
+
const position = calculateTickPosition({ tick, start, end });
|
|
6910
6966
|
const isFirst = index === 0;
|
|
6911
6967
|
const isLast = index === ticks.length - 1;
|
|
6912
6968
|
const content = tickFormatter ? tickFormatter(tick) : tick;
|
|
@@ -6917,7 +6973,7 @@ const RangeCoverageComponent = (_a) => {
|
|
|
6917
6973
|
left: `${position}%`,
|
|
6918
6974
|
transform: isFirst ? "translateX(0%)" : isLast ? "translateX(-100%)" : "translateX(-50%)"
|
|
6919
6975
|
}, children: content }, tick);
|
|
6920
|
-
}) })] })] }) }));
|
|
6976
|
+
}) })] })] })] }) }));
|
|
6921
6977
|
};
|
|
6922
6978
|
const RangeCoverage = Object.assign(RangeCoverageComponent, {
|
|
6923
6979
|
Colors: {
|
|
@@ -6928,7 +6984,33 @@ const RangeCoverage = Object.assign(RangeCoverageComponent, {
|
|
|
6928
6984
|
BLUE: COLOR_BLUE,
|
|
6929
6985
|
FILL: COLOR_FILL,
|
|
6930
6986
|
GAP: COLOR_GAP,
|
|
6931
|
-
OVERLAP: COLOR_OVERLAP
|
|
6987
|
+
OVERLAP: COLOR_OVERLAP,
|
|
6988
|
+
ALERT: {
|
|
6989
|
+
HIGH: {
|
|
6990
|
+
DEFAULT: COLOR_ALERT_HIGH_SALMON,
|
|
6991
|
+
SALMON: COLOR_ALERT_HIGH_SALMON,
|
|
6992
|
+
CRIMSON: COLOR_ALERT_HIGH_CRIMSON,
|
|
6993
|
+
RED: COLOR_ALERT_HIGH_RED
|
|
6994
|
+
},
|
|
6995
|
+
MEDIUM: {
|
|
6996
|
+
DEFAULT: COLOR_ALERT_MEDIUM_SUN,
|
|
6997
|
+
SUN: COLOR_ALERT_MEDIUM_SUN,
|
|
6998
|
+
OAK: COLOR_ALERT_MEDIUM_OAK,
|
|
6999
|
+
AMBER: COLOR_ALERT_MEDIUM_AMBER
|
|
7000
|
+
},
|
|
7001
|
+
LOW: {
|
|
7002
|
+
DEFAULT: COLOR_ALERT_LOW_MINT,
|
|
7003
|
+
MINT: COLOR_ALERT_LOW_MINT,
|
|
7004
|
+
LEAF: COLOR_ALERT_LOW_LEAF,
|
|
7005
|
+
GREEN: COLOR_ALERT_LOW_GREEN
|
|
7006
|
+
},
|
|
7007
|
+
NONE: {
|
|
7008
|
+
DEFAULT: COLOR_ALERT_NONE_FOG,
|
|
7009
|
+
FOG: COLOR_ALERT_NONE_FOG,
|
|
7010
|
+
NEUTRAL: COLOR_ALERT_NONE_NEUTRAL,
|
|
7011
|
+
GRAPHITE: COLOR_ALERT_NONE_GRAPHITE
|
|
7012
|
+
}
|
|
7013
|
+
}
|
|
6932
7014
|
},
|
|
6933
7015
|
useAdaptiveTicks
|
|
6934
7016
|
});
|