bianic-ui 2.15.0-beta.0 → 2.15.1-alpha.0

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.
Files changed (48) hide show
  1. package/dist/cjs/index.js +791 -53
  2. package/dist/cjs/lib.css +1 -1
  3. package/dist/cjs/types/components/Forms/DatePicker/PickerCalendar/helpers/dateUtils.d.ts +1 -0
  4. package/dist/cjs/types/components/TimelineSlider/Controls.d.ts +30 -0
  5. package/dist/cjs/types/components/TimelineSlider/DefaultLayout.d.ts +8 -0
  6. package/dist/cjs/types/components/TimelineSlider/Labels.d.ts +40 -0
  7. package/dist/cjs/types/components/TimelineSlider/LiteLayout.d.ts +8 -0
  8. package/dist/cjs/types/components/TimelineSlider/TimelineSlider.d.ts +4 -0
  9. package/dist/cjs/types/components/TimelineSlider/Track.d.ts +15 -0
  10. package/dist/cjs/types/components/TimelineSlider/configs.d.ts +71 -0
  11. package/dist/cjs/types/components/TimelineSlider/dateUtils.d.ts +39 -0
  12. package/dist/cjs/types/components/TimelineSlider/index.d.ts +2 -0
  13. package/dist/cjs/types/components/TimelineSlider/types.d.ts +57 -0
  14. package/dist/cjs/types/components/index.d.ts +2 -0
  15. package/dist/cjs/types/stories/Form/Dropdown/DropdownContainer.stories.d.ts +1 -0
  16. package/dist/cjs/types/stories/Form/Dropdown/DropdownItem.test.stories.d.ts +35 -0
  17. package/dist/cjs/types/stories/Menu/Menu.test.stories.d.ts +12 -0
  18. package/dist/cjs/types/stories/Menu/NestedExample.stories.d.ts +1 -0
  19. package/dist/cjs/types/stories/Progress/Bar/ProgressBar.stories.d.ts +1 -13
  20. package/dist/cjs/types/stories/Progress/Bar/ProgressBarSimulation.stories.d.ts +0 -6
  21. package/dist/cjs/types/stories/TimelineSlider/TimelineSlider.stories.d.ts +451 -0
  22. package/dist/cjs/types/stories/TimelineSlider/TimelineSlider.test.stories.d.ts +356 -0
  23. package/dist/cjs/types/utility/hooks/useSubMenuSide.d.ts +4 -0
  24. package/dist/esm/index.js +792 -55
  25. package/dist/esm/lib.css +1 -1
  26. package/dist/esm/types/components/Forms/DatePicker/PickerCalendar/helpers/dateUtils.d.ts +1 -0
  27. package/dist/esm/types/components/TimelineSlider/Controls.d.ts +30 -0
  28. package/dist/esm/types/components/TimelineSlider/DefaultLayout.d.ts +8 -0
  29. package/dist/esm/types/components/TimelineSlider/Labels.d.ts +40 -0
  30. package/dist/esm/types/components/TimelineSlider/LiteLayout.d.ts +8 -0
  31. package/dist/esm/types/components/TimelineSlider/TimelineSlider.d.ts +4 -0
  32. package/dist/esm/types/components/TimelineSlider/Track.d.ts +15 -0
  33. package/dist/esm/types/components/TimelineSlider/configs.d.ts +71 -0
  34. package/dist/esm/types/components/TimelineSlider/dateUtils.d.ts +39 -0
  35. package/dist/esm/types/components/TimelineSlider/index.d.ts +2 -0
  36. package/dist/esm/types/components/TimelineSlider/types.d.ts +57 -0
  37. package/dist/esm/types/components/index.d.ts +2 -0
  38. package/dist/esm/types/stories/Form/Dropdown/DropdownContainer.stories.d.ts +1 -0
  39. package/dist/esm/types/stories/Form/Dropdown/DropdownItem.test.stories.d.ts +35 -0
  40. package/dist/esm/types/stories/Menu/Menu.test.stories.d.ts +12 -0
  41. package/dist/esm/types/stories/Menu/NestedExample.stories.d.ts +1 -0
  42. package/dist/esm/types/stories/Progress/Bar/ProgressBar.stories.d.ts +1 -13
  43. package/dist/esm/types/stories/Progress/Bar/ProgressBarSimulation.stories.d.ts +0 -6
  44. package/dist/esm/types/stories/TimelineSlider/TimelineSlider.stories.d.ts +451 -0
  45. package/dist/esm/types/stories/TimelineSlider/TimelineSlider.test.stories.d.ts +356 -0
  46. package/dist/esm/types/utility/hooks/useSubMenuSide.d.ts +4 -0
  47. package/dist/index.d.ts +59 -2
  48. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -135,8 +135,12 @@ function TbCircleFilled (props) {
135
135
  return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":"2","strokeLinecap":"round","strokeLinejoin":"round"},"child":[{"tag":"path","attr":{"d":"M6 15l6 -6l6 6"},"child":[]}]})(props);
136
136
  }function TbChevronRight (props) {
137
137
  return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":"2","strokeLinecap":"round","strokeLinejoin":"round"},"child":[{"tag":"path","attr":{"d":"M9 6l6 6l-6 6"},"child":[]}]})(props);
138
+ }function TbChevronRightPipe (props) {
139
+ return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":"2","strokeLinecap":"round","strokeLinejoin":"round"},"child":[{"tag":"path","attr":{"d":"M6 6l6 6l-6 6"},"child":[]},{"tag":"path","attr":{"d":"M17 5v13"},"child":[]}]})(props);
138
140
  }function TbChevronLeft (props) {
139
141
  return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":"2","strokeLinecap":"round","strokeLinejoin":"round"},"child":[{"tag":"path","attr":{"d":"M15 6l-6 6l6 6"},"child":[]}]})(props);
142
+ }function TbChevronLeftPipe (props) {
143
+ return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":"2","strokeLinecap":"round","strokeLinejoin":"round"},"child":[{"tag":"path","attr":{"d":"M7 6v12"},"child":[]},{"tag":"path","attr":{"d":"M18 6l-6 6l6 6"},"child":[]}]})(props);
140
144
  }function TbChevronDown (props) {
141
145
  return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":"2","strokeLinecap":"round","strokeLinejoin":"round"},"child":[{"tag":"path","attr":{"d":"M6 9l6 6l6 -6"},"child":[]}]})(props);
142
146
  }function TbCheck (props) {
@@ -602,7 +606,7 @@ var Button = React.forwardRef(function (_a, ref) {
602
606
  sizeClass = "".concat(doubleIconSizeConfig[validatedSize], " ").concat(isVariantLink);
603
607
  }
604
608
  var classString = "\n ".concat(variantConfig$3[validatedVariant], "\n ").concat(sizeClass, "\n ").concat(radiusConfig$1[validatedRadius][validatedSize], "\n ").concat(className, "\n ");
605
- return (React.createElement("button", __assign({ ref: ref, type: "button", className: "bianic-button bianic-fgc-target flex items-center justify-center font-semibold ".concat(classString), disabled: disabled }, props),
609
+ return (React.createElement("button", __assign({ ref: ref, type: "button", className: "bianic-button bianic-fgc-target flex items-center justify-center font-semibold disabled:cursor-not-allowed ".concat(classString), disabled: disabled }, props),
606
610
  childrenElement(renderIcon(iconLeft || left)),
607
611
  childrenElement(label),
608
612
  childrenElement(renderIcon(iconRight || right))));
@@ -1623,18 +1627,18 @@ function Breadcrumb(_a) {
1623
1627
  var disabled = _a.disabled, _b = _a.selected, selected = _b === void 0 ? false : _b, children = _a.children, onClick = _a.onClick, rest = __rest(_a, ["disabled", "selected", "children", "onClick"]);
1624
1628
  var _c = BreadcrumbConfig[String(selected)], container = _c.container, text = _c.text;
1625
1629
  return (React.createElement("div", { className: "flex" },
1626
- React.createElement("button", __assign({ className: "".concat(text, " ").concat(disabled ? 'cursor-pointer text-bia-coolgrey-light-50' : '', " flex cursor-pointer items-center justify-center whitespace-normal rounded-radius-sm bg-transparent px-[5px] py-[3px] focus-visible:outline ").concat(container, " ").concat(disabled ? 'hover:bg-transparent focus-visible:outline-transparent active:bg-transparent' : ''), disabled: disabled, type: "button", onClick: onClick }, rest), children),
1630
+ React.createElement("button", __assign({ className: "".concat(text, " ").concat(disabled ? 'text-bia-coolgrey-light-50' : '', " flex cursor-pointer items-center justify-center whitespace-normal rounded-radius-sm bg-transparent px-[5px] py-[3px] focus-visible:outline disabled:cursor-not-allowed ").concat(container, " ").concat(disabled ? 'hover:bg-transparent focus-visible:outline-transparent active:bg-transparent' : ''), disabled: disabled, type: "button", onClick: onClick }, rest), children),
1627
1631
  !selected && (React.createElement("div", { className: "flex items-center justify-center px-[5px]" },
1628
1632
  React.createElement(Chevron, null)))));
1629
1633
  }
1630
1634
 
1631
1635
  var colorConfig$2 = {
1632
1636
  green: {
1633
- default: 'bg-bia-verdantgreen-dark-20 hover:bg-bia-verdantgreen-dark-10 active:bg-bia-verdantgreen-dark-40 text-primary-white disabled:bg-bia-verdantgreen-dark-20 disabled:text-primary-white/50 disabled:cursor-default',
1637
+ default: 'bg-bia-verdantgreen-dark-20 hover:bg-bia-verdantgreen-dark-10 active:bg-bia-verdantgreen-dark-40 text-primary-white disabled:bg-bia-verdantgreen-dark-20 disabled:text-primary-white/50 disabled:cursor-not-allowed',
1634
1638
  active: 'bg-bia-verdantgreen-dark-40 text-primary-white',
1635
1639
  },
1636
1640
  blue: {
1637
- default: 'bg-bia-crayola hover:bg-bia-crayola-light-10 active:bg-bia-crayola-dark-10 text-primary-white disabled:bg-bia-crayola-dark-20 disabled:text-primary-white/50 disabled:cursor-default',
1641
+ default: 'bg-bia-crayola hover:bg-bia-crayola-light-10 active:bg-bia-crayola-dark-10 text-primary-white disabled:bg-bia-crayola-dark-20 disabled:text-primary-white/50 disabled:cursor-not-allowed',
1638
1642
  active: 'bg-bia-crayola-dark-10 text-primary-white',
1639
1643
  },
1640
1644
  };
@@ -1674,7 +1678,7 @@ function ContextualButtonInner(_a, ref) {
1674
1678
  var stateColor = stateColorConfig[isSelected ? 'selected' : 'default'];
1675
1679
  var notifiedClass = isNotified ? 'relative ' : '';
1676
1680
  var validSize = validUnion(size, sizeUnion$6);
1677
- return (React.createElement("button", __assign({ ref: ref, type: "button", className: "bianic-contextual-button ".concat(notifiedClass, "box-border flex ").concat(minHeightConfig$1[validSize], " flex-row items-center rounded-radius-sm border border-transparent ").concat(paddingConfig[validSize], " outline-none ").concat(stateColor, " ").concat(textColor) }, props, { disabled: disabled }),
1681
+ return (React.createElement("button", __assign({ ref: ref, type: "button", className: "bianic-contextual-button ".concat(notifiedClass, "box-border flex ").concat(minHeightConfig$1[validSize], " flex-row items-center rounded-radius-sm border border-transparent ").concat(paddingConfig[validSize], " outline-none disabled:cursor-not-allowed ").concat(stateColor, " ").concat(textColor) }, props, { disabled: disabled }),
1678
1682
  icon,
1679
1683
  isNotified && (React.createElement("span", { "aria-hidden": "true", className: "absolute -right-[3px] -top-[3px] size-1.5 rounded-radius-full bg-bia-red" })),
1680
1684
  label && (React.createElement("div", { className: "label flex max-h-[46px] items-center gap-x-0.5 px-[5px] text-[12px] leading-none" },
@@ -1692,9 +1696,7 @@ var config$2 = {
1692
1696
  function Card(_a) {
1693
1697
  var children = _a.children, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.variant, variant = _c === void 0 ? 'dark-background' : _c, _d = _a.className, className = _d === void 0 ? '' : _d, _e = _a.type, type = _e === void 0 ? 'button' : _e, rest = __rest(_a, ["children", "disabled", "variant", "className", "type"]);
1694
1698
  var baseStyles = config$2[variant];
1695
- var stateStyles = disabled
1696
- ? 'opacity-50 cursor-not-allowed pointer-events-none'
1697
- : '';
1699
+ var stateStyles = disabled ? 'opacity-50 cursor-not-allowed' : '';
1698
1700
  var combinedClassName = "rounded-radius-md p-5 ".concat(baseStyles, " ").concat(stateStyles, " ").concat(className).trim();
1699
1701
  return (React.createElement("button", __assign({
1700
1702
  // type already defaults to 'button' and is safely typed via ComponentPropsWithoutRef<'button'>;
@@ -2370,30 +2372,67 @@ function MenuContainerNoAnchorInner(propsComp, ref) {
2370
2372
  }
2371
2373
  var MenuContainerNoAnchor = React.forwardRef(MenuContainerNoAnchorInner);
2372
2374
 
2375
+ // Internal. Not exported from any index file.
2376
+ // Shared by DropdownItem and MenuItem to pick the side of a sub-menu.
2377
+ // true when the parent sub-menu opened on the left (deeper levels try left first)
2378
+ var SubMenuSideContext = React.createContext(false);
2379
+ function pickIsLeft(itemRect, subMenuWidth, viewportWidth, preferLeft) {
2380
+ var roomRight = viewportWidth - itemRect.right;
2381
+ var roomLeft = itemRect.left;
2382
+ var fitsRight = subMenuWidth <= roomRight;
2383
+ var fitsLeft = subMenuWidth <= roomLeft;
2384
+ if (preferLeft) {
2385
+ if (fitsLeft)
2386
+ return true;
2387
+ if (fitsRight)
2388
+ return false;
2389
+ return roomLeft >= roomRight;
2390
+ }
2391
+ if (fitsRight)
2392
+ return false;
2393
+ if (fitsLeft)
2394
+ return true;
2395
+ return roomLeft > roomRight;
2396
+ }
2397
+ function useSubMenuSide(isOpen, itemRef, subMenuRef) {
2398
+ var preferLeft = React.useContext(SubMenuSideContext);
2399
+ var _a = React.useState(false), isLeft = _a[0], setIsLeft = _a[1];
2400
+ var measure = React.useCallback(function () {
2401
+ var item = itemRef.current;
2402
+ var subMenu = subMenuRef.current;
2403
+ if (!item || !subMenu)
2404
+ return;
2405
+ setIsLeft(pickIsLeft(item.getBoundingClientRect(), subMenu.offsetWidth, document.documentElement.clientWidth, preferLeft));
2406
+ }, [preferLeft, itemRef, subMenuRef]);
2407
+ // No dependency array: runs before paint on every open and on every
2408
+ // re-render while open. Setting the same side again does nothing.
2409
+ React.useLayoutEffect(function () {
2410
+ if (!isOpen)
2411
+ return;
2412
+ measure();
2413
+ });
2414
+ React.useLayoutEffect(function () {
2415
+ if (!isOpen)
2416
+ return undefined;
2417
+ window.addEventListener('resize', measure);
2418
+ return function () { return window.removeEventListener('resize', measure); };
2419
+ }, [isOpen, measure]);
2420
+ return isLeft;
2421
+ }
2422
+
2373
2423
  function MenuItem(_a) {
2374
2424
  var _b = _a.className, className = _b === void 0 ? '' : _b, label = _a.label, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, _d = _a.caption, caption = _d === void 0 ? undefined : _d, _e = _a.isChecked, isChecked = _e === void 0 ? undefined : _e, _f = _a.onClose, onClose = _f === void 0 ? function () { } : _f, _g = _a.children, children = _g === void 0 ? undefined : _g, _h = _a.zIndex, zIndex = _h === void 0 ? 100 : _h, _j = _a.inheritedOnClick, inheritedOnClick = _j === void 0 ? function () { } : _j, _k = _a.disabled, disabled = _k === void 0 ? false : _k, _l = _a.onKeyDown, consumerOnKeyDown = _l === void 0 ? undefined : _l, _m = _a.onFocus, consumerOnFocus = _m === void 0 ? undefined : _m, _o = _a.onBlur, consumerOnBlur = _o === void 0 ? undefined : _o, props = __rest(_a, ["className", "label", "onClick", "caption", "isChecked", "onClose", "children", "zIndex", "inheritedOnClick", "disabled", "onKeyDown", "onFocus", "onBlur"]);
2375
2425
  var _p = React.useState(false), isHovered = _p[0], setIsHovered = _p[1];
2376
2426
  var _q = React.useState(false), isKeyboardOpen = _q[0], setIsKeyboardOpen = _q[1];
2377
2427
  var _r = React.useState(false), isKeyFocused = _r[0], setIsKeyFocused = _r[1];
2378
2428
  var outerRef = React.useRef(null);
2379
- var _s = React.useState(false), isLeft = _s[0], setIsLeft = _s[1];
2380
2429
  var isWithChecked = isChecked !== undefined;
2381
2430
  var leftPadding = isWithChecked ? 'pl-[5px]' : 'pl-[10px]';
2382
2431
  var rightPadding = caption || children ? 'pr-[5px]' : 'pr-[10px]';
2383
2432
  var itemClass = "".concat(leftPadding, " ").concat(rightPadding, " ").concat(className);
2384
2433
  var MenuContRef = React.useRef(null);
2385
- React.useEffect(function () {
2386
- if (MenuContRef.current) {
2387
- // Adjust dropdown position to prevent overflow on the right.
2388
- var MenuContRect = MenuContRef.current.getBoundingClientRect();
2389
- var RectRight = MenuContRect.right;
2390
- var innerWindow = window.innerWidth;
2391
- if (RectRight > innerWindow)
2392
- setIsLeft(true);
2393
- else
2394
- setIsLeft(false);
2395
- }
2396
- }, [isHovered, isKeyboardOpen]);
2434
+ var isOpen = isHovered || isKeyboardOpen;
2435
+ var isLeft = useSubMenuSide(isOpen, outerRef, MenuContRef);
2397
2436
  var translateClass = isLeft
2398
2437
  ? 'left-0 -translate-x-full'
2399
2438
  : 'right-0 translate-x-full';
@@ -2470,10 +2509,11 @@ function MenuItem(_a) {
2470
2509
  React.createElement("div", { className: "ml-auto flex items-center" },
2471
2510
  children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey" })),
2472
2511
  children === undefined && caption && (React.createElement("span", { className: "ml-[30px] whitespace-nowrap text-[11px] ".concat(disabled ? 'text-bia-coolgrey-light-50' : 'text-bia-coolgrey') }, caption)))),
2473
- children && !disabled && (React.createElement(MenuContainerNoAnchor, { open: isHovered || isKeyboardOpen, onKeyDown: handleSubMenuKeyDown, onClose: function () {
2474
- setIsKeyboardOpen(false);
2475
- onClose();
2476
- }, className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), ref: MenuContRef, zIndex: currentZIndex + 10, onClickItem: function () { return inheritedOnClick(); } }, children))));
2512
+ children && !disabled && (React.createElement(SubMenuSideContext.Provider, { value: isLeft },
2513
+ React.createElement(MenuContainerNoAnchor, { open: isOpen, onKeyDown: handleSubMenuKeyDown, onClose: function () {
2514
+ setIsKeyboardOpen(false);
2515
+ onClose();
2516
+ }, className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), ref: MenuContRef, zIndex: currentZIndex + 10, onClickItem: function () { return inheritedOnClick(); } }, children)))));
2477
2517
  }
2478
2518
 
2479
2519
  var TooltipItem = function (_a) {
@@ -3196,26 +3236,14 @@ function DropdownItem(_a) {
3196
3236
  var _o = React.useState(false), isHovered = _o[0], setIsHovered = _o[1];
3197
3237
  var _p = React.useState(false), isKeyboardOpen = _p[0], setIsKeyboardOpen = _p[1];
3198
3238
  var _q = React.useState(false), isKeyFocused = _q[0], setIsKeyFocused = _q[1];
3199
- var _r = React.useState(false), isLeft = _r[0], setIsLeft = _r[1];
3200
3239
  var outerRef = React.useRef(null);
3201
3240
  var fontClass = fontConfig[size] || fontConfig.md;
3202
3241
  var itemSizeClass = itemSizeConfig[size] || itemSizeConfig.md;
3203
3242
  var itemClass = "".concat(itemSizeClass, " ").concat(fontClass, " ").concat(className);
3204
3243
  var chevronSize = size === 'sm' ? 14 : 18;
3205
3244
  var DropdownContRef = React.useRef(null);
3206
- React.useEffect(function () {
3207
- var _a;
3208
- if (DropdownContRef.current) {
3209
- // Adjust dropdown position to prevent overflow on the right.
3210
- var MenuContRect = (_a = DropdownContRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
3211
- var RectRight = MenuContRect === null || MenuContRect === void 0 ? void 0 : MenuContRect.right;
3212
- var innerWindow = window.innerWidth;
3213
- if (RectRight > innerWindow)
3214
- setIsLeft(true);
3215
- else
3216
- setIsLeft(false);
3217
- }
3218
- }, [isHovered, isKeyboardOpen]);
3245
+ var isOpen = isHovered || isKeyboardOpen;
3246
+ var isLeft = useSubMenuSide(isOpen, outerRef, DropdownContRef);
3219
3247
  var translateClass = isLeft
3220
3248
  ? 'left-0 -translate-x-full'
3221
3249
  : 'right-0 translate-x-full';
@@ -3276,10 +3304,11 @@ function DropdownItem(_a) {
3276
3304
  React.createElement("button", __assign({ className: "relative flex w-full !min-w-fit items-center justify-start whitespace-nowrap bg-bia-white px-[15px] py-[5px] text-left text-bia-black disabled:cursor-not-allowed disabled:text-bia-coolgrey-light-50 hover:[&:not(:disabled)]:bg-bia-blue-pastel ".concat(itemClass).concat(keyFocusClass), style: { zIndex: currentZIndex + 15 }, onClick: function (e) { return onClickItem(e, value); }, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, disabled: disabled, type: "button" }, props),
3277
3305
  content,
3278
3306
  React.createElement("div", { className: "ml-auto flex items-center" }, children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey", size: chevronSize })))),
3279
- children && (React.createElement(DropdownContNoAnchor, { className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), onClose: function () {
3280
- setIsKeyboardOpen(false);
3281
- onClose();
3282
- }, onKeyDown: handleSubMenuKeyDown, open: isHovered || isKeyboardOpen, onClickItem: function (e, itemValue) { return onClickItem(e, itemValue); }, size: size, ref: DropdownContRef, zIndex: currentZIndex + 10 }, children))));
3307
+ children && (React.createElement(SubMenuSideContext.Provider, { value: isLeft },
3308
+ React.createElement(DropdownContNoAnchor, { className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), onClose: function () {
3309
+ setIsKeyboardOpen(false);
3310
+ onClose();
3311
+ }, onKeyDown: handleSubMenuKeyDown, open: isOpen, onClickItem: function (e, itemValue) { return onClickItem(e, itemValue); }, size: size, ref: DropdownContRef, zIndex: currentZIndex + 10 }, children)))));
3283
3312
  }
3284
3313
 
3285
3314
  var matchSearchTerm = function (content, term, variant) {
@@ -4200,6 +4229,13 @@ var checkIsValidDate = function (dateString) {
4200
4229
  date.getUTCMonth() === month - 1 &&
4201
4230
  date.getUTCDate() === day);
4202
4231
  };
4232
+ // Turns a "YYYY-MM-DD" string into that day at local midnight. The Date
4233
+ // constructor reads this format as UTC, which moves the day by one in many
4234
+ // time zones, so min and max dates are read with this instead.
4235
+ var parseLocalDate = function (dateString) {
4236
+ var _a = dateString.split('-').map(Number), year = _a[0], month = _a[1], day = _a[2];
4237
+ return new Date(year, month - 1, day);
4238
+ };
4203
4239
  var dateToInputString = function (dateObj) {
4204
4240
  if (!(dateObj instanceof Date) || Number.isNaN(dateObj.getTime()))
4205
4241
  return '';
@@ -4311,8 +4347,8 @@ function DateDisplay(_a) {
4311
4347
  (_b = (_a = gridRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("[data-date=\"".concat(key, "\"]"))) === null || _b === void 0 ? void 0 : _b.focus();
4312
4348
  }, [firstDayTime]);
4313
4349
  var isDisabledDay = function (date) {
4314
- return !!((minDateValue && date < minDateValue) ||
4315
- (maxDateValue && date > maxDateValue));
4350
+ return !!((minDateValue && getDayKey(date) < getDayKey(minDateValue)) ||
4351
+ (maxDateValue && getDayKey(date) > getDayKey(maxDateValue)));
4316
4352
  };
4317
4353
  var isShown = function (key) {
4318
4354
  return displayDays.some(function (day) { return dateToInputString(day) === key; });
@@ -4414,7 +4450,7 @@ function DateDisplay(_a) {
4414
4450
  customClassname = 'w-full rounded-r-full';
4415
4451
  }
4416
4452
  }
4417
- var dayStateClass = 'hover:bg-bia-blue-pastel';
4453
+ var dayStateClass = 'enabled:hover:bg-bia-blue-pastel';
4418
4454
  if (isSelected) {
4419
4455
  dayStateClass = 'border border-bia-blue-dark-10 bg-bia-blue-dark-10';
4420
4456
  }
@@ -4436,7 +4472,7 @@ function DateDisplay(_a) {
4436
4472
  else if (isOutOfMonth) {
4437
4473
  textStyle = 'text-bia-coolgrey';
4438
4474
  }
4439
- return (React.createElement("button", { type: "button", key: date.toString(), className: "bianic-datepicker-calendar-day flex h-[31px] items-center justify-center ".concat(customClassname, " ").concat(dayStateClass, " ").concat(FOCUS_RING), disabled: isOutOfRange, "data-date": dateKey, "data-calendar-cell": "", tabIndex: dateKey === activeKey ? 0 : -1, onKeyDown: function (event) { return handleKeyDown(event, date); }, onClick: function () {
4475
+ return (React.createElement("button", { type: "button", key: date.toString(), className: "bianic-datepicker-calendar-day flex h-[31px] items-center justify-center disabled:cursor-not-allowed ".concat(customClassname, " ").concat(dayStateClass, " ").concat(FOCUS_RING), disabled: isOutOfRange, "data-date": dateKey, "data-calendar-cell": "", tabIndex: dateKey === activeKey ? 0 : -1, onKeyDown: function (event) { return handleKeyDown(event, date); }, onClick: function () {
4440
4476
  setActiveState({ key: dateKey, view: viewKey });
4441
4477
  onDateSelect(date);
4442
4478
  } },
@@ -4536,7 +4572,7 @@ function MonthDisplay(_a) {
4536
4572
  e.stopPropagation();
4537
4573
  setActiveIndexState(index);
4538
4574
  onMonthSelect(index);
4539
- }, onKeyDown: function (e) { return handleKeyDown(e, index); }, disabled: isOutOfRange, "data-index": index, "data-calendar-cell": "", tabIndex: index === activeIndex ? 0 : -1, className: "bianic-datepicker-calendar-month mx-[15px] flex h-[31px] items-center justify-center rounded-full ".concat(isSelected || isAlreadySelected
4575
+ }, onKeyDown: function (e) { return handleKeyDown(e, index); }, disabled: isOutOfRange, "data-index": index, "data-calendar-cell": "", tabIndex: index === activeIndex ? 0 : -1, className: "bianic-datepicker-calendar-month mx-[15px] flex h-[31px] items-center justify-center rounded-full disabled:cursor-not-allowed ".concat(isSelected || isAlreadySelected
4540
4576
  ? 'border border-bia-blue-dark-10 bg-bia-blue-dark-10'
4541
4577
  : 'enabled:hover:bg-bia-blue-pastel', " ").concat(FOCUS_RING) },
4542
4578
  React.createElement(Text, { variant: "small-text", extended: textStyle }, month.slice(0, 3))));
@@ -4593,7 +4629,7 @@ function YearDisplay(_a) {
4593
4629
  e.stopPropagation();
4594
4630
  setActiveYearState(year);
4595
4631
  onYearSelect(year);
4596
- }, onKeyDown: function (e) { return handleKeyDown(e, index); }, disabled: isOutOfRange, "data-year": year, "data-calendar-cell": "", tabIndex: year === activeYear ? 0 : -1, className: "bianic-datepicker-calendar-month mx-[6px] flex h-[31px] items-center justify-center rounded-full ".concat(isSelected
4632
+ }, onKeyDown: function (e) { return handleKeyDown(e, index); }, disabled: isOutOfRange, "data-year": year, "data-calendar-cell": "", tabIndex: year === activeYear ? 0 : -1, className: "bianic-datepicker-calendar-month mx-[6px] flex h-[31px] items-center justify-center rounded-full disabled:cursor-not-allowed ".concat(isSelected
4597
4633
  ? 'border border-bia-blue-dark-10 bg-bia-blue-dark-10'
4598
4634
  : 'enabled:hover:bg-bia-blue-pastel', " ").concat(isEdgeYear ? 'text-bia-coolgrey' : '', " ").concat(FOCUS_RING) },
4599
4635
  React.createElement(Text, { variant: "small-text", extended: textStyle }, year)));
@@ -4627,7 +4663,7 @@ function PickerHeader(_a) {
4627
4663
  year: 'Next years',
4628
4664
  };
4629
4665
  return (React.createElement("div", { className: "bianic-datepicker-calendar-controller flex w-full items-center justify-between" },
4630
- React.createElement("button", { type: "button", "aria-label": prevLabels[pickerMode], className: "bianic-datepicker-calendar-prev-button rounded text-bia-coolgrey disabled:text-bia-coolgrey-light-50 ".concat(FOCUS_RING), disabled: isPrevDisabled ? isPrevDisabled() : false, onClick: handlePrev },
4666
+ React.createElement("button", { type: "button", "aria-label": prevLabels[pickerMode], className: "bianic-datepicker-calendar-prev-button rounded text-bia-coolgrey disabled:cursor-not-allowed disabled:text-bia-coolgrey-light-50 ".concat(FOCUS_RING), disabled: isPrevDisabled ? isPrevDisabled() : false, onClick: handlePrev },
4631
4667
  React.createElement(TbChevronLeft, { size: 18, "aria-hidden": "true" })),
4632
4668
  React.createElement("div", { className: "bianic-datepicker-calendar-current-month flex items-center justify-center gap-1" },
4633
4669
  React.createElement("button", { type: "button", className: "".concat(pickerMode === 'date' ? '' : 'hidden', " rounded ").concat(FOCUS_RING), onClick: function (e) {
@@ -4644,7 +4680,7 @@ function PickerHeader(_a) {
4644
4680
  React.createElement(Text, { variant: "normal-text" }, viewYearValue)),
4645
4681
  React.createElement("button", { type: "button", className: "".concat(pickerMode === 'year' ? '' : 'hidden', " rounded ").concat(FOCUS_RING) },
4646
4682
  React.createElement(Text, { variant: "normal-text" }, "".concat(yearDisplayRange[1], " - ").concat(yearDisplayRange[10])))),
4647
- React.createElement("button", { type: "button", "aria-label": nextLabels[pickerMode], className: "bianic-datepicker-calendar-next-button rounded text-bia-coolgrey disabled:text-bia-coolgrey-light-50 ".concat(FOCUS_RING), disabled: isNextDisabled ? isNextDisabled() : false, onClick: handleNext },
4683
+ React.createElement("button", { type: "button", "aria-label": nextLabels[pickerMode], className: "bianic-datepicker-calendar-next-button rounded text-bia-coolgrey disabled:cursor-not-allowed disabled:text-bia-coolgrey-light-50 ".concat(FOCUS_RING), disabled: isNextDisabled ? isNextDisabled() : false, onClick: handleNext },
4648
4684
  React.createElement(TbChevronRight, { size: 18, "aria-hidden": "true" }))));
4649
4685
  }
4650
4686
 
@@ -4655,8 +4691,8 @@ var useCalendarLogic = function (selectedDate, minDate, maxDate) {
4655
4691
  var _d = React.useState(new Date(selectedDate || TODAY_VALUE).getFullYear()), viewYearValue = _d[0], setViewYearValue = _d[1];
4656
4692
  var _e = React.useState(new Date(selectedDate || TODAY_VALUE).getFullYear()), viewDecadeValue = _e[0], setViewDecadeValue = _e[1];
4657
4693
  var _f = React.useState([]), displayDays = _f[0], setDisplayDays = _f[1];
4658
- var minDateValue = minDate && checkIsValidDate(minDate) ? new Date(minDate) : null;
4659
- var maxDateValue = maxDate && checkIsValidDate(maxDate) ? new Date(maxDate) : null;
4694
+ var minDateValue = minDate && checkIsValidDate(minDate) ? parseLocalDate(minDate) : null;
4695
+ var maxDateValue = maxDate && checkIsValidDate(maxDate) ? parseLocalDate(maxDate) : null;
4660
4696
  var handlePrevMonth = function () {
4661
4697
  if (viewMonthValue === 0) {
4662
4698
  setViewMonthValue(11);
@@ -7498,6 +7534,707 @@ var TableFilterButton = React.forwardRef(function (_a, ref) {
7498
7534
  });
7499
7535
  TableFilterButton.displayName = 'TableFilterButton';
7500
7536
 
7537
+ /** Palette order used when an event has no `color`. */
7538
+ var EVENT_COLOR_UNION = [
7539
+ 'green',
7540
+ 'pink',
7541
+ 'yellow',
7542
+ 'sky',
7543
+ ];
7544
+ /** Outline of every event diamond. */
7545
+ var markerStrokeConfig = {
7546
+ green: 'stroke-bia-green',
7547
+ pink: 'stroke-bia-pink',
7548
+ yellow: 'stroke-bia-yellow',
7549
+ sky: 'stroke-bia-sky',
7550
+ };
7551
+ /** Filled center of a passed event's diamond. */
7552
+ var markerFillConfig = {
7553
+ green: 'fill-bia-green',
7554
+ pink: 'fill-bia-pink',
7555
+ yellow: 'fill-bia-yellow',
7556
+ sky: 'fill-bia-sky',
7557
+ };
7558
+ var trackFillConfig = {
7559
+ enabled: 'bg-bia-blue',
7560
+ disabled: 'bg-bia-blue-disabled',
7561
+ };
7562
+ var playheadConfig = {
7563
+ enabled: 'bg-primary-black',
7564
+ disabled: 'bg-bia-coolgrey-disabled',
7565
+ };
7566
+ /** Event diamond size in px. */
7567
+ var MARKER_PX = 12;
7568
+ /**
7569
+ * Lite icon button (bianic Button, default-outlined, sm). A step that is not
7570
+ * possible keeps the button focusable (aria-disabled) and looks disabled.
7571
+ * On touch screens the tap area grows to 44px tall without changing the look.
7572
+ */
7573
+ var hintButtonClass = "disabled:cursor-not-allowed aria-disabled:cursor-not-allowed aria-disabled:border-bia-coolgrey-disabled aria-disabled:text-bia-coolgrey-disabled aria-disabled:hover:border-bia-coolgrey-disabled aria-disabled:active:bg-primary-white [@media(pointer:coarse)]:relative [@media(pointer:coarse)]:after:absolute [@media(pointer:coarse)]:after:-inset-x-[2px] [@media(pointer:coarse)]:after:-inset-y-[7px] [@media(pointer:coarse)]:after:content-['']";
7574
+ /**
7575
+ * Default-variant step buttons (bianic Button, default-outlined, sm).
7576
+ * REVISI: a disabled button shows the not-allowed cursor; the bianic Button
7577
+ * does not set one. Its disabled border class has a typo in buttonConfigs.ts
7578
+ * (a missing space), so the light disabled border is set here too, matching
7579
+ * the lite buttons.
7580
+ */
7581
+ var stepButtonClass = 'disabled:cursor-not-allowed disabled:border-bia-coolgrey-disabled';
7582
+ /** Icon color of a button that cannot move. The bianic Button colors icons black. */
7583
+ var inactiveIconClass = '!text-bia-coolgrey-disabled';
7584
+ /**
7585
+ * One line of cut text, by text size. The wrapper font must match the text
7586
+ * (Segoe 12px or Arial 11px), and the 16px line is tall enough for descenders.
7587
+ */
7588
+ var textLineConfig = {
7589
+ small: 'font-segoe text-size-sm leading-4',
7590
+ tiny: 'font-arial text-size-tiny leading-4',
7591
+ };
7592
+ /** bianic Text variant for each text size. */
7593
+ var textVariantConfig = {
7594
+ small: 'small-text',
7595
+ tiny: 'tiny-text',
7596
+ };
7597
+ /** Axis labels: bianic Tiny Text (Arial 11px), centered in a 16px row as in Figma. */
7598
+ var axisLabelClass = 'leading-4';
7599
+ /** Estimated width of one axis label character in px (Arial 11px). */
7600
+ var AXIS_CHAR_PX = 6;
7601
+ /** Tooltip and accessible name of each lite icon button, as in the Figma design. */
7602
+ var LITE_BUTTON_LABELS = {
7603
+ previousEvent: 'Previous Event',
7604
+ previousDay: 'Previous Day',
7605
+ nextDay: 'Next Day',
7606
+ nextEvent: 'Next Event',
7607
+ };
7608
+ /** Hover delay before a tooltip shows. Keyboard focus shows it at once. */
7609
+ var HINT_DELAY_MS = 400;
7610
+ var hintBubbleClass = 'pointer-events-none z-[150] w-max max-w-[240px] rounded-[4px] bg-bia-black px-[7px] py-[4px] font-segoe text-size-sm text-bia-white';
7611
+ /**
7612
+ * Grey text, as in Figma ("Primary/Cool Grey" #8C8CA6). Its contrast on white
7613
+ * is about 3.3:1; the team chose the Figma color (decision log BIAN-268).
7614
+ */
7615
+ var mutedTextClass = 'text-bia-coolgrey';
7616
+ /** Text for an empty period, in both variants. */
7617
+ var NO_EVENTS_TEXT = 'No events in this period';
7618
+ /** Default `noEventLabel`: a day without an event in a period that has events. */
7619
+ var DEFAULT_NO_EVENT_LABEL = 'No change on this day';
7620
+ /** Accessible name of the slider when `sliderLabel` is left out or empty. */
7621
+ var DEFAULT_SLIDER_LABEL = 'Timeline';
7622
+
7623
+ var DAY_MS = 86400000;
7624
+ var WEEKDAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
7625
+ var MONTHS = [
7626
+ 'Jan',
7627
+ 'Feb',
7628
+ 'Mar',
7629
+ 'Apr',
7630
+ 'May',
7631
+ 'Jun',
7632
+ 'Jul',
7633
+ 'Aug',
7634
+ 'Sep',
7635
+ 'Oct',
7636
+ 'Nov',
7637
+ 'Dec',
7638
+ ];
7639
+ /**
7640
+ * Whole days since 1 Jan 1970 for the local calendar date.
7641
+ * Ignores the time of day, so daylight saving never shifts a day.
7642
+ * Returns NaN for an invalid date.
7643
+ */
7644
+ function toDayNumber(date) {
7645
+ var d = new Date(date);
7646
+ return Math.round(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()) / DAY_MS);
7647
+ }
7648
+ /** Local midnight of a day number. */
7649
+ function fromDayNumber(day) {
7650
+ var utc = new Date(day * DAY_MS);
7651
+ return new Date(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate());
7652
+ }
7653
+ /** "Wed, 1 Jul 2026" */
7654
+ function formatDay(day) {
7655
+ var d = fromDayNumber(day);
7656
+ return "".concat(WEEKDAYS[d.getDay()], ", ").concat(d.getDate(), " ").concat(MONTHS[d.getMonth()], " ").concat(d.getFullYear());
7657
+ }
7658
+ /** "Jul 1" */
7659
+ function formatShortDay(day) {
7660
+ var d = fromDayNumber(day);
7661
+ return "".concat(MONTHS[d.getMonth()], " ").concat(d.getDate());
7662
+ }
7663
+ /** `auto`: up to about 2 months, a label every 7 days. */
7664
+ var WEEK_LIMIT = 62;
7665
+ /** `auto`: up to about 18 months, one label per month. Longer: one per quarter. */
7666
+ var MONTH_LIMIT = 548;
7667
+ /** Calendar spans (months, quarters or years) that overlap the period. */
7668
+ function spansOf(minDay, maxDay, monthsPerSpan) {
7669
+ var spans = [];
7670
+ var start = fromDayNumber(minDay);
7671
+ var year = start.getFullYear();
7672
+ var month = Math.floor(start.getMonth() / monthsPerSpan) * monthsPerSpan;
7673
+ var first = toDayNumber(new Date(year, month, 1));
7674
+ while (first <= maxDay) {
7675
+ var last = toDayNumber(new Date(year, month + monthsPerSpan, 0));
7676
+ var from = Math.max(first, minDay);
7677
+ var to = Math.min(last, maxDay);
7678
+ spans.push({ year: year, month: month, center: (from + to) / 2, days: to - from + 1 });
7679
+ month += monthsPerSpan;
7680
+ if (month > 11) {
7681
+ month -= 12;
7682
+ year += 1;
7683
+ }
7684
+ first = toDayNumber(new Date(year, month, 1));
7685
+ }
7686
+ return spans;
7687
+ }
7688
+ /** Drops short partial spans at the ends, so their labels do not overlap. */
7689
+ function keepLong(spans, minDays) {
7690
+ var long = spans.filter(function (span) { return span.days >= minDays; });
7691
+ return long.length ? long : spans;
7692
+ }
7693
+ /** A label every `step` days from the first day. */
7694
+ function everyNDays(minDay, maxDay, step) {
7695
+ var ticks = [];
7696
+ for (var day = minDay; day <= maxDay; day += step) {
7697
+ ticks.push({ key: "d".concat(day), label: formatShortDay(day), day: day });
7698
+ }
7699
+ return ticks;
7700
+ }
7701
+ /** Axis labels for the default variant, by `axisUnit`. */
7702
+ function axisTicks(minDay, maxDay, unit) {
7703
+ if (unit === void 0) { unit = 'auto'; }
7704
+ var resolved = unit;
7705
+ if (unit === 'auto') {
7706
+ var total = maxDay - minDay + 1;
7707
+ if (total <= WEEK_LIMIT)
7708
+ resolved = 'week';
7709
+ else if (total <= MONTH_LIMIT)
7710
+ resolved = 'month';
7711
+ else
7712
+ resolved = 'quarter';
7713
+ }
7714
+ switch (resolved) {
7715
+ case 'day':
7716
+ return everyNDays(minDay, maxDay, 1);
7717
+ case 'week':
7718
+ return everyNDays(minDay, maxDay, 7);
7719
+ case 'month': {
7720
+ var spans = keepLong(spansOf(minDay, maxDay, 1), 7);
7721
+ // Across years, the first label and every January show the year.
7722
+ var isMultiYear_1 = spans[0].year !== spans[spans.length - 1].year;
7723
+ return spans.map(function (span, index) {
7724
+ var isMajor = isMultiYear_1 && (index === 0 || span.month === 0);
7725
+ return {
7726
+ key: "".concat(span.year, "-").concat(span.month),
7727
+ label: isMajor
7728
+ ? "".concat(MONTHS[span.month], " ").concat(span.year)
7729
+ : MONTHS[span.month],
7730
+ day: span.center,
7731
+ isMajor: isMajor,
7732
+ };
7733
+ });
7734
+ }
7735
+ case 'year':
7736
+ return keepLong(spansOf(minDay, maxDay, 12), 60).map(function (span) { return ({
7737
+ key: "".concat(span.year),
7738
+ label: "".concat(span.year),
7739
+ day: span.center,
7740
+ }); });
7741
+ default:
7742
+ return keepLong(spansOf(minDay, maxDay, 3), 21).map(function (span) { return ({
7743
+ key: "".concat(span.year, "-").concat(span.month),
7744
+ label: "Q".concat(span.month / 3 + 1, " ").concat(span.year),
7745
+ day: span.center,
7746
+ }); });
7747
+ }
7748
+ }
7749
+ /**
7750
+ * Places the labels on a track `widthPx` wide and keeps the ones that fit.
7751
+ * Each label is centered on its day; only a label that would stick out past an
7752
+ * end of the track is aligned to that end. Labels where the year changes go
7753
+ * first, then the rest from left to right; a label that would touch one already
7754
+ * kept is dropped. Widths are estimated from the text length.
7755
+ */
7756
+ function fitTicks(ticks, widthPx, percentOf, charPx) {
7757
+ if (widthPx <= 0) {
7758
+ return ticks.map(function (tick) { return (__assign(__assign({}, tick), { align: 'center' })); });
7759
+ }
7760
+ var GAP_PX = 8;
7761
+ var boxes = ticks.map(function (tick) {
7762
+ var x = (percentOf(tick.day) / 100) * widthPx;
7763
+ var width = tick.label.length * charPx;
7764
+ var align = 'center';
7765
+ var left = x - width / 2;
7766
+ if (left < 0) {
7767
+ align = 'start';
7768
+ left = x;
7769
+ }
7770
+ else if (left + width > widthPx) {
7771
+ align = 'end';
7772
+ left = x - width;
7773
+ }
7774
+ return { tick: __assign(__assign({}, tick), { align: align }), left: left, right: left + width };
7775
+ });
7776
+ var kept = [];
7777
+ var fits = function (box) {
7778
+ return kept.every(function (other) {
7779
+ return box.left >= other.right + GAP_PX || box.right + GAP_PX <= other.left;
7780
+ });
7781
+ };
7782
+ var place = function (box) {
7783
+ if (fits(box))
7784
+ kept.push(box);
7785
+ };
7786
+ boxes.filter(function (box) { return box.tick.isMajor; }).forEach(place);
7787
+ boxes.filter(function (box) { return !box.tick.isMajor; }).forEach(place);
7788
+ var keptKeys = new Set(kept.map(function (box) { return box.tick.key; }));
7789
+ return boxes
7790
+ .filter(function (box) { return keptKeys.has(box.tick.key); })
7791
+ .map(function (box) { return box.tick; });
7792
+ }
7793
+
7794
+ /** Event diamond, drawn on a 12x12 grid and scaled to `sizePx`. */
7795
+ function Marker(_a) {
7796
+ var color = _a.color, look = _a.look, sizePx = _a.sizePx, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.style, style = _c === void 0 ? undefined : _c;
7797
+ return (React.createElement("svg", { "aria-hidden": "true", width: sizePx, height: sizePx, viewBox: "0 0 12 12", className: "shrink-0 ".concat(className), style: style },
7798
+ React.createElement("path", { d: "M6 0.75 11.25 6 6 11.25 0.75 6Z", strokeWidth: 1.5, className: "fill-bia-white ".concat(markerStrokeConfig[color]) }),
7799
+ look !== 'upcoming' && (React.createElement("path", { d: "M6 3.3 8.7 6 6 8.7 3.3 6Z", className: markerFillConfig[color] }))));
7800
+ }
7801
+ /**
7802
+ * One line of body text cut with an ellipsis. Only when it is cut, it is
7803
+ * wrapped in the bianic Tooltip, which shows the full text on hover. Screen
7804
+ * readers already read the full text.
7805
+ */
7806
+ function TruncatedText(_a) {
7807
+ var text = _a.text, _b = _a.textSize, textSize = _b === void 0 ? 'small' : _b, _c = _a.textClassName, textClassName = _c === void 0 ? '' : _c;
7808
+ var textRef = React.useRef(null);
7809
+ var _d = React.useState(false), isTruncated = _d[0], setIsTruncated = _d[1];
7810
+ // Re-check when the text, the available width, or the wrapper changes.
7811
+ React.useLayoutEffect(function () {
7812
+ var element = textRef.current;
7813
+ if (!element)
7814
+ return undefined;
7815
+ var check = function () {
7816
+ return setIsTruncated(element.scrollWidth > element.clientWidth);
7817
+ };
7818
+ check();
7819
+ var observer = new ResizeObserver(check);
7820
+ observer.observe(element);
7821
+ return function () { return observer.disconnect(); };
7822
+ }, [text, isTruncated]);
7823
+ var textNode = (React.createElement("span", { ref: textRef, className: "min-w-0 truncate ".concat(textLineConfig[textSize]) },
7824
+ React.createElement(Text, { variant: textVariantConfig[textSize], className: textClassName }, text)));
7825
+ if (!isTruncated)
7826
+ return textNode;
7827
+ return (
7828
+ // The bianic Tooltip wraps its child in a `w-fit` div. Let that div shrink
7829
+ // to the space here, so the text is still cut with an ellipsis.
7830
+ React.createElement("span", { className: "flex min-w-0 [&>.tooltip-wrapper]:min-w-0 [&>.tooltip-wrapper]:max-w-full" },
7831
+ React.createElement(Tooltip, { content: text, direction: "top", maxWidth: "240" }, textNode)));
7832
+ }
7833
+ /** Colored diamond plus the event name in black. */
7834
+ function EventName(_a) {
7835
+ var marker = _a.marker, _b = _a.textSize, textSize = _b === void 0 ? 'small' : _b, _c = _a.className, className = _c === void 0 ? '' : _c;
7836
+ return (React.createElement("span", { className: "flex min-w-0 items-center gap-[5px] ".concat(className) },
7837
+ React.createElement(Marker, { color: marker.color, look: "passed", sizePx: MARKER_PX }),
7838
+ React.createElement(TruncatedText, { text: marker.name, textSize: textSize })));
7839
+ }
7840
+
7841
+ /**
7842
+ * Dark tooltip above the anchor, rendered in document.body so a parent with
7843
+ * overflow hidden cannot clip it. Hidden from screen readers: the same text is
7844
+ * already the anchor's accessible name.
7845
+ */
7846
+ function HintBubble(_a) {
7847
+ var anchorRef = _a.anchorRef, text = _a.text;
7848
+ var bubbleRef = React.useRef(null);
7849
+ var positionStyle = usePopupPosition(anchorRef, bubbleRef, 'top')[0];
7850
+ return reactDom.createPortal(React.createElement("div", { ref: bubbleRef, "aria-hidden": "true", className: "bianic-timeline-hint absolute ".concat(hintBubbleClass), style: positionStyle }, text), document.body);
7851
+ }
7852
+ function isFocusVisible(element) {
7853
+ try {
7854
+ return element.matches(':focus-visible');
7855
+ }
7856
+ catch (_a) {
7857
+ return true;
7858
+ }
7859
+ }
7860
+ /**
7861
+ * 30x30 icon-only bianic Button (default-outlined, sm) with a tooltip on hover
7862
+ * (after 400ms) and on keyboard focus.
7863
+ */
7864
+ function HintButton(_a) {
7865
+ var hint = _a.hint, icon = _a.icon, isUnavailable = _a.isUnavailable, disabled = _a.disabled, onPress = _a.onPress;
7866
+ var anchorRef = React.useRef(null);
7867
+ var timerRef = React.useRef(null);
7868
+ var _b = React.useState(false), isOpen = _b[0], setIsOpen = _b[1];
7869
+ var clearTimer = function () {
7870
+ if (timerRef.current !== null) {
7871
+ clearTimeout(timerRef.current);
7872
+ timerRef.current = null;
7873
+ }
7874
+ };
7875
+ React.useEffect(function () { return function () {
7876
+ if (timerRef.current !== null)
7877
+ clearTimeout(timerRef.current);
7878
+ }; }, []);
7879
+ var hide = function () {
7880
+ clearTimer();
7881
+ setIsOpen(false);
7882
+ };
7883
+ var handleKeyDown = function (event) {
7884
+ if (event.key === 'Escape')
7885
+ hide();
7886
+ };
7887
+ return (React.createElement("span", { ref: anchorRef, className: "inline-flex" },
7888
+ React.createElement(Button, { variant: "default-outlined", size: "sm", "aria-label": hint, "aria-disabled": isUnavailable || undefined, disabled: disabled, iconLeft: React.cloneElement(icon, {
7889
+ className: isUnavailable || disabled ? inactiveIconClass : '',
7890
+ }), className: hintButtonClass, onClick: function () {
7891
+ if (!isUnavailable)
7892
+ onPress();
7893
+ }, onMouseEnter: function () {
7894
+ clearTimer();
7895
+ timerRef.current = setTimeout(function () { return setIsOpen(true); }, HINT_DELAY_MS);
7896
+ }, onMouseLeave: hide, onFocus: function (event) {
7897
+ if (isFocusVisible(event.currentTarget)) {
7898
+ clearTimer();
7899
+ setIsOpen(true);
7900
+ }
7901
+ }, onBlur: hide, onKeyDown: handleKeyDown }),
7902
+ isOpen && React.createElement(HintBubble, { anchorRef: anchorRef, text: hint })));
7903
+ }
7904
+
7905
+ var clamp = function (n, low, high) {
7906
+ return Math.min(Math.max(n, low), high);
7907
+ };
7908
+ /** "Mid-year review · Jul 1" */
7909
+ var markerText = function (marker) {
7910
+ return "".concat(marker.name, " \u00B7 ").concat(formatShortDay(marker.day));
7911
+ };
7912
+ function useTimeline(_a) {
7913
+ var value = _a.value, startDate = _a.startDate, endDate = _a.endDate, events = _a.events, onChange = _a.onChange, disabled = _a.disabled, _b = _a.axisUnit, axisUnit = _b === void 0 ? 'auto' : _b;
7914
+ var minDay = toDayNumber(startDate);
7915
+ var maxDay = Math.max(minDay, toDayNumber(endDate));
7916
+ var rawValueDay = toDayNumber(value);
7917
+ var valueDay = Number.isNaN(rawValueDay)
7918
+ ? minDay
7919
+ : clamp(rawValueDay, minDay, maxDay);
7920
+ var totalDays = maxDay - minDay + 1;
7921
+ // A new period that no longer holds `value`: move to the nearest end and report it.
7922
+ React.useEffect(function () {
7923
+ if (onChange && rawValueDay !== valueDay)
7924
+ onChange(fromDayNumber(valueDay));
7925
+ // Run only when the day or the period changes, not when onChange is a new function.
7926
+ // eslint-disable-next-line react-hooks/exhaustive-deps
7927
+ }, [rawValueDay, valueDay]);
7928
+ var percentOf = function (day) {
7929
+ return totalDays > 1 ? ((day - minDay) / (totalDays - 1)) * 100 : 0;
7930
+ };
7931
+ var markers = React.useMemo(function () {
7932
+ return events
7933
+ .map(function (event, index) { return ({
7934
+ id: event.id,
7935
+ name: event.name,
7936
+ day: toDayNumber(event.date),
7937
+ // A fixed color per event: its own, or the palette by its place in `events`.
7938
+ color: event.color && EVENT_COLOR_UNION.includes(event.color)
7939
+ ? event.color
7940
+ : EVENT_COLOR_UNION[index % EVENT_COLOR_UNION.length],
7941
+ }); })
7942
+ .filter(function (marker) { return marker.day >= minDay && marker.day <= maxDay; })
7943
+ .sort(function (a, b) { return a.day - b.day; });
7944
+ }, [events, minDay, maxDay]);
7945
+ var ticks = React.useMemo(function () { return axisTicks(minDay, maxDay, axisUnit); }, [minDay, maxDay, axisUnit]);
7946
+ var currentEvent = markers.find(function (m) { return m.day === valueDay; });
7947
+ var previousEvent = __spreadArray([], markers, true).reverse().find(function (m) { return m.day < valueDay; });
7948
+ var nextEvent = markers.find(function (m) { return m.day > valueDay; });
7949
+ var hasPreviousDay = valueDay > minDay;
7950
+ var hasNextDay = valueDay < maxDay;
7951
+ var goToDay = function (day) {
7952
+ if (disabled || !onChange)
7953
+ return;
7954
+ var target = clamp(day, minDay, maxDay);
7955
+ if (target !== valueDay)
7956
+ onChange(fromDayNumber(target));
7957
+ };
7958
+ return {
7959
+ minDay: minDay,
7960
+ maxDay: maxDay,
7961
+ valueDay: valueDay,
7962
+ totalDays: totalDays,
7963
+ dayOfPeriod: valueDay - minDay + 1,
7964
+ dateLabel: formatDay(valueDay),
7965
+ percentOf: percentOf,
7966
+ markers: markers,
7967
+ ticks: ticks,
7968
+ hasEvents: markers.length > 0,
7969
+ currentEvent: currentEvent,
7970
+ previousEvent: previousEvent,
7971
+ nextEvent: nextEvent,
7972
+ hasPreviousDay: hasPreviousDay,
7973
+ hasNextDay: hasNextDay,
7974
+ goToDay: goToDay,
7975
+ };
7976
+ }
7977
+ /** Width of an element in px, kept up to date when it resizes. Internal only. */
7978
+ function useElementWidth(ref) {
7979
+ var _a = React.useState(0), width = _a[0], setWidth = _a[1];
7980
+ React.useLayoutEffect(function () {
7981
+ var element = ref.current;
7982
+ if (!element)
7983
+ return undefined;
7984
+ var update = function () { return setWidth(element.getBoundingClientRect().width); };
7985
+ update();
7986
+ var observer = new ResizeObserver(update);
7987
+ observer.observe(element);
7988
+ return function () { return observer.disconnect(); };
7989
+ }, [ref]);
7990
+ return width;
7991
+ }
7992
+
7993
+ /** Days moved by each key. Home and End are handled separately. */
7994
+ var KEY_STEPS = {
7995
+ ArrowLeft: -1,
7996
+ ArrowDown: -1,
7997
+ ArrowRight: 1,
7998
+ ArrowUp: 1,
7999
+ PageDown: -7,
8000
+ PageUp: 7,
8001
+ };
8002
+ /** Passed events and the active one under the playhead show a filled center. */
8003
+ function markerLook(day, valueDay) {
8004
+ if (day < valueDay)
8005
+ return 'passed';
8006
+ if (day === valueDay)
8007
+ return 'current';
8008
+ return 'upcoming';
8009
+ }
8010
+ /**
8011
+ * 24px track row: progress line, event diamonds, a 2px playhead line as tall
8012
+ * as the row, and an
8013
+ * invisible native range input on top for click, drag and keys. Internal only.
8014
+ */
8015
+ function Track(_a) {
8016
+ var timeline = _a.timeline, sliderLabel = _a.sliderLabel, disabled = _a.disabled, _b = _a.className, className = _b === void 0 ? '' : _b;
8017
+ var minDay = timeline.minDay, maxDay = timeline.maxDay, valueDay = timeline.valueDay, totalDays = timeline.totalDays, dateLabel = timeline.dateLabel, percentOf = timeline.percentOf, markers = timeline.markers, goToDay = timeline.goToDay;
8018
+ var valuePercent = percentOf(valueDay);
8019
+ var state = disabled ? 'disabled' : 'enabled';
8020
+ var trackRef = React.useRef(null);
8021
+ var markerPx = MARKER_PX;
8022
+ // Half the diamond plus 1px. A pointer this close to a diamond is on it: the
8023
+ // tooltip shows, and a click or drag picks the event's day.
8024
+ var markerHitPx = markerPx / 2 + 1;
8025
+ var renderMarker = function (marker) { return (React.createElement(Marker, { key: marker.id, color: marker.color, look: markerLook(marker.day, valueDay), sizePx: markerPx, className: "pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 ".concat(disabled ? 'opacity-50' : ''), style: { left: "".concat(percentOf(marker.day), "%") } })); };
8026
+ var hoverAnchorRef = React.useRef(null);
8027
+ var _c = React.useState(null), hovered = _c[0], setHovered = _c[1];
8028
+ // True while a mouse button or finger is down. Only then does a change snap.
8029
+ var isPressedRef = React.useRef(false);
8030
+ var pointerXRef = React.useRef(null);
8031
+ // The range input covers the diamonds, so find the one under the pointer by position.
8032
+ var markerAt = function (clientX) {
8033
+ var _a;
8034
+ var rect = (_a = trackRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
8035
+ if (!rect)
8036
+ return null;
8037
+ var x = clientX - rect.left;
8038
+ return markers.reduce(function (best, marker) {
8039
+ var distance = Math.abs((percentOf(marker.day) / 100) * rect.width - x);
8040
+ return distance < best.distance ? { marker: marker, distance: distance } : best;
8041
+ }, { marker: null, distance: markerHitPx }).marker;
8042
+ };
8043
+ var handlePointerDown = function (event) {
8044
+ if (event.button !== 0)
8045
+ return;
8046
+ isPressedRef.current = true;
8047
+ pointerXRef.current = event.clientX;
8048
+ var release = function () {
8049
+ isPressedRef.current = false;
8050
+ };
8051
+ window.addEventListener('pointerup', release, { once: true });
8052
+ window.addEventListener('pointercancel', release, { once: true });
8053
+ // A press on a diamond picks its event right away. When the playhead is
8054
+ // already next to the diamond, the press often lands on the same day, and
8055
+ // the range input then fires no change event at all.
8056
+ var marker = markerAt(event.clientX);
8057
+ if (marker)
8058
+ goToDay(marker.day);
8059
+ };
8060
+ var handlePointerMove = function (event) {
8061
+ pointerXRef.current = event.clientX;
8062
+ setHovered(markerAt(event.clientX));
8063
+ };
8064
+ // A click or drag on a diamond picks the event's day, so the playhead sits in
8065
+ // its middle. Keys and screen readers still step one day at a time.
8066
+ var handleChange = function (event) {
8067
+ var snapped = isPressedRef.current && pointerXRef.current !== null
8068
+ ? markerAt(pointerXRef.current)
8069
+ : null;
8070
+ goToDay(snapped ? snapped.day : minDay + Number(event.target.value));
8071
+ };
8072
+ // Handle keys ourselves so every browser moves the same number of days.
8073
+ var handleKeyDown = function (event) {
8074
+ var target;
8075
+ if (event.key === 'Home')
8076
+ target = minDay;
8077
+ else if (event.key === 'End')
8078
+ target = maxDay;
8079
+ else if (event.key in KEY_STEPS)
8080
+ target = valueDay + KEY_STEPS[event.key];
8081
+ if (target === undefined)
8082
+ return;
8083
+ event.preventDefault();
8084
+ goToDay(target);
8085
+ };
8086
+ return (React.createElement("div", { ref: trackRef, className: "relative h-6 ".concat(className), onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onPointerLeave: function () { return setHovered(null); } },
8087
+ React.createElement("div", { "aria-hidden": "true", className: "absolute inset-x-0 top-1/2 h-[2px] -translate-y-1/2 rounded-full bg-bia-grey" }),
8088
+ React.createElement("div", { "aria-hidden": "true", className: "absolute left-0 top-1/2 h-[2px] -translate-y-1/2 rounded-full ".concat(trackFillConfig[state]), style: { width: "".concat(valuePercent, "%") } }),
8089
+ markers.map(renderMarker),
8090
+ React.createElement("input", { type: "range", min: 0, max: totalDays - 1, step: 1, value: valueDay - minDay, disabled: disabled, "aria-label": sliderLabel || DEFAULT_SLIDER_LABEL, "aria-valuetext": dateLabel, onChange: handleChange, onKeyDown: handleKeyDown, className: "peer absolute inset-0 z-10 m-0 size-full cursor-pointer appearance-none bg-transparent opacity-0 disabled:cursor-not-allowed [&::-moz-range-thumb]:h-6 [&::-moz-range-thumb]:w-[2px] [&::-moz-range-thumb]:border-0 [&::-webkit-slider-thumb]:h-6 [&::-webkit-slider-thumb]:w-[2px] [&::-webkit-slider-thumb]:appearance-none" }),
8091
+ React.createElement("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-y-0 w-[2px] -translate-x-1/2 rounded-full peer-focus-visible:outline peer-focus-visible:outline-[3px] peer-focus-visible:outline-offset-2 peer-focus-visible:outline-bia-blue-light-50 ".concat(playheadConfig[state]), style: { left: "".concat(valuePercent, "%") } }),
8092
+ hovered && (React.createElement(React.Fragment, null,
8093
+ React.createElement("span", { ref: hoverAnchorRef, "aria-hidden": "true", className: "pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2", style: {
8094
+ left: "".concat(percentOf(hovered.day), "%"),
8095
+ width: markerPx,
8096
+ height: markerPx,
8097
+ } }),
8098
+ React.createElement(HintBubble, { anchorRef: hoverAnchorRef, text: markerText(hovered) })))));
8099
+ }
8100
+
8101
+ var NO_EVENTS$1 = [];
8102
+ /** Centered on its day; at an end of the track, aligned to that end. */
8103
+ var tickAlignConfig = {
8104
+ start: 'translate-x-0',
8105
+ center: '-translate-x-1/2',
8106
+ end: '-translate-x-full',
8107
+ };
8108
+ /** Icon class of a button that cannot move, so the icon turns grey with the label. */
8109
+ var iconClass = function (isInactive) { return (isInactive ? inactiveIconClass : ''); };
8110
+ /**
8111
+ * variant="default" (136px): date and "Day N of Total", event badge, track,
8112
+ * axis labels and bianic Buttons (default-outlined, sm). Internal only.
8113
+ */
8114
+ function DefaultLayout(_a) {
8115
+ var value = _a.value, startDate = _a.startDate, endDate = _a.endDate, _b = _a.events, events = _b === void 0 ? NO_EVENTS$1 : _b, _c = _a.onChange, onChange = _c === void 0 ? undefined : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.sliderLabel, sliderLabel = _e === void 0 ? DEFAULT_SLIDER_LABEL : _e, _f = _a.noEventLabel, noEventLabel = _f === void 0 ? DEFAULT_NO_EVENT_LABEL : _f, _g = _a.axisUnit, axisUnit = _g === void 0 ? 'auto' : _g, _h = _a.className, className = _h === void 0 ? '' : _h, rest = __rest(_a, ["value", "startDate", "endDate", "events", "onChange", "disabled", "sliderLabel", "noEventLabel", "axisUnit", "className"]);
8116
+ var timeline = useTimeline({
8117
+ value: value,
8118
+ startDate: startDate,
8119
+ endDate: endDate,
8120
+ events: events,
8121
+ onChange: onChange,
8122
+ disabled: disabled,
8123
+ axisUnit: axisUnit,
8124
+ });
8125
+ var valueDay = timeline.valueDay, totalDays = timeline.totalDays, dayOfPeriod = timeline.dayOfPeriod, dateLabel = timeline.dateLabel, percentOf = timeline.percentOf, ticks = timeline.ticks, hasEvents = timeline.hasEvents, currentEvent = timeline.currentEvent, previousEvent = timeline.previousEvent, nextEvent = timeline.nextEvent, hasPreviousDay = timeline.hasPreviousDay, hasNextDay = timeline.hasNextDay, goToDay = timeline.goToDay;
8126
+ // Empty period, or a day without an event. An empty noEventLabel shows nothing.
8127
+ var statusText = hasEvents ? noEventLabel : NO_EVENTS_TEXT;
8128
+ var axisRef = React.useRef(null);
8129
+ var axisWidth = useElementWidth(axisRef);
8130
+ var visibleTicks = fitTicks(ticks, axisWidth, percentOf, AXIS_CHAR_PX);
8131
+ var noPreviousEvent = disabled || !previousEvent;
8132
+ var noPreviousDay = disabled || !hasPreviousDay;
8133
+ var noNextDay = disabled || !hasNextDay;
8134
+ var noNextEvent = disabled || !nextEvent;
8135
+ return (React.createElement("div", __assign({ className: "bianic-timeline-slider flex w-full flex-col ".concat(className) }, rest),
8136
+ React.createElement("div", { className: "flex min-h-10 items-start justify-between gap-4" },
8137
+ React.createElement("div", { className: "flex shrink-0 flex-col gap-[3px]" },
8138
+ React.createElement(Text, { variant: "normal-text-semibold" }, dateLabel),
8139
+ React.createElement(Text, { variant: "small-text", className: mutedTextClass },
8140
+ "Day ",
8141
+ dayOfPeriod,
8142
+ " of ",
8143
+ totalDays)),
8144
+ (currentEvent || statusText !== '') && (React.createElement(InfoPanel, { variant: "form", size: "md", color: "white",
8145
+ // REVISI: the badge is 36px tall (InfoPanel form md is 40px):
8146
+ // 16px text line + 2 x 9px padding + 2 x 1px border.
8147
+ className: "!min-h-[36px] min-w-0 max-w-[50%] !py-[9px]" }, currentEvent ? (React.createElement(EventName, { marker: currentEvent })) : (React.createElement(TruncatedText, { text: statusText, textClassName: mutedTextClass }))))),
8148
+ React.createElement(Track, { className: "mt-[10px]", timeline: timeline, sliderLabel: sliderLabel, disabled: disabled }),
8149
+ React.createElement("div", { ref: axisRef, "aria-hidden": "true", className: "relative mt-[2px] h-4" }, visibleTicks.map(function (tick) { return (React.createElement("span", { key: tick.key, className: "absolute top-0 flex h-4 items-center whitespace-nowrap ".concat(tickAlignConfig[tick.align]), style: { left: "".concat(percentOf(tick.day), "%") } },
8150
+ React.createElement(Text, { variant: "tiny-text", className: "".concat(mutedTextClass, " ").concat(axisLabelClass) }, tick.label))); })),
8151
+ React.createElement("div", { className: "mt-[14px] flex items-center justify-between gap-[5px]" },
8152
+ React.createElement("div", { className: "flex gap-[5px]" },
8153
+ React.createElement(Button, { variant: "default-outlined", size: "sm", className: stepButtonClass, label: "Previous Event", iconLeft: React.createElement(TbChevronLeftPipe, { "aria-hidden": "true", className: iconClass(noPreviousEvent) }), disabled: noPreviousEvent, onClick: function () { return previousEvent && goToDay(previousEvent.day); } }),
8154
+ React.createElement(Button, { variant: "default-outlined", size: "sm", className: stepButtonClass, label: "Day", "aria-label": "Previous day", iconLeft: React.createElement(TbChevronLeft, { "aria-hidden": "true", className: iconClass(noPreviousDay) }), disabled: noPreviousDay, onClick: function () { return goToDay(valueDay - 1); } })),
8155
+ React.createElement("div", { className: "flex gap-[5px]" },
8156
+ React.createElement(Button, { variant: "default-outlined", size: "sm", className: stepButtonClass, label: "Day", "aria-label": "Next day", iconRight: React.createElement(TbChevronRight, { "aria-hidden": "true", className: iconClass(noNextDay) }), disabled: noNextDay, onClick: function () { return goToDay(valueDay + 1); } }),
8157
+ React.createElement(Button, { variant: "default-outlined", size: "sm", className: stepButtonClass, label: "Next Event", iconRight: React.createElement(TbChevronRightPipe, { "aria-hidden": "true", className: iconClass(noNextEvent) }), disabled: noNextEvent, onClick: function () { return nextEvent && goToDay(nextEvent.day); } })))));
8158
+ }
8159
+
8160
+ var NO_EVENTS = [];
8161
+ /**
8162
+ * variant="lite" (32px): one row with icon buttons (bianic Button,
8163
+ * default-outlined, sm), date and event status, track and day count. Internal only.
8164
+ */
8165
+ function LiteLayout(_a) {
8166
+ var value = _a.value, startDate = _a.startDate, endDate = _a.endDate, _b = _a.events, events = _b === void 0 ? NO_EVENTS : _b, _c = _a.onChange, onChange = _c === void 0 ? undefined : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.sliderLabel, sliderLabel = _e === void 0 ? DEFAULT_SLIDER_LABEL : _e, _f = _a.noEventLabel, noEventLabel = _f === void 0 ? DEFAULT_NO_EVENT_LABEL : _f, _g = _a.className, className = _g === void 0 ? '' : _g, rest = __rest(_a, ["value", "startDate", "endDate", "events", "onChange", "disabled", "sliderLabel", "noEventLabel", "className"]);
8167
+ var timeline = useTimeline({
8168
+ value: value,
8169
+ startDate: startDate,
8170
+ endDate: endDate,
8171
+ events: events,
8172
+ onChange: onChange,
8173
+ disabled: disabled,
8174
+ });
8175
+ var valueDay = timeline.valueDay, totalDays = timeline.totalDays, dayOfPeriod = timeline.dayOfPeriod, dateLabel = timeline.dateLabel, hasEvents = timeline.hasEvents, currentEvent = timeline.currentEvent, previousEvent = timeline.previousEvent, nextEvent = timeline.nextEvent, hasPreviousDay = timeline.hasPreviousDay, hasNextDay = timeline.hasNextDay, goToDay = timeline.goToDay;
8176
+ // Empty period, or a day without an event. An empty noEventLabel shows nothing.
8177
+ var statusText = hasEvents ? noEventLabel : NO_EVENTS_TEXT;
8178
+ var year = fromDayNumber(valueDay).getFullYear();
8179
+ return (React.createElement("div", __assign({ className: "bianic-timeline-slider flex h-8 w-full items-center ".concat(className) }, rest),
8180
+ React.createElement("div", { className: "flex shrink-0 gap-[5px]" },
8181
+ React.createElement(HintButton, { hint: LITE_BUTTON_LABELS.previousEvent, icon: React.createElement(TbChevronLeftPipe, { "aria-hidden": "true" }), isUnavailable: !previousEvent, disabled: disabled, onPress: function () { return previousEvent && goToDay(previousEvent.day); } }),
8182
+ React.createElement(HintButton, { hint: LITE_BUTTON_LABELS.previousDay, icon: React.createElement(TbChevronLeft, { "aria-hidden": "true" }), isUnavailable: !hasPreviousDay, disabled: disabled, onPress: function () { return goToDay(valueDay - 1); } })),
8183
+ React.createElement("div", { className: "ml-5 flex max-w-[200px] shrink-0 flex-col gap-px" },
8184
+ React.createElement("div", { className: "grid grid-cols-[minmax(0,1fr)] grid-rows-[14px] font-segoe text-size-sm tabular-nums" },
8185
+ React.createElement("span", { "aria-hidden": "true", className: "invisible col-start-1 row-start-1 whitespace-nowrap" },
8186
+ React.createElement(Text, { variant: "small-text-semibold" },
8187
+ React.createElement("span", { className: "inline-grid" }, WEEKDAYS.map(function (weekday) { return (React.createElement("span", { key: weekday, className: "col-start-1 row-start-1" }, weekday)); })),
8188
+ ", 28",
8189
+ ' ',
8190
+ React.createElement("span", { className: "inline-grid" }, MONTHS.map(function (month) { return (React.createElement("span", { key: month, className: "col-start-1 row-start-1" }, month)); })),
8191
+ ' ',
8192
+ year)),
8193
+ React.createElement("span", { className: "col-start-1 row-start-1 whitespace-nowrap" },
8194
+ React.createElement(Text, { variant: "small-text-semibold" }, dateLabel))),
8195
+ React.createElement("div", { className: "flex h-4 w-0 min-w-full items-center" },
8196
+ currentEvent && React.createElement(EventName, { marker: currentEvent, textSize: "tiny" }),
8197
+ !currentEvent && statusText && (React.createElement(TruncatedText, { text: statusText, textSize: "tiny", textClassName: mutedTextClass })))),
8198
+ React.createElement(Track, { className: "mx-5 min-w-[80px] flex-1", timeline: timeline, sliderLabel: sliderLabel, disabled: disabled }),
8199
+ React.createElement("div", { className: "mr-5 flex shrink-0 flex-col items-end gap-[2px]" },
8200
+ React.createElement(Text, { variant: "tiny-text", className: "".concat(mutedTextClass, " leading-4") }, "Day"),
8201
+ React.createElement("span", { className: "grid grid-rows-[14px] whitespace-nowrap font-segoe text-size-sm tabular-nums" },
8202
+ React.createElement("span", { "aria-hidden": "true", className: "invisible col-start-1 row-start-1" },
8203
+ React.createElement(Text, { variant: "small-text-semibold" }, totalDays),
8204
+ ' ',
8205
+ React.createElement(Text, { variant: "small-text-semibold" },
8206
+ "/ ",
8207
+ totalDays)),
8208
+ React.createElement("span", { className: "col-start-1 row-start-1 text-right" },
8209
+ React.createElement(Text, { variant: "small-text-semibold" }, dayOfPeriod),
8210
+ ' ',
8211
+ React.createElement(Text, { variant: "small-text-semibold", className: mutedTextClass },
8212
+ "/ ",
8213
+ totalDays)))),
8214
+ React.createElement("div", { className: "flex shrink-0 gap-[5px]" },
8215
+ React.createElement(HintButton, { hint: LITE_BUTTON_LABELS.nextDay, icon: React.createElement(TbChevronRight, { "aria-hidden": "true" }), isUnavailable: !hasNextDay, disabled: disabled, onPress: function () { return goToDay(valueDay + 1); } }),
8216
+ React.createElement(HintButton, { hint: LITE_BUTTON_LABELS.nextEvent, icon: React.createElement(TbChevronRightPipe, { "aria-hidden": "true" }), isUnavailable: !nextEvent, disabled: disabled, onPress: function () { return nextEvent && goToDay(nextEvent.day); } }))));
8217
+ }
8218
+
8219
+ var VARIANT_UNION$1 = ['default', 'lite'];
8220
+ var AXIS_UNIT_UNION = [
8221
+ 'auto',
8222
+ 'day',
8223
+ 'week',
8224
+ 'month',
8225
+ 'quarter',
8226
+ 'year',
8227
+ ];
8228
+ function TimelineSlider(props) {
8229
+ var variant = props.variant, axisUnit = props.axisUnit, rest = __rest(props, ["variant", "axisUnit"]);
8230
+ switch (validUnion(variant, VARIANT_UNION$1)) {
8231
+ case 'lite':
8232
+ return React.createElement(LiteLayout, __assign({}, rest));
8233
+ default:
8234
+ return (React.createElement(DefaultLayout, __assign({}, rest, { axisUnit: validUnion(axisUnit, AXIS_UNIT_UNION) })));
8235
+ }
8236
+ }
8237
+
7501
8238
  var colorConfigs = {
7502
8239
  default: 'bg-bia-black',
7503
8240
  info: 'bg-bia-teal',
@@ -11612,6 +12349,7 @@ exports.TagLabelInput = TagLabelInput;
11612
12349
  exports.Text = Text;
11613
12350
  exports.TextArea = TextArea;
11614
12351
  exports.TextInput = TextInput;
12352
+ exports.TimelineSlider = TimelineSlider;
11615
12353
  exports.Toaster = Toaster;
11616
12354
  exports.Toggle = Toggle;
11617
12355
  exports.Tooltip = Tooltip;