@luscii-healthtech/web-ui 46.2.2 → 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.
@@ -32,11 +32,10 @@ var ReactSelect = require('react-select');
32
32
  var RadixSwitch = require('@radix-ui/react-switch');
33
33
  var Quill = require('quill');
34
34
  require('quill-paste-smart');
35
- require('quill/dist/quill.snow.css');
35
+ var solid = require('@heroicons/react/20/solid');
36
36
  var isFunction = require('lodash/isFunction');
37
37
  var isObjectLike = require('lodash/isObjectLike');
38
38
  var react = require('@headlessui/react');
39
- var solid = require('@heroicons/react/20/solid');
40
39
  var ToggleGroup = require('@radix-ui/react-toggle-group');
41
40
 
42
41
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -1799,8 +1798,24 @@ const SearchInput = React__namespace.default.forwardRef((props, ref) => {
1799
1798
  });
1800
1799
 
1801
1800
  const Content$2 = (_a) => {
1802
- var { container, children, className } = _a, contentProps = __rest(_a, ["container", "children", "className"]);
1803
- 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: "secondary-background", px: "m", py: "xs", borderRadius: "xxxxs", children }), jsxRuntime.jsx(Tooltip__namespace.Arrow, { width: 8, height: 8, className: "ui:fill-secondary-background" })] })) });
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() })] })) });
1804
1819
  };
1805
1820
  Content$2.displayName = "Tooltip.Content";
1806
1821
  const Root$1 = (props) => jsxRuntime.jsx(Tooltip__namespace.Root, Object.assign({}, props));
@@ -5231,7 +5246,119 @@ const Textarea = React__namespace.default.forwardRef((_a, ref) => {
5231
5246
  ]), style, ref }));
5232
5247
  });
5233
5248
 
