@luscii-healthtech/web-ui 58.5.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.
@@ -2556,8 +2556,22 @@ const LabelText = (props) => {
2556
2556
  };
2557
2557
 
2558
2558
  const StyledCheckbox = React__namespace.default.forwardRef((props, ref) => {
2559
- const { className } = props, attributes = __rest(props, ["className"]);
2560
- return jsxRuntime.jsx("input", Object.assign({ ref, type: "checkbox" }, attributes, { className: classNames__default.default(
2559
+ const { className, indeterminate } = props, attributes = __rest(props, ["className", "indeterminate"]);
2560
+ const inputRef = React__namespace.default.useRef(null);
2561
+ const setRefs = React__namespace.default.useCallback((node) => {
2562
+ inputRef.current = node;
2563
+ if (typeof ref === "function") {
2564
+ ref(node);
2565
+ } else if (ref) {
2566
+ ref.current = node;
2567
+ }
2568
+ }, [ref]);
2569
+ React__namespace.default.useEffect(() => {
2570
+ if (inputRef.current) {
2571
+ inputRef.current.indeterminate = !!indeterminate;
2572
+ }
2573
+ });
2574
+ return jsxRuntime.jsx("input", Object.assign({ ref: setRefs }, attributes, { type: "checkbox", className: classNames__default.default(
2561
2575
  "ui:block ui:appearance-none ui:w-6 ui:h-6 ui:rounded",
2562
2576
  "ui:cursor-pointer ui:disabled:cursor-not-allowed",
2563
2577
  // Default styles
@@ -2566,15 +2580,21 @@ const StyledCheckbox = React__namespace.default.forwardRef((props, ref) => {
2566
2580
  "ui:hover:border-border-neutral-primary-hovered",
2567
2581
  // Checked styles
2568
2582
  "ui:checked:bg-icon-brand-primary-default ui:checked:border-border-brand-primary-default ui:checked:before:scale-[1]",
2583
+ // Indeterminate styles
2584
+ "ui:indeterminate:bg-icon-brand-primary-default ui:indeterminate:border-border-brand-primary-default ui:indeterminate:before:scale-[1]",
2569
2585
  // Disabled styles
2570
2586
  "ui:disabled:border-border-neutral-primary-disabled",
2571
2587
  // Disabled and checked styles
2572
2588
  "ui:disabled:checked:bg-icon-brand-primary-disabled",
2589
+ // Disabled and indeterminate styles
2590
+ "ui:disabled:indeterminate:bg-icon-brand-primary-disabled",
2573
2591
  // Checked and hovered styles
2574
2592
  "ui:checked:hover:bg-icon-brand-primary-hover",
2593
+ // Indeterminate and hovered styles
2594
+ "ui:indeterminate:hover:bg-icon-brand-primary-hover",
2575
2595
  "ui:transition-colors ui:duration-150 ui:ease-in-out",
2576
2596
  "ui:before:content-[''] ui:before:block ui:before:w-full ui:before:h-full",
2577
- "ui:before:bg-[url('data:image/svg+xml;utf8,%3Csvg%20width%3D%2214%22%20height%3D%2211%22%20viewBox%3D%220%200%2014%2011%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M13.0421%200.43918C13.3233%200.720471%2013.4812%201.10193%2013.4812%201.49968C13.4812%201.89743%2013.3233%202.27889%2013.0421%202.56018L5.54207%2010.0602C5.26078%2010.3414%204.87931%2010.4994%204.48157%2010.4994C4.08382%2010.4994%203.70236%2010.3414%203.42107%2010.0602L0.421068%207.06018C0.147831%206.77728%20-0.00336092%206.39837%205.6704e-05%206.00508C0.00347433%205.61178%200.161228%205.23556%200.43934%204.95745C0.717452%204.67934%201.09367%204.52159%201.48697%204.51817C1.88026%204.51475%202.25916%204.66594%202.54207%204.93918L4.48157%206.87868L10.9211%200.43918C11.2024%200.157973%2011.5838%200%2011.9816%200C12.3793%200%2012.7608%200.157973%2013.0421%200.43918Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E')] ui:before:bg-center ui:before:bg-no-repeat",
2597
+ "ui:not-indeterminate:before:bg-[url('data:image/svg+xml;utf8,%3Csvg%20width%3D%2214%22%20height%3D%2211%22%20viewBox%3D%220%200%2014%2011%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M13.0421%200.43918C13.3233%200.720471%2013.4812%201.10193%2013.4812%201.49968C13.4812%201.89743%2013.3233%202.27889%2013.0421%202.56018L5.54207%2010.0602C5.26078%2010.3414%204.87931%2010.4994%204.48157%2010.4994C4.08382%2010.4994%203.70236%2010.3414%203.42107%2010.0602L0.421068%207.06018C0.147831%206.77728%20-0.00336092%206.39837%205.6704e-05%206.00508C0.00347433%205.61178%200.161228%205.23556%200.43934%204.95745C0.717452%204.67934%201.09367%204.52159%201.48697%204.51817C1.88026%204.51475%202.25916%204.66594%202.54207%204.93918L4.48157%206.87868L10.9211%200.43918C11.2024%200.157973%2011.5838%200%2011.9816%200C12.3793%200%2012.7608%200.157973%2013.0421%200.43918Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E')] ui:indeterminate:before:bg-[url('data:image/svg+xml;utf8,%3Csvg%20width%3D%2210%22%20height%3D%222%22%20viewBox%3D%220%200%2010%202%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M9%20-4.37114e-08C9.55228%20-1.95703e-08%2010%200.447715%2010%201C10%201.55228%209.55228%202%209%202L1%202C0.447716%202%20-6.78525e-08%201.55228%20-4.37114e-08%201C-1.95703e-08%200.447715%200.447715%20-4.17544e-07%201%20-3.93402e-07L9%20-4.37114e-08Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E')] ui:before:bg-center ui:before:bg-no-repeat",
2578
2598
  "ui:before:scale-[0] ui:before:transition-[scale] ui:before:duration-200 ui:before:ease-[cubic-bezier(.17,.67,.16,1.5)]",
2579
2599
  className
2580
2600
  ) }));
@@ -3864,46 +3884,25 @@ var CheckboxState;
3864
3884
  })(CheckboxState || (CheckboxState = {}));
3865
3885
 
3866
3886
  const CheckboxGroup = ({ title, items, onChange, onStateChange, className, isCollapsed = true, collapsible = true }) => {
3867
- const [groupCheckboxState, setGroupCheckboxState] = React.useState(CheckboxState.UNCHECKED);
3887
+ const groupCheckboxId = React__namespace.default.useId();
3868
3888
  const [collapsed, setCollapsed] = React.useState(collapsible ? isCollapsed : false);
3869
- const [isDisabled, setIsDisabled] = React.useState(false);
3870
- React.useEffect(() => {
3871
- if (items.length === 0) {
3872
- return;
3873
- }
3874
- const enabledItems = items.filter((item) => !item.isDisabled);
3875
- const allItemsChecked = items.every((item) => item.isChecked);
3876
- if (enabledItems.length === 0) {
3877
- setGroupCheckboxState(allItemsChecked ? CheckboxState.CHECKED : CheckboxState.UNCHECKED);
3878
- setIsDisabled(true);
3879
- return;
3880
- }
3881
- const indeterminate = enabledItems.some((item) => item.isChecked !== enabledItems[0].isChecked);
3882
- if (indeterminate) {
3883
- setGroupCheckboxState(CheckboxState.INDETERMINATE);
3884
- return;
3885
- }
3886
- if (enabledItems[0].isChecked) {
3887
- setGroupCheckboxState(CheckboxState.CHECKED);
3888
- } else if (!enabledItems[0].isChecked) {
3889
- setGroupCheckboxState(CheckboxState.UNCHECKED);
3890
- }
3891
- setIsDisabled(!enabledItems.some((item) => !item.isDisabled));
3892
- }, [items]);
3889
+ const enabledItems = items.filter((item) => !item.isDisabled);
3890
+ const isDisabled = items.length > 0 && enabledItems.length === 0;
3891
+ const groupCheckboxState = getGroupCheckboxState({ items, enabledItems });
3893
3892
  const handleGroupClick = (event) => {
3894
3893
  event.stopPropagation();
3895
- const enabledItems = [];
3894
+ const itemsToChange = [];
3896
3895
  const newState = [];
3897
3896
  items.forEach((item) => {
3898
3897
  if (item.isDisabled) {
3899
3898
  newState.push(item);
3900
3899
  return;
3901
3900
  }
3902
- enabledItems.push(item);
3901
+ itemsToChange.push(item);
3903
3902
  newState.push(Object.assign(Object.assign({}, item), { isChecked: event.currentTarget.checked }));
3904
3903
  });
3905
3904
  const newCheckedValue = event.currentTarget.checked;
3906
- enabledItems.forEach((item) => onChange === null || onChange === void 0 ? void 0 : onChange({ id: item.id, newCheckedValue }));
3905
+ itemsToChange.forEach((item) => onChange === null || onChange === void 0 ? void 0 : onChange({ id: item.id, newCheckedValue }));
3907
3906
  onStateChange === null || onStateChange === void 0 ? void 0 : onStateChange(newState);
3908
3907
  };
3909
3908
  const handleGroupCollapse = (event) => {
@@ -3913,6 +3912,7 @@ const CheckboxGroup = ({ title, items, onChange, onStateChange, className, isCol
3913
3912
  }
3914
3913
  };
3915
3914
  const handleCheckboxChange = (e) => {
3915
+ e.stopPropagation();
3916
3916
  onChange === null || onChange === void 0 ? void 0 : onChange({
3917
3917
  id: e.target.id,
3918
3918
  newCheckedValue: e.target.checked
@@ -3926,14 +3926,31 @@ const CheckboxGroup = ({ title, items, onChange, onStateChange, className, isCol
3926
3926
  };
3927
3927
  const checkedItemsCount = items === null || items === void 0 ? void 0 : items.filter((item) => item === null || item === void 0 ? void 0 : item.isChecked).length;
3928
3928
  const groupTitle = checkedItemsCount > 0 ? `${title} (${checkedItemsCount})` : title;
3929
- return jsxRuntime.jsxs("div", { className: classNames__default.default("ui:flex ui:flex-col", className), children: [title && jsxRuntime.jsxs("div", { className: "ui:flex ui:w-full ui:flex-row ui:items-center", children: [jsxRuntime.jsx(Checkbox, { renderLabel: () => jsxRuntime.jsx(Text, { variant: "strong", children: groupTitle }), onChange: handleGroupClick, isChecked: groupCheckboxState === CheckboxState.CHECKED, isDisabled, isIndeterminate: groupCheckboxState === CheckboxState.INDETERMINATE, className: "ui:flex-1 ui:py-3" }, title), collapsible && jsxRuntime.jsx(GroupCollapseButton, { "aria-label": getGroupCollapseButtonAriaLabel({
3929
+ return jsxRuntime.jsxs("div", { className: classNames__default.default("ui:flex ui:flex-col", className), children: [title && jsxRuntime.jsxs("div", { className: "ui:flex ui:w-full ui:flex-row ui:items-center", children: [jsxRuntime.jsx(LabeledCheckbox, { id: groupCheckboxId, onChange: handleGroupClick, checked: groupCheckboxState === CheckboxState.CHECKED, indeterminate: groupCheckboxState === CheckboxState.INDETERMINATE, disabled: isDisabled, className: "ui:flex-1 ui:py-3", children: jsxRuntime.jsx(Text, { as: "span", variant: "strong", children: groupTitle }) }), collapsible && jsxRuntime.jsx(GroupCollapseButton, { "aria-label": getGroupCollapseButtonAriaLabel({
3930
3930
  groupTitle: title,
3931
3931
  collapsed
3932
- }), collapsed, type: "button", onClick: handleGroupCollapse })] }), !collapsed && items.map((item) => React.createElement(Checkbox, Object.assign({}, item, { key: item.id, text: item.label, onChange: handleCheckboxChange, className: classNames__default.default("ui:py-3", {
3933
- "ui:ml-10": collapsible,
3934
- "ui:ml-5": !collapsible
3935
- }) })))] });
3932
+ }), collapsed, type: "button", onClick: handleGroupCollapse })] }), !collapsed && items.map((item) => {
3933
+ var _a;
3934
+ return jsxRuntime.jsx(LabeledCheckbox, { id: item.id, name: item.name, value: item.value, label: item.label, helperText: item.explanation, checked: (_a = item.isChecked) !== null && _a !== void 0 ? _a : false, disabled: item.isDisabled, onChange: handleCheckboxChange, className: classNames__default.default("ui:py-3", {
3935
+ "ui:ml-10": collapsible,
3936
+ "ui:ml-5": !collapsible
3937
+ }, item.className) }, item.id);
3938
+ })] });
3936
3939
  };
3940
+ function getGroupCheckboxState(args) {
3941
+ const { items, enabledItems } = args;
3942
+ if (items.length === 0) {
3943
+ return CheckboxState.UNCHECKED;
3944
+ }
3945
+ if (enabledItems.length === 0) {
3946
+ return items.every((item) => item.isChecked) ? CheckboxState.CHECKED : CheckboxState.UNCHECKED;
3947
+ }
3948
+ const isIndeterminate = enabledItems.some((item) => item.isChecked !== enabledItems[0].isChecked);
3949
+ if (isIndeterminate) {
3950
+ return CheckboxState.INDETERMINATE;
3951
+ }
3952
+ return enabledItems[0].isChecked ? CheckboxState.CHECKED : CheckboxState.UNCHECKED;
3953
+ }
3937
3954
  function getGroupCollapseButtonAriaLabel(args) {
3938
3955
  const { groupTitle, collapsed } = args;
3939
3956
  const localizedActionLabel = collapsed ? "Expand" : "Collapse";
@@ -3956,6 +3973,7 @@ function GroupCollapseButton(props) {
3956
3973
 
3957
3974
  const CheckboxList = ({ groups, onChange, onStateChange, className }) => {
3958
3975
  const handleCheckboxChange = (e) => {
3976
+ e.stopPropagation();
3959
3977
  onChange === null || onChange === void 0 ? void 0 : onChange({
3960
3978
  id: e.target.id,
3961
3979
  newCheckedValue: e.target.checked
@@ -3984,7 +4002,10 @@ const CheckboxList = ({ groups, onChange, onStateChange, className }) => {
3984
4002
  const groupTitle = group.title;
3985
4003
  return jsxRuntime.jsx(CheckboxGroup, { items: group.items, title: group.title, isCollapsed: group.isCollapsed, collapsible: group.collapsible, onChange, onStateChange: (items) => handleGroupChange({ groupTitle, items }) }, group.title);
3986
4004
  } else {
3987
- return group.items.map((item) => React.createElement(Checkbox, Object.assign({}, item, { key: item.id, text: item.label, onChange: handleCheckboxChange, classNameCheckboxLabel: "ui:py-3" })));
4005
+ return group.items.map((item) => {
4006
+ var _a;
4007
+ return jsxRuntime.jsx(LabeledCheckbox, { id: item.id, name: item.name, value: item.value, label: item.label, helperText: item.explanation, checked: (_a = item.isChecked) !== null && _a !== void 0 ? _a : false, disabled: item.isDisabled, onChange: handleCheckboxChange, className: classNames__default.default("ui:py-3", item.className) }, item.id);
4008
+ });
3988
4009
  }
3989
4010
  }) });
3990
4011
  };
@@ -6753,6 +6774,12 @@ const calculateHighlightPosition = (args) => {
6753
6774
  const leftFraction = isDescending ? (start - higher) / totalRange : (lower - start) / totalRange;
6754
6775
  return { leftFraction, widthFraction };
6755
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
+ };
6756
6783
  const createStripedPattern = (options) => {
6757
6784
  const { colorA, colorB, startOffset = 0 } = options;
6758
6785
  const STRIPE_THICKNESS = 4;
@@ -6761,7 +6788,7 @@ const createStripedPattern = (options) => {
6761
6788
  };
6762
6789
  const getSegmentStyle = (color) => {
6763
6790
  const baseStyle = {
6764
- height: "18px",
6791
+ height: "24px",
6765
6792
  boxSizing: "content-box"
6766
6793
  };
6767
6794
  if (isColorTuple(color)) {
@@ -6780,20 +6807,27 @@ const COLOR_GREY_DARK = "var(--ui-color-border-info-secondary-hovered)";
6780
6807
  const COLOR_RED = "var(--ui-color-border-error-primary-default)";
6781
6808
  const COLOR_AMBER = "var(--ui-color-icon-warning-secondary-default)";
6782
6809
  const COLOR_BLUE = COLOR_GREY_LIGHT;
6783
- const BORDER_COLOR = "var(--ui-color-border-neutral-secondary-default)";
6784
- const BORDER_RADIUS = "var(--ui-radius-sm, 4px)";
6785
- const COLOR_GAP = [
6786
- "var(--ui-color-background-info-secondary-hovered)",
6787
- "var(--ui-color-background-info-primary-hovered)"
6788
- ];
6810
+ const BORDER_RADIUS = "var(--ui-semantic-radius-s, 4px)";
6811
+ const COLOR_GAP = "var(--ui-color-background-brand-secondary-default)";
6789
6812
  const COLOR_OVERLAP = [
6790
6813
  "var(--ui-color-background-info-secondary-hovered)",
6791
6814
  "var(--ui-color-border-neutral-primary-default)"
6792
6815
  ];
6793
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)";
6794
6829
  const barContainerStyle = {
6795
6830
  width: "100%",
6796
- border: `1px solid ${BORDER_COLOR}`,
6797
6831
  borderRadius: BORDER_RADIUS,
6798
6832
  overflow: "hidden"
6799
6833
  };
@@ -6802,14 +6836,13 @@ const barStyle = {
6802
6836
  alignItems: "center",
6803
6837
  width: "100%",
6804
6838
  height: "24px",
6805
- padding: "0 3px",
6806
- // 3px looks better than 4px
6839
+ // Must match the segments' own height so they fill the rounded container flush, with no gap.
6807
6840
  boxSizing: "border-box"
6808
6841
  };
6809
6842
  const HIGHLIGHT_RING_COLOR = "var(--ui-color-border-brand-primary-selected)";
6810
6843
  const HIGHLIGHT_RING_WIDTH = 2;
6811
6844
  const HIGHLIGHT_RING_INSET = 4;
6812
- const BAR_HORIZONTAL_PADDING = 3;
6845
+ const BAR_HORIZONTAL_PADDING = 0;
6813
6846
  const getHighlightStyle = (position) => ({
6814
6847
  position: "absolute",
6815
6848
  top: -HIGHLIGHT_RING_INSET,
@@ -6826,10 +6859,37 @@ const ticksContainerStyle = {
6826
6859
  width: "100%",
6827
6860
  height: "20px"
6828
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
+ };
6829
6886
  const RangeCoverageComponent = (_a) => {
6830
- var { sections, start, end, highlightedRange, ticks = [], tickFormatter, title, legendSwatches, onSectionFocus, translations, className, slots } = _a, rest = __rest(_a, ["sections", "start", "end", "highlightedRange", "ticks", "tickFormatter", "title", "legendSwatches", "onSectionFocus", "translations", "className", "slots"]);
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"]);
6831
6889
  const { tooltipContent } = slots !== null && slots !== void 0 ? slots : {};
6832
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;
6833
6893
  if (hasSectionOverlaps(sections)) {
6834
6894
  return jsxRuntime.jsx(Text, { variant: "strong", children: translations.sectionOverlapsMessage });
6835
6895
  }
@@ -6846,11 +6906,19 @@ const RangeCoverageComponent = (_a) => {
6846
6906
  startOffset: -6
6847
6907
  }) : swatch.color;
6848
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);
6849
- }) }) })] }), 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) => {
6850
- var _a2, _b;
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;
6851
6912
  const sectionDataWithBackground = Object.assign(Object.assign({}, segment.originalSection), { background: getSegmentStyle(segment.color).background });
6852
6913
  const renderedTooltipContent = (_a2 = tooltipContent === null || tooltipContent === void 0 ? void 0 : tooltipContent.render) === null || _a2 === void 0 ? void 0 : _a2.call(tooltipContent, sectionDataWithBackground);
6853
- const segmentStyle = Object.assign({ flexBasis: `calc(${segment.widthPercent}% - 1px)`, flexGrow: 0, flexShrink: 0, marginRight: "1px" }, getSegmentStyle(segment.color));
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));
6854
6922
  const ariaLabel = `${segment.originalSection.from} - ${segment.originalSection.to}`;
6855
6923
  const legendId = segment.originalSection.legendLabel ? legendIdByLabel.get(segment.originalSection.legendLabel) : void 0;
6856
6924
  if (!renderedTooltipContent && !onSectionFocus) {
@@ -6869,7 +6937,7 @@ const RangeCoverageComponent = (_a) => {
6869
6937
  }
6870
6938
  return (
6871
6939
  // Sections cannot overlap, so from-to should be unique
6872
- jsxRuntime.jsxs(Tooltip.Root, { delayDuration: (_b = tooltipContent === null || tooltipContent === void 0 ? void 0 : tooltipContent.delayDuration) !== null && _b !== void 0 ? _b : 100, children: [jsxRuntime.jsx(Tooltip.Trigger, { asChild: true, children: jsxRuntime.jsx("button", { "aria-label": ariaLabel, "aria-describedby": legendId, style: segmentStyle, onFocus: () => {
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: () => {
6873
6941
  onSectionFocus === null || onSectionFocus === void 0 ? void 0 : onSectionFocus(sectionDataWithBackground);
6874
6942
  }, onBlur: () => {
6875
6943
  onSectionFocus === null || onSectionFocus === void 0 ? void 0 : onSectionFocus(null);
@@ -6882,10 +6950,19 @@ const RangeCoverageComponent = (_a) => {
6882
6950
  maxWidth: 600
6883
6951
  }, children: jsxRuntime.jsx(Card, { border: true, elevation: "medium", width: "full", children: renderedTooltipContent }) })] }, ariaLabel)
6884
6952
  );
6885
- }) }) }), 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.jsx("div", { style: ticksContainerStyle, children: ticks.map((tick, index) => {
6886
- const totalRange = Math.abs(end - start);
6887
- const isDescending = start > end;
6888
- const position = isDescending ? (start - tick) / totalRange * 100 : (tick - start) / totalRange * 100;
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 });
6889
6966
  const isFirst = index === 0;
6890
6967
  const isLast = index === ticks.length - 1;
6891
6968
  const content = tickFormatter ? tickFormatter(tick) : tick;
@@ -6896,7 +6973,7 @@ const RangeCoverageComponent = (_a) => {
6896
6973
  left: `${position}%`,
6897
6974
  transform: isFirst ? "translateX(0%)" : isLast ? "translateX(-100%)" : "translateX(-50%)"
6898
6975
  }, children: content }, tick);
6899
- }) })] })] }) }));
6976
+ }) })] })] })] }) }));
6900
6977
  };
6901
6978
  const RangeCoverage = Object.assign(RangeCoverageComponent, {
6902
6979
  Colors: {
@@ -6907,7 +6984,33 @@ const RangeCoverage = Object.assign(RangeCoverageComponent, {
6907
6984
  BLUE: COLOR_BLUE,
6908
6985
  FILL: COLOR_FILL,
6909
6986
  GAP: COLOR_GAP,
6910
- 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
+ }
6911
7014
  },
6912
7015
  useAdaptiveTicks
6913
7016
  });