5234
- var css_248z$1 = "/**\n * --- DEPRECATED ---\n * DON'T USE ANYTHING FROM THIS FILE IN FUTURE CHANGES. WE SHOULD BE\n * USING TAILWIND CLASSES DIRECTLY IN OUR COMPONENTS.\n */\n.ql-editor {\n resize: vertical;\n min-height: 10rem;\n}\n\n.ql-snow.ql-toolbar {\n display: block;\n background: #f1f5f9;\n border-top-left-radius: 0.5em;\n border-top-right-radius: 0.5em;\n margin-top: 0.5em;\n}";
5249
+ const LinkTooltip = ({ linkElement, quillInstance, onClose }) => {
5250
+ const dialogRef = React.useRef(null);
5251
+ const anchorName = React.useRef(`link-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`);
5252
+ React.useEffect(() => {
5253
+ var _a;
5254
+ linkElement.style.setProperty("anchor-name", `--${anchorName.current}`);
5255
+ (_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.show();
5256
+ return () => {
5257
+ linkElement.style.removeProperty("anchor-name");
5258
+ };
5259
+ }, [linkElement]);
5260
+ React.useEffect(() => {
5261
+ const handleClickOutside = (event) => {
5262
+ var _a, _b;
5263
+ const target = event.target;
5264
+ if (linkElement.contains(target) || ((_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.contains(target))) {
5265
+ return;
5266
+ }
5267
+ (_b = dialogRef.current) === null || _b === void 0 ? void 0 : _b.close();
5268
+ onClose();
5269
+ };
5270
+ document.addEventListener("mousedown", handleClickOutside);
5271
+ return () => {
5272
+ document.removeEventListener("mousedown", handleClickOutside);
5273
+ };
5274
+ }, [linkElement, onClose]);
5275
+ const handleEditLink = () => {
5276
+ const currentUrl = linkElement.getAttribute("href") || "";
5277
+ const newUrl = prompt("Link URL:", currentUrl);
5278
+ if (newUrl !== null) {
5279
+ const blot = quillInstance.scroll.find(linkElement);
5280
+ if (blot) {
5281
+ const index = quillInstance.getIndex(blot);
5282
+ const length = blot.length();
5283
+ quillInstance.setSelection(index, length);
5284
+ quillInstance.format("link", newUrl || false);
5285
+ }
5286
+ }
5287
+ onClose();
5288
+ };
5289
+ const handleRemoveLink = () => {
5290
+ const blot = quillInstance.scroll.find(linkElement);
5291
+ if (blot) {
5292
+ const index = quillInstance.getIndex(blot);
5293
+ const length = blot.length();
5294
+ quillInstance.setSelection(index, length);
5295
+ quillInstance.format("link", false);
5296
+ }
5297
+ onClose();
5298
+ };
5299
+ const url = linkElement.getAttribute("href") || "";
5300
+ return jsxRuntime.jsx("dialog", { ref: dialogRef, className: "ui:m-0 ui:p-0 ui:border-0 ui:bg-transparent", style: {
5301
+ position: "absolute",
5302
+ // @ts-expect-error - CSS anchor positioning is not yet in TypeScript types
5303
+ positionAnchor: `--${anchorName.current}`,
5304
+ top: "anchor(bottom)",
5305
+ left: "anchor(left)",
5306
+ marginTop: "8px"
5307
+ }, children: jsxRuntime.jsx(Card, { borderRadius: "s", elevation: "large", className: "ui:max-w-80", padding: false, border: true, children: jsxRuntime.jsxs(Stack, { width: "full", align: "stretch", children: [jsxRuntime.jsx(Box, { p: "xs", children: jsxRuntime.jsxs(Text, { children: ["Visit URL:", " ", jsxRuntime.jsx("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "ui:text-blue-600 ui:underline ui:text-sm ui:overflow-hidden ui:text-ellipsis ui:whitespace-nowrap hover:ui:text-blue-700", children: url })] }) }), jsxRuntime.jsx(Divider, { version: "v2" }), jsxRuntime.jsxs(Stack, { axis: "x", gap: "xxs", p: "xs", children: [jsxRuntime.jsx(TertiaryButton, { onClick: handleEditLink, text: "Edit", size: "medium" }), jsxRuntime.jsx(TertiaryButton, { onClick: handleRemoveLink, text: "Remove", size: "medium" }), jsxRuntime.jsx(TertiaryButton, { onClick: onClose, text: "Close", size: "medium" })] })] }) }) });
5308
+ };
5309
+
5310
+ const TextEditorToolbarButton = ({ option, hasTextSelected }) => {
5311
+ const buttonClasses = "ui:aria-pressed:bg-primary-background ui:aria-disabled:cursor-not-allowed";
5312
+ if (typeof option === "string") {
5313
+ switch (option) {
5314
+ case "bold":
5315
+ return jsxRuntime.jsx(TertiaryIconButton, { label: "bold", className: `ql-bold ${buttonClasses}`, children: jsxRuntime.jsx(solid.BoldIcon, { width: 16 }) });
5316
+ case "italic":
5317
+ return jsxRuntime.jsx(TertiaryIconButton, { label: "italic", className: `ql-italic ${buttonClasses}`, children: jsxRuntime.jsx(solid.ItalicIcon, { width: 16 }) });
5318
+ case "underline":
5319
+ return jsxRuntime.jsx(TertiaryIconButton, { label: "underline", className: `ql-underline ${buttonClasses}`, children: jsxRuntime.jsx(solid.UnderlineIcon, { width: 16 }) });
5320
+ case "strike":
5321
+ return jsxRuntime.jsx(TertiaryIconButton, { label: "strike", className: `ql-strike ${buttonClasses}`, children: jsxRuntime.jsx(solid.StrikethroughIcon, { width: 16 }) });
5322
+ case "link":
5323
+ return jsxRuntime.jsx(TertiaryIconButton, { label: "link", className: `ql-link ${buttonClasses}`, disabled: !hasTextSelected, children: jsxRuntime.jsx(solid.LinkIcon, { width: 16 }) });
5324
+ case "video":
5325
+ return jsxRuntime.jsx(TertiaryIconButton, { label: "video", className: `ql-video ${buttonClasses}`, children: jsxRuntime.jsx(solid.VideoCameraIcon, { width: 16 }) });
5326
+ default:
5327
+ return null;
5328
+ }
5329
+ } else if (typeof option === "object" && "list" in option) {
5330
+ if (option.list === "ordered") {
5331
+ return jsxRuntime.jsx(TertiaryIconButton, { label: "ordered list", className: `ql-list ${buttonClasses}`, value: "ordered", children: jsxRuntime.jsx(solid.NumberedListIcon, { width: 16 }) });
5332
+ } else if (option.list === "bullet") {
5333
+ return jsxRuntime.jsx(TertiaryIconButton, { label: "bullet list", className: `ql-list ${buttonClasses}`, value: "bullet", children: jsxRuntime.jsx(solid.ListBulletIcon, { width: 16 }) });
5334
+ }
5335
+ }
5336
+ return null;
5337
+ };
5338
+
5339
+ const getOptionKey = (option, index) => {
5340
+ if (typeof option === "string") {
5341
+ return option;
5342
+ } else if (typeof option === "object" && "list" in option) {
5343
+ return `list-${option.list}`;
5344
+ }
5345
+ return `option-${index}`;
5346
+ };
5347
+ const getGroupKey = (group) => {
5348
+ return group.map((option) => {
5349
+ if (typeof option === "string") {
5350
+ return option;
5351
+ } else if (typeof option === "object" && "list" in option) {
5352
+ return `list-${option.list}`;
5353
+ }
5354
+ return "";
5355
+ }).join("-");
5356
+ };
5357
+ const TextEditorToolbar = ({ toolbarId, toolbar, hasTextSelected }) => {
5358
+ return jsxRuntime.jsx(Stack, { axis: "x", gap: "m", px: "xxxs", id: toolbarId, children: toolbar.map((group) => jsxRuntime.jsx(Stack, { axis: "x", gap: "xxxxs", children: group.map((option, optionIndex) => jsxRuntime.jsx(TextEditorToolbarButton, { option, hasTextSelected }, getOptionKey(option, optionIndex))) }, getGroupKey(group))) });
5359
+ };
5360
+
5361
+ var css_248z$1 = "/**\n * --- DEPRECATED ---\n * DON'T USE ANYTHING FROM THIS FILE IN FUTURE CHANGES. WE SHOULD BE\n * USING TAILWIND CLASSES DIRECTLY IN OUR COMPONENTS.\n */\n.ql-editor {\n resize: vertical;\n min-height: 10rem;\n padding: 1rem;\n font-size: 0.8rem;\n line-height: 1.5;\n}\n.ql-editor a {\n color: var(--ui-color-text-brand-primary-default);\n text-decoration: underline;\n cursor: pointer;\n}\n.ql-editor ul,\n.ql-editor ol {\n padding-left: 1.5rem;\n}\n.ql-editor ul {\n list-style-type: disc;\n}\n.ql-editor ol {\n list-style-type: decimal;\n}\n.ql-editor li {\n margin-bottom: 0.25rem;\n}\n.ql-editor strong {\n font-weight: 600;\n}\n.ql-editor em {\n font-style: italic;\n}\n.ql-editor u {\n text-decoration: underline;\n}\n.ql-editor s {\n text-decoration: line-through;\n}\n.ql-editor h1,\n.ql-editor h2,\n.ql-editor h3,\n.ql-editor h4,\n.ql-editor h5,\n.ql-editor h6 {\n font-weight: 600;\n margin-bottom: 0.75rem;\n margin-top: 1rem;\n}\n.ql-editor h1:first-child,\n.ql-editor h2:first-child,\n.ql-editor h3:first-child,\n.ql-editor h4:first-child,\n.ql-editor h5:first-child,\n.ql-editor h6:first-child {\n margin-top: 0;\n}\n.ql-editor h1 {\n font-size: 2rem;\n}\n.ql-editor h2 {\n font-size: 1.5rem;\n}\n.ql-editor h3 {\n font-size: 1.25rem;\n}\n.ql-editor h4 {\n font-size: 1.125rem;\n}\n.ql-editor h5,\n.ql-editor h6 {\n font-size: 1rem;\n}";
5235
5362
  styleInject(css_248z$1);
5236
5363
 
5237
5364
  const TextEditor = (_a) => {
@@ -5240,36 +5367,62 @@ const TextEditor = (_a) => {
5240
5367
  [{ list: "ordered" }, { list: "bullet" }],
5241
5368
  ["link"]
5242
5369
  ], placeholder, onValueChange } = _a, attrs = __rest(_a, ["defaultValue", "formats", "toolbar", "placeholder", "onValueChange"]);
5370
+ const rawId = React.useId();
5371
+ const toolbarId = `toolbar-${rawId.replace(/:/g, "")}`;
5243
5372
  const defaultValueRef = React.useRef(defaultValue);
5244
5373
  const onTextChangeRef = React.useRef(onValueChange);
5245
5374
  const editorRef = React.useRef(null);
5246
5375
  const quillRef = React.useRef(null);
5376
+ const [linkTooltip, setLinkTooltip] = React.useState(null);
5377
+ const [hasTextSelected, setHasTextSelected] = React.useState(false);
5247
5378
  React.useLayoutEffect(() => {
5248
5379
  onTextChangeRef.current = onValueChange;
5249
5380
  });
5250
5381
  React.useEffect(() => {
5251
- if (editorRef.current) {
5252
- const quill = new Quill__default.default(editorRef.current, {
5253
- theme: "snow",
5254
- formats,
5255
- modules: {
5256
- toolbar
5257
- },
5258
- placeholder
5259
- });
5260
- quill.on(Quill__default.default.events.TEXT_CHANGE, (value, _, source) => {
5261
- var _a2;
5262
- (_a2 = onTextChangeRef.current) === null || _a2 === void 0 ? void 0 : _a2.call(onTextChangeRef, quill.getSemanticHTML(), value, source);
5263
- });
5264
- if (defaultValueRef.current) {
5265
- quill.setContents(quill.clipboard.convert({
5266
- html: defaultValueRef.current
5267
- }));
5268
- }
5269
- quillRef.current = quill;
5382
+ if (!editorRef.current || quillRef.current) {
5383
+ return void 0;
5384
+ }
5385
+ const editor = editorRef.current;
5386
+ const quill = new Quill__default.default(editor, {
5387
+ formats,
5388
+ modules: {
5389
+ toolbar: `#${toolbarId}`
5390
+ },
5391
+ placeholder
5392
+ });
5393
+ quill.on(Quill__default.default.events.TEXT_CHANGE, (value, _, source) => {
5394
+ var _a2;
5395
+ (_a2 = onTextChangeRef.current) === null || _a2 === void 0 ? void 0 : _a2.call(onTextChangeRef, quill.getSemanticHTML(), value, source);
5396
+ });
5397
+ const handleSelectionChange = () => {
5398
+ const selection = quill.getSelection();
5399
+ setHasTextSelected(selection ? selection.length > 0 : false);
5400
+ };
5401
+ quill.on(Quill__default.default.events.SELECTION_CHANGE, handleSelectionChange);
5402
+ if (defaultValueRef.current) {
5403
+ quill.setContents(quill.clipboard.convert({
5404
+ html: defaultValueRef.current
5405
+ }));
5406
+ }
5407
+ quillRef.current = quill;
5408
+ const qlEditor = editor.querySelector(".ql-editor");
5409
+ if (qlEditor) {
5410
+ qlEditor.classList.add("ui:overflow-auto", "ui:resize-y", "ui:min-h-40");
5270
5411
  }
5412
+ const handleEditorClick = (e) => {
5413
+ const target = e.target;
5414
+ if (target.tagName === "A") {
5415
+ e.preventDefault();
5416
+ const anchor = target;
5417
+ setLinkTooltip(anchor);
5418
+ }
5419
+ };
5420
+ editor.addEventListener("click", handleEditorClick);
5421
+ return () => {
5422
+ editor.removeEventListener("click", handleEditorClick);
5423
+ };
5271
5424
  }, []);
5272
- return jsxRuntime.jsx("div", Object.assign({}, attrs, { children: jsxRuntime.jsx("div", { ref: editorRef }) }));
5425
+ return jsxRuntime.jsxs(Card, Object.assign({ padding: false, border: true, borderRadius: "xs", backgroundColor: "base" }, attrs, { children: [jsxRuntime.jsx(Card.TopBar, { children: jsxRuntime.jsx(Card.Actions, { className: "ui:justify-start", children: jsxRuntime.jsx(TextEditorToolbar, { toolbarId, toolbar, hasTextSelected }) }) }), jsxRuntime.jsx(Divider, { version: "v2" }), jsxRuntime.jsx("div", { className: "editor", ref: editorRef }), jsxRuntime.jsx("div", { children: linkTooltip && quillRef.current && jsxRuntime.jsx(LinkTooltip, { linkElement: linkTooltip, quillInstance: quillRef.current, onClose: () => setLinkTooltip(null) }) })] }));
5273
5426
  };
5274
5427
 
5275
5428
  const TextLink = (props) => {
@@ -6151,49 +6304,14 @@ const generateIntermediateTicks = (args) => {
6151
6304
  }
6152
6305
  return Array.from(tickSet).sort((a, b) => isDescending ? b - a : a - b);
6153
6306
  };
6154
- const colorsAreEqual = (colorA, colorB) => {
6155
- const aIsStriped = isColorTuple(colorA);
6156
- const bIsStriped = isColorTuple(colorB);
6157
- if (aIsStriped !== bIsStriped) {
6158
- return false;
6159
- }
6160
- if (aIsStriped && bIsStriped) {
6161
- return colorA[0] === colorB[0] && colorA[1] === colorB[1];
6162
- }
6163
- return colorA === colorB;
6164
- };
6165
- const mergeAdjacentSections = (sections) => {
6166
- if (sections.length === 0) {
6167
- return [];
6168
- }
6169
- const sorted = [...sections].sort((a, b) => {
6170
- const aStart = Math.min(a.from, a.to);
6171
- const bStart = Math.min(b.from, b.to);
6172
- return aStart - bStart;
6173
- });
6174
- const merged = [Object.assign({}, sorted[0])];
6175
- for (let i = 1; i < sorted.length; i++) {
6176
- const current = sorted[i];
6177
- const previous = merged[merged.length - 1];
6178
- const prevEnd = Math.max(previous.from, previous.to);
6179
- const currentStart = Math.min(current.from, current.to);
6180
- const currentEnd = Math.max(current.from, current.to);
6181
- if (prevEnd === currentStart && colorsAreEqual(previous.color, current.color)) {
6182
- previous.to = currentEnd;
6183
- } else {
6184
- merged.push(Object.assign({}, current));
6185
- }
6186
- }
6187
- return merged;
6188
- };
6189
- const calculateSegments = (sections, start, end) => {
6307
+ const calculateSegments = (args) => {
6308
+ const { sections, start, end } = args;
6190
6309
  const isDescending = start > end;
6191
6310
  const rangeMin = Math.min(start, end);
6192
6311
  const rangeMax = Math.max(start, end);
6193
6312
  const totalRange = Math.abs(end - start);
6194
6313
  const segments = [];
6195
- const mergedSections = mergeAdjacentSections(sections);
6196
- const normalizedSections = mergedSections.map((section) => {
6314
+ const normalizedSections = sections.map((section) => {
6197
6315
  const clampedFrom = Math.max(rangeMin, Math.min(rangeMax, section.from));
6198
6316
  const clampedTo = Math.max(rangeMin, Math.min(rangeMax, section.to));
6199
6317
  const higher = Math.max(clampedFrom, clampedTo);
@@ -6203,7 +6321,8 @@ const calculateSegments = (sections, start, end) => {
6203
6321
  return {
6204
6322
  startPos,
6205
6323
  width,
6206
- color: section.color
6324
+ color: section.color,
6325
+ originalSection: section
6207
6326
  };
6208
6327
  }).filter((s) => s.width > 0).sort((a, b) => a.startPos - b.startPos);
6209
6328
  let currentPos = 0;
@@ -6211,19 +6330,26 @@ const calculateSegments = (sections, start, end) => {
6211
6330
  if (section.startPos > currentPos) {
6212
6331
  segments.push({
6213
6332
  widthPercent: section.startPos - currentPos,
6214
- color: "transparent"
6333
+ color: "transparent",
6334
+ originalSection: section.originalSection
6215
6335
  });
6216
6336
  }
6217
6337
  segments.push({
6218
6338
  widthPercent: section.width,
6219
- color: section.color
6339
+ color: section.color,
6340
+ originalSection: section.originalSection
6220
6341
  });
6221
6342
  currentPos = section.startPos + section.width;
6222
6343
  }
6223
6344
  if (currentPos < 100) {
6224
6345
  segments.push({
6225
6346
  widthPercent: 100 - currentPos,
6226
- color: "transparent"
6347
+ color: "transparent",
6348
+ originalSection: {
6349
+ from: end,
6350
+ to: end,
6351
+ color: "transparent"
6352
+ }
6227
6353
  });
6228
6354
  }
6229
6355
  return segments;
@@ -6287,11 +6413,11 @@ const ticksContainerStyle = {
6287
6413
  height: "20px"
6288
6414
  };
6289
6415
  const RangeCoverageComponent = (_a) => {
6290
- 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"]);
6291
6417
  if (hasSectionOverlaps(sections)) {
6292
6418
  return jsxRuntime.jsx(Text, { variant: "strong", children: translations.sectionOverlapsMessage });
6293
6419
  }
6294
- const segments = calculateSegments(sections, start, end);
6420
+ const segments = calculateSegments({ sections, start, end });
6295
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) => {
6296
6422
  const background = isColorTuple(swatch.color) ? createStripedPattern({
6297
6423
  colorA: swatch.color[0],
@@ -6299,7 +6425,39 @@ const RangeCoverageComponent = (_a) => {
6299
6425
  startOffset: -6
6300
6426
  }) : swatch.color;
6301
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);
6302
- }) }) })] }), 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, index) => jsxRuntime.jsx("div", { style: Object.assign({ flexBasis: `${segment.widthPercent}%`, flexGrow: 0, flexShrink: 0 }, getSegmentStyle(segment.color)) }, index)) }) }), ticks.length > 0 && jsxRuntime.jsx("div", { style: ticksContainerStyle, children: ticks.map((tick, index) => {
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) => {
6303
6461
  const totalRange = Math.abs(end - start);
6304
6462
  const isDescending = start > end;
6305
6463
  const position = isDescending ? (start - tick) / totalRange * 100 : (tick - start) / totalRange * 100;