cetec-design-system 3.5.0-0 → 3.5.1-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.
- package/dist/index.js +329 -111
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18338,6 +18338,52 @@ const hasMatchingItems = (children, filterContext) => {
|
|
|
18338
18338
|
return true;
|
|
18339
18339
|
});
|
|
18340
18340
|
};
|
|
18341
|
+
const findSubMenuKeyPath = (children, target, trail = []) => {
|
|
18342
|
+
for (const childNode of Children.toArray(children)) {
|
|
18343
|
+
if (!isValidElement(childNode)) {
|
|
18344
|
+
continue;
|
|
18345
|
+
}
|
|
18346
|
+
const child = childNode;
|
|
18347
|
+
const componentType = getComponentType(child);
|
|
18348
|
+
const nextTrail = [...trail, String(child.key)];
|
|
18349
|
+
if (componentType === MENU_COMPONENT_TYPES.subMenu) {
|
|
18350
|
+
if (child.props.children === target) {
|
|
18351
|
+
return nextTrail;
|
|
18352
|
+
}
|
|
18353
|
+
const nested = findSubMenuKeyPath(
|
|
18354
|
+
child.props.children,
|
|
18355
|
+
target,
|
|
18356
|
+
nextTrail
|
|
18357
|
+
);
|
|
18358
|
+
if (nested) {
|
|
18359
|
+
return nested;
|
|
18360
|
+
}
|
|
18361
|
+
} else if (componentType === MENU_COMPONENT_TYPES.group) {
|
|
18362
|
+
const nested = findSubMenuKeyPath(
|
|
18363
|
+
child.props.children,
|
|
18364
|
+
target,
|
|
18365
|
+
nextTrail
|
|
18366
|
+
);
|
|
18367
|
+
if (nested) {
|
|
18368
|
+
return nested;
|
|
18369
|
+
}
|
|
18370
|
+
}
|
|
18371
|
+
}
|
|
18372
|
+
return null;
|
|
18373
|
+
};
|
|
18374
|
+
const findSubMenuChildren = (children, keyPath) => {
|
|
18375
|
+
const [key, ...rest] = keyPath;
|
|
18376
|
+
if (key === void 0) {
|
|
18377
|
+
return children;
|
|
18378
|
+
}
|
|
18379
|
+
const match = Children.toArray(children).find(
|
|
18380
|
+
(childNode) => isValidElement(childNode) && String(childNode.key) === key
|
|
18381
|
+
);
|
|
18382
|
+
if (!match) {
|
|
18383
|
+
return void 0;
|
|
18384
|
+
}
|
|
18385
|
+
return findSubMenuChildren(match.props.children, rest);
|
|
18386
|
+
};
|
|
18341
18387
|
const getHighlightedTextParts = (value, query) => {
|
|
18342
18388
|
if (!query.trim()) {
|
|
18343
18389
|
return [{ text: value, match: false }];
|
|
@@ -18402,6 +18448,8 @@ function navigateListMainAxisLoop(listRef, direction, previousIndex) {
|
|
|
18402
18448
|
}
|
|
18403
18449
|
return previousIndex ?? null;
|
|
18404
18450
|
}
|
|
18451
|
+
const focusableInLevelSelector = 'input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),a[href],[tabindex]:not([tabindex="-1"])';
|
|
18452
|
+
const isTextEntryTarget = (target) => target instanceof HTMLElement && (target.isContentEditable || target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement || target instanceof HTMLInputElement && !["button", "checkbox", "submit", "reset"].includes(target.type));
|
|
18405
18453
|
const defaultGetItemText = ({
|
|
18406
18454
|
label: label2,
|
|
18407
18455
|
description
|
|
@@ -18509,6 +18557,7 @@ const Menu = (props) => {
|
|
|
18509
18557
|
}
|
|
18510
18558
|
onOpenChange == null ? void 0 : onOpenChange(nextOpen);
|
|
18511
18559
|
};
|
|
18560
|
+
const diginFocusIntentRef = useRef(null);
|
|
18512
18561
|
const [diginLevels, setDiginLevels] = useState([]);
|
|
18513
18562
|
const [wrapperSize, setWrapperSize] = useState({
|
|
18514
18563
|
width: null,
|
|
@@ -18551,7 +18600,10 @@ const Menu = (props) => {
|
|
|
18551
18600
|
const focus = useFocus(floating.context, {
|
|
18552
18601
|
enabled: hasReference && triggerInteraction === "focus"
|
|
18553
18602
|
});
|
|
18554
|
-
const dismiss = useDismiss(floating.context, {
|
|
18603
|
+
const dismiss = useDismiss(floating.context, {
|
|
18604
|
+
enabled: hasReference,
|
|
18605
|
+
escapeKey: diginDepth === 0
|
|
18606
|
+
});
|
|
18555
18607
|
const role = useRole(floating.context, { role: "menu" });
|
|
18556
18608
|
const listNavigation = useListNavigation(floating.context, {
|
|
18557
18609
|
listRef,
|
|
@@ -18577,7 +18629,11 @@ const Menu = (props) => {
|
|
|
18577
18629
|
}),
|
|
18578
18630
|
[filterMode, getItemText, highlightMatches, query]
|
|
18579
18631
|
);
|
|
18580
|
-
const
|
|
18632
|
+
const liveDiginLevels = diginLevels.map((level) => ({
|
|
18633
|
+
...level,
|
|
18634
|
+
children: (level.path && findSubMenuChildren(children, level.path)) ?? level.children
|
|
18635
|
+
}));
|
|
18636
|
+
const activeLevelChildren = ((_a = liveDiginLevels[liveDiginLevels.length - 1]) == null ? void 0 : _a.children) ?? children;
|
|
18581
18637
|
const hasVisibleResults = hasMatchingItems(
|
|
18582
18638
|
activeLevelChildren,
|
|
18583
18639
|
filterContextValue
|
|
@@ -18593,6 +18649,8 @@ const Menu = (props) => {
|
|
|
18593
18649
|
setDiginLevels([]);
|
|
18594
18650
|
},
|
|
18595
18651
|
onPushDiginLevel: (title, levelChildren) => {
|
|
18652
|
+
const returnIndex = activeIndex;
|
|
18653
|
+
diginFocusIntentRef.current = "first";
|
|
18596
18654
|
setDiginLevels((prev) => {
|
|
18597
18655
|
const activeLevel2 = prev[prev.length - 1];
|
|
18598
18656
|
if (activeLevel2 && activeLevel2.title === title && activeLevel2.children === levelChildren) {
|
|
@@ -18603,29 +18661,169 @@ const Menu = (props) => {
|
|
|
18603
18661
|
{
|
|
18604
18662
|
key: `${title}-${prev.length}`,
|
|
18605
18663
|
title,
|
|
18606
|
-
children: levelChildren
|
|
18664
|
+
children: levelChildren,
|
|
18665
|
+
returnIndex,
|
|
18666
|
+
path: findSubMenuKeyPath(children, levelChildren)
|
|
18607
18667
|
}
|
|
18608
18668
|
];
|
|
18609
18669
|
});
|
|
18610
18670
|
},
|
|
18611
18671
|
onPopDiginLevel: () => {
|
|
18672
|
+
const poppedLevel = diginLevels[diginLevels.length - 1];
|
|
18673
|
+
if (!poppedLevel) {
|
|
18674
|
+
return;
|
|
18675
|
+
}
|
|
18676
|
+
diginFocusIntentRef.current = { index: poppedLevel.returnIndex };
|
|
18612
18677
|
setDiginLevels((prev) => prev.slice(0, -1));
|
|
18613
18678
|
},
|
|
18614
18679
|
diginDepth,
|
|
18615
18680
|
onMenubarEdgeNavigate
|
|
18616
18681
|
};
|
|
18682
|
+
useEffect(() => {
|
|
18683
|
+
const intent = diginFocusIntentRef.current;
|
|
18684
|
+
if (!intent) {
|
|
18685
|
+
return;
|
|
18686
|
+
}
|
|
18687
|
+
diginFocusIntentRef.current = null;
|
|
18688
|
+
setActiveIndex(null);
|
|
18689
|
+
let timer;
|
|
18690
|
+
const focusLevel = (attemptsLeft) => {
|
|
18691
|
+
var _a2;
|
|
18692
|
+
const levelElement = activeLevelRef.current;
|
|
18693
|
+
const index2 = intent === "first" ? findFirstEnabledListIndex(listRef) : intent.index;
|
|
18694
|
+
const item = index2 === null ? null : listRef.current[index2];
|
|
18695
|
+
if (item && item.isConnected && (levelElement == null ? void 0 : levelElement.contains(item)) && !item.hasAttribute("disabled")) {
|
|
18696
|
+
item.focus({ preventScroll: true });
|
|
18697
|
+
(_a2 = item.scrollIntoView) == null ? void 0 : _a2.call(item, { block: "nearest" });
|
|
18698
|
+
setActiveIndex(index2);
|
|
18699
|
+
return;
|
|
18700
|
+
}
|
|
18701
|
+
if (attemptsLeft > 0) {
|
|
18702
|
+
timer = setTimeout(() => focusLevel(attemptsLeft - 1), 16);
|
|
18703
|
+
return;
|
|
18704
|
+
}
|
|
18705
|
+
const focusables = Array.from(
|
|
18706
|
+
(levelElement == null ? void 0 : levelElement.querySelectorAll(focusableInLevelSelector)) ?? []
|
|
18707
|
+
);
|
|
18708
|
+
const fallback = focusables.find((element) => !element.matches("[data-menu-back]")) ?? focusables[0];
|
|
18709
|
+
fallback == null ? void 0 : fallback.focus({ preventScroll: true });
|
|
18710
|
+
};
|
|
18711
|
+
timer = setTimeout(() => focusLevel(3), 0);
|
|
18712
|
+
return () => {
|
|
18713
|
+
clearTimeout(timer);
|
|
18714
|
+
};
|
|
18715
|
+
}, [diginDepth]);
|
|
18716
|
+
const keepsFocusOnTrigger = Boolean(onMenubarEdgeNavigate) || triggerInteraction === "focus";
|
|
18717
|
+
useEffect(() => {
|
|
18718
|
+
if (!hasReference || !isOpen || activeIndex === null || keepsFocusOnTrigger) {
|
|
18719
|
+
return;
|
|
18720
|
+
}
|
|
18721
|
+
const timer = setTimeout(() => {
|
|
18722
|
+
const referenceElement = floating.elements.domReference;
|
|
18723
|
+
const floatingElement = floating.elements.floating;
|
|
18724
|
+
const activeElement2 = document.activeElement;
|
|
18725
|
+
const focusIsStranded = Boolean(referenceElement) && (activeElement2 === referenceElement || activeElement2 === document.body);
|
|
18726
|
+
const item = listRef.current[activeIndex];
|
|
18727
|
+
if (focusIsStranded && (item == null ? void 0 : item.isConnected) && (floatingElement == null ? void 0 : floatingElement.contains(item))) {
|
|
18728
|
+
item.focus({ preventScroll: true });
|
|
18729
|
+
}
|
|
18730
|
+
}, 50);
|
|
18731
|
+
return () => {
|
|
18732
|
+
clearTimeout(timer);
|
|
18733
|
+
};
|
|
18734
|
+
}, [
|
|
18735
|
+
activeIndex,
|
|
18736
|
+
floating.elements.domReference,
|
|
18737
|
+
floating.elements.floating,
|
|
18738
|
+
hasReference,
|
|
18739
|
+
isOpen,
|
|
18740
|
+
keepsFocusOnTrigger
|
|
18741
|
+
]);
|
|
18742
|
+
const isComposingRef = useRef(false);
|
|
18743
|
+
useEffect(() => {
|
|
18744
|
+
let compositionTimeout;
|
|
18745
|
+
const handleCompositionStart = () => {
|
|
18746
|
+
clearTimeout(compositionTimeout);
|
|
18747
|
+
isComposingRef.current = true;
|
|
18748
|
+
};
|
|
18749
|
+
const handleCompositionEnd = () => {
|
|
18750
|
+
compositionTimeout = setTimeout(() => {
|
|
18751
|
+
isComposingRef.current = false;
|
|
18752
|
+
}, 5);
|
|
18753
|
+
};
|
|
18754
|
+
document.addEventListener("compositionstart", handleCompositionStart);
|
|
18755
|
+
document.addEventListener("compositionend", handleCompositionEnd);
|
|
18756
|
+
return () => {
|
|
18757
|
+
clearTimeout(compositionTimeout);
|
|
18758
|
+
document.removeEventListener("compositionstart", handleCompositionStart);
|
|
18759
|
+
document.removeEventListener("compositionend", handleCompositionEnd);
|
|
18760
|
+
};
|
|
18761
|
+
}, []);
|
|
18762
|
+
useEffect(() => {
|
|
18763
|
+
if (diginDepth === 0) {
|
|
18764
|
+
return;
|
|
18765
|
+
}
|
|
18766
|
+
const handleEscape = (event) => {
|
|
18767
|
+
if (event.key !== "Escape" || event.defaultPrevented || event.isComposing || isComposingRef.current) {
|
|
18768
|
+
return;
|
|
18769
|
+
}
|
|
18770
|
+
const activeElement2 = document.activeElement;
|
|
18771
|
+
const referenceElement = floating.elements.domReference;
|
|
18772
|
+
const floatingElement = floating.elements.floating;
|
|
18773
|
+
const focusIsInMenu = hasReference && activeElement2 === document.body || Boolean(floatingElement == null ? void 0 : floatingElement.contains(activeElement2)) || Boolean(referenceElement == null ? void 0 : referenceElement.contains(activeElement2));
|
|
18774
|
+
if (!focusIsInMenu) {
|
|
18775
|
+
return;
|
|
18776
|
+
}
|
|
18777
|
+
event.preventDefault();
|
|
18778
|
+
event.stopPropagation();
|
|
18779
|
+
rootContextValue.onPopDiginLevel();
|
|
18780
|
+
};
|
|
18781
|
+
document.addEventListener("keydown", handleEscape);
|
|
18782
|
+
return () => {
|
|
18783
|
+
document.removeEventListener("keydown", handleEscape);
|
|
18784
|
+
};
|
|
18785
|
+
});
|
|
18786
|
+
const handleLevelsKeyDown = (event) => {
|
|
18787
|
+
if (event.key !== "Escape" && event.key !== "Tab" && isTextEntryTarget(event.target)) {
|
|
18788
|
+
event.stopPropagation();
|
|
18789
|
+
}
|
|
18790
|
+
};
|
|
18791
|
+
const handleDiginKeyDown = (event) => {
|
|
18792
|
+
if (diginDepth > 0 && event.key === "ArrowLeft" && !event.defaultPrevented) {
|
|
18793
|
+
event.preventDefault();
|
|
18794
|
+
event.stopPropagation();
|
|
18795
|
+
rootContextValue.onPopDiginLevel();
|
|
18796
|
+
}
|
|
18797
|
+
};
|
|
18617
18798
|
const navigateMainAxis = useCallback((direction) => {
|
|
18618
18799
|
setActiveIndex(
|
|
18619
18800
|
(prev) => navigateListMainAxisLoop(listRef, direction, prev)
|
|
18620
18801
|
);
|
|
18621
18802
|
}, []);
|
|
18803
|
+
const [firstEnabledIndex, setFirstEnabledIndex] = useState(
|
|
18804
|
+
null
|
|
18805
|
+
);
|
|
18806
|
+
useEffect(() => {
|
|
18807
|
+
let cancelled = false;
|
|
18808
|
+
queueMicrotask(() => {
|
|
18809
|
+
if (cancelled) {
|
|
18810
|
+
return;
|
|
18811
|
+
}
|
|
18812
|
+
const next = findFirstEnabledListIndex(listRef);
|
|
18813
|
+
setFirstEnabledIndex((previous) => previous === next ? previous : next);
|
|
18814
|
+
});
|
|
18815
|
+
return () => {
|
|
18816
|
+
cancelled = true;
|
|
18817
|
+
};
|
|
18818
|
+
});
|
|
18622
18819
|
const menuListContextValue = {
|
|
18623
18820
|
activeIndex,
|
|
18821
|
+
tabbableIndex: activeIndex ?? firstEnabledIndex,
|
|
18624
18822
|
getItemProps: (userProps) => getItemProps(userProps),
|
|
18625
18823
|
navigateMainAxis,
|
|
18626
18824
|
nestedMenuDepth: 0
|
|
18627
18825
|
};
|
|
18628
|
-
const levels = [{ key: "root", title: "Menu", children }, ...
|
|
18826
|
+
const levels = [{ key: "root", title: "Menu", children }, ...liveDiginLevels];
|
|
18629
18827
|
const activeLevel = levels[Math.min(diginDepth, levels.length - 1)];
|
|
18630
18828
|
const levelCount = levels.length;
|
|
18631
18829
|
const trackWidthPercent = levelCount * 100;
|
|
@@ -18691,6 +18889,10 @@ const Menu = (props) => {
|
|
|
18691
18889
|
isMenuVisible,
|
|
18692
18890
|
shouldUseDiginSizing
|
|
18693
18891
|
]);
|
|
18892
|
+
useLayoutEffect(() => {
|
|
18893
|
+
var _a2;
|
|
18894
|
+
(_a2 = sizeProbeRef.current) == null ? void 0 : _a2.querySelectorAll("[id]").forEach((element) => element.removeAttribute("id"));
|
|
18895
|
+
});
|
|
18694
18896
|
const diginWrapperStyle = shouldUseDiginSizing && wrapperSize.width && wrapperSize.height ? {
|
|
18695
18897
|
width: `${wrapperSize.width}px`,
|
|
18696
18898
|
height: `${wrapperSize.height}px`
|
|
@@ -18707,120 +18909,130 @@ const Menu = (props) => {
|
|
|
18707
18909
|
...dsComponent("Menu"),
|
|
18708
18910
|
ref: floating.refs.setFloating,
|
|
18709
18911
|
className: cx(classes.wrapper, className),
|
|
18710
|
-
...getFloatingProps(),
|
|
18912
|
+
...getFloatingProps({ onKeyDown: handleDiginKeyDown }),
|
|
18711
18913
|
...otherProps,
|
|
18712
18914
|
style: floatingStyle,
|
|
18713
18915
|
children: [
|
|
18714
18916
|
!hasVisibleResults && /* @__PURE__ */ jsx(Box, { className: classes.noResults, children: renderNoResults ?? /* @__PURE__ */ jsx(Text, { textStyle: "body.sm", children: "No results found" }) }),
|
|
18715
|
-
hasVisibleResults && /* @__PURE__ */ jsxs(
|
|
18716
|
-
|
|
18717
|
-
|
|
18718
|
-
|
|
18719
|
-
|
|
18720
|
-
|
|
18721
|
-
|
|
18722
|
-
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
|
|
18726
|
-
|
|
18727
|
-
|
|
18728
|
-
|
|
18729
|
-
|
|
18730
|
-
|
|
18731
|
-
/* @__PURE__ */ jsx(Icon, { name: "caret-left", fill: "icon" }),
|
|
18732
|
-
activeLevel.title
|
|
18733
|
-
]
|
|
18734
|
-
}
|
|
18735
|
-
),
|
|
18736
|
-
/* @__PURE__ */ jsx(Box, { className: listClassName, children: withLevelScopedKeys(
|
|
18737
|
-
activeLevel.children,
|
|
18738
|
-
`${activeLevel.key}-probe`
|
|
18739
|
-
) })
|
|
18740
|
-
] })
|
|
18741
|
-
}
|
|
18742
|
-
),
|
|
18743
|
-
/* @__PURE__ */ jsx(
|
|
18744
|
-
Box,
|
|
18745
|
-
{
|
|
18746
|
-
className: classes.levelsTrack,
|
|
18747
|
-
style: {
|
|
18748
|
-
width: `${trackWidthPercent}%`,
|
|
18749
|
-
transform: `translateX(-${trackTranslatePercent}%)`
|
|
18750
|
-
},
|
|
18751
|
-
children: levels.map((level, index2) => {
|
|
18752
|
-
const isActiveLevel = index2 === diginDepth;
|
|
18753
|
-
const levelChildren = withLevelScopedKeys(
|
|
18754
|
-
level.children,
|
|
18755
|
-
level.key
|
|
18756
|
-
);
|
|
18757
|
-
if (!isActiveLevel) {
|
|
18758
|
-
return /* @__PURE__ */ jsxs(
|
|
18759
|
-
Box,
|
|
18760
|
-
{
|
|
18761
|
-
className: classes.level,
|
|
18762
|
-
style: {
|
|
18763
|
-
flex: `0 0 ${levelWidthPercent}%`
|
|
18764
|
-
},
|
|
18765
|
-
"aria-hidden": true,
|
|
18766
|
-
children: [
|
|
18767
|
-
index2 > 0 && /* @__PURE__ */ jsxs(
|
|
18768
|
-
Box,
|
|
18769
|
-
{
|
|
18770
|
-
as: "button",
|
|
18771
|
-
type: "button",
|
|
18772
|
-
className: classes.backHeader,
|
|
18773
|
-
onClick: rootContextValue.onPopDiginLevel,
|
|
18774
|
-
children: [
|
|
18775
|
-
/* @__PURE__ */ jsx(Icon, { name: "caret-left" }),
|
|
18776
|
-
level.title
|
|
18777
|
-
]
|
|
18778
|
-
}
|
|
18779
|
-
),
|
|
18780
|
-
/* @__PURE__ */ jsx(Box, { className: listClassName, children: levelChildren })
|
|
18781
|
-
]
|
|
18782
|
-
},
|
|
18783
|
-
level.key
|
|
18784
|
-
);
|
|
18785
|
-
}
|
|
18786
|
-
return /* @__PURE__ */ jsx(
|
|
18787
|
-
MenuListProvider,
|
|
18788
|
-
{
|
|
18789
|
-
value: menuListContextValue,
|
|
18790
|
-
children: /* @__PURE__ */ jsx(FloatingList, { elementsRef: listRef, labelsRef, children: /* @__PURE__ */ jsxs(
|
|
18917
|
+
hasVisibleResults && /* @__PURE__ */ jsxs(
|
|
18918
|
+
Box,
|
|
18919
|
+
{
|
|
18920
|
+
className: classes.levelsViewport,
|
|
18921
|
+
onKeyDown: handleLevelsKeyDown,
|
|
18922
|
+
children: [
|
|
18923
|
+
shouldUseDiginSizing && /* @__PURE__ */ jsx(
|
|
18924
|
+
Box,
|
|
18925
|
+
{
|
|
18926
|
+
ref: sizeProbeRef,
|
|
18927
|
+
className: classes.sizeProbe,
|
|
18928
|
+
"aria-hidden": true,
|
|
18929
|
+
inert: true,
|
|
18930
|
+
style: diginSizeProbeStyle,
|
|
18931
|
+
children: /* @__PURE__ */ jsxs(Box, { className: classes.level, children: [
|
|
18932
|
+
diginDepth > 0 && /* @__PURE__ */ jsxs(
|
|
18791
18933
|
Box,
|
|
18792
18934
|
{
|
|
18793
|
-
|
|
18794
|
-
|
|
18795
|
-
|
|
18796
|
-
flex: `0 0 ${levelWidthPercent}%`
|
|
18797
|
-
},
|
|
18935
|
+
as: "button",
|
|
18936
|
+
type: "button",
|
|
18937
|
+
className: classes.backHeader,
|
|
18798
18938
|
children: [
|
|
18799
|
-
|
|
18800
|
-
|
|
18801
|
-
{
|
|
18802
|
-
as: "button",
|
|
18803
|
-
type: "button",
|
|
18804
|
-
ref: activeBackHeaderRef,
|
|
18805
|
-
className: classes.backHeader,
|
|
18806
|
-
onClick: rootContextValue.onPopDiginLevel,
|
|
18807
|
-
children: [
|
|
18808
|
-
/* @__PURE__ */ jsx(Icon, { name: "caret-left" }),
|
|
18809
|
-
level.title
|
|
18810
|
-
]
|
|
18811
|
-
}
|
|
18812
|
-
),
|
|
18813
|
-
/* @__PURE__ */ jsx(Box, { className: listClassName, children: levelChildren })
|
|
18939
|
+
/* @__PURE__ */ jsx(Icon, { name: "caret-left", fill: "icon" }),
|
|
18940
|
+
activeLevel.title
|
|
18814
18941
|
]
|
|
18815
18942
|
}
|
|
18943
|
+
),
|
|
18944
|
+
/* @__PURE__ */ jsx(Box, { className: listClassName, children: withLevelScopedKeys(
|
|
18945
|
+
activeLevel.children,
|
|
18946
|
+
`${activeLevel.key}-probe`
|
|
18816
18947
|
) })
|
|
18948
|
+
] })
|
|
18949
|
+
}
|
|
18950
|
+
),
|
|
18951
|
+
/* @__PURE__ */ jsx(
|
|
18952
|
+
Box,
|
|
18953
|
+
{
|
|
18954
|
+
className: classes.levelsTrack,
|
|
18955
|
+
style: {
|
|
18956
|
+
width: `${trackWidthPercent}%`,
|
|
18957
|
+
transform: `translateX(-${trackTranslatePercent}%)`
|
|
18817
18958
|
},
|
|
18818
|
-
level
|
|
18819
|
-
|
|
18820
|
-
|
|
18821
|
-
|
|
18822
|
-
|
|
18823
|
-
|
|
18959
|
+
children: levels.map((level, index2) => {
|
|
18960
|
+
const isActiveLevel = index2 === diginDepth;
|
|
18961
|
+
const levelChildren = withLevelScopedKeys(
|
|
18962
|
+
level.children,
|
|
18963
|
+
level.key
|
|
18964
|
+
);
|
|
18965
|
+
if (!isActiveLevel) {
|
|
18966
|
+
return /* @__PURE__ */ jsxs(
|
|
18967
|
+
Box,
|
|
18968
|
+
{
|
|
18969
|
+
className: classes.level,
|
|
18970
|
+
style: {
|
|
18971
|
+
flex: `0 0 ${levelWidthPercent}%`
|
|
18972
|
+
},
|
|
18973
|
+
"aria-hidden": true,
|
|
18974
|
+
inert: true,
|
|
18975
|
+
children: [
|
|
18976
|
+
index2 > 0 && /* @__PURE__ */ jsxs(
|
|
18977
|
+
Box,
|
|
18978
|
+
{
|
|
18979
|
+
as: "button",
|
|
18980
|
+
type: "button",
|
|
18981
|
+
className: classes.backHeader,
|
|
18982
|
+
onClick: rootContextValue.onPopDiginLevel,
|
|
18983
|
+
children: [
|
|
18984
|
+
/* @__PURE__ */ jsx(Icon, { name: "caret-left" }),
|
|
18985
|
+
level.title
|
|
18986
|
+
]
|
|
18987
|
+
}
|
|
18988
|
+
),
|
|
18989
|
+
/* @__PURE__ */ jsx(Box, { className: listClassName, children: levelChildren })
|
|
18990
|
+
]
|
|
18991
|
+
},
|
|
18992
|
+
level.key
|
|
18993
|
+
);
|
|
18994
|
+
}
|
|
18995
|
+
return /* @__PURE__ */ jsx(
|
|
18996
|
+
MenuListProvider,
|
|
18997
|
+
{
|
|
18998
|
+
value: menuListContextValue,
|
|
18999
|
+
children: /* @__PURE__ */ jsx(FloatingList, { elementsRef: listRef, labelsRef, children: /* @__PURE__ */ jsxs(
|
|
19000
|
+
Box,
|
|
19001
|
+
{
|
|
19002
|
+
ref: activeLevelRef,
|
|
19003
|
+
className: classes.level,
|
|
19004
|
+
style: {
|
|
19005
|
+
flex: `0 0 ${levelWidthPercent}%`
|
|
19006
|
+
},
|
|
19007
|
+
children: [
|
|
19008
|
+
index2 > 0 && /* @__PURE__ */ jsxs(
|
|
19009
|
+
Box,
|
|
19010
|
+
{
|
|
19011
|
+
as: "button",
|
|
19012
|
+
type: "button",
|
|
19013
|
+
ref: activeBackHeaderRef,
|
|
19014
|
+
"data-menu-back": "",
|
|
19015
|
+
className: classes.backHeader,
|
|
19016
|
+
onClick: rootContextValue.onPopDiginLevel,
|
|
19017
|
+
children: [
|
|
19018
|
+
/* @__PURE__ */ jsx(Icon, { name: "caret-left" }),
|
|
19019
|
+
level.title
|
|
19020
|
+
]
|
|
19021
|
+
}
|
|
19022
|
+
),
|
|
19023
|
+
/* @__PURE__ */ jsx(Box, { className: listClassName, children: levelChildren })
|
|
19024
|
+
]
|
|
19025
|
+
}
|
|
19026
|
+
) })
|
|
19027
|
+
},
|
|
19028
|
+
level.key
|
|
19029
|
+
);
|
|
19030
|
+
})
|
|
19031
|
+
}
|
|
19032
|
+
)
|
|
19033
|
+
]
|
|
19034
|
+
}
|
|
19035
|
+
)
|
|
18824
19036
|
]
|
|
18825
19037
|
}
|
|
18826
19038
|
) }) });
|
|
@@ -19143,6 +19355,12 @@ const MenuItem = (props) => {
|
|
|
19143
19355
|
};
|
|
19144
19356
|
const { onKeyDown: itemOnKeyDown, ...itemPropsRest } = itemProps;
|
|
19145
19357
|
const handleItemKeyDown = (event) => {
|
|
19358
|
+
if (event.key === "ArrowLeft" && rootContext.diginDepth > 0 && ((listContext == null ? void 0 : listContext.nestedMenuDepth) ?? 0) === 0) {
|
|
19359
|
+
event.preventDefault();
|
|
19360
|
+
event.stopPropagation();
|
|
19361
|
+
rootContext.onPopDiginLevel();
|
|
19362
|
+
return;
|
|
19363
|
+
}
|
|
19146
19364
|
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
|
19147
19365
|
if (href) {
|
|
19148
19366
|
itemOnKeyDown == null ? void 0 : itemOnKeyDown(event);
|
|
@@ -19204,7 +19422,7 @@ const MenuItem = (props) => {
|
|
|
19204
19422
|
"data-selected": selected,
|
|
19205
19423
|
"data-disabled": disabled,
|
|
19206
19424
|
"data-active": listContext ? listContext.activeIndex === listItemData.index : false,
|
|
19207
|
-
tabIndex: listContext ? listContext.activeIndex === listItemData.index ? 0 : -1 : 0,
|
|
19425
|
+
tabIndex: listContext ? (listContext.tabbableIndex ?? listContext.activeIndex) === listItemData.index ? 0 : -1 : 0,
|
|
19208
19426
|
...itemPropsRest,
|
|
19209
19427
|
onKeyDown: handleItemKeyDown,
|
|
19210
19428
|
...restProps,
|
|
@@ -19444,7 +19662,7 @@ const SubMenu = (props) => {
|
|
|
19444
19662
|
return true;
|
|
19445
19663
|
};
|
|
19446
19664
|
if (!applyFirst()) {
|
|
19447
|
-
|
|
19665
|
+
setTimeout(() => {
|
|
19448
19666
|
if (!applyFirst()) {
|
|
19449
19667
|
openedFromParentArrowRightRef.current = false;
|
|
19450
19668
|
}
|
|
@@ -19613,7 +19831,7 @@ const SubMenu = (props) => {
|
|
|
19613
19831
|
"data-selected": selected,
|
|
19614
19832
|
"data-disabled": disabled,
|
|
19615
19833
|
"data-active": parentListContext ? parentListContext.activeIndex === listItemData.index : false,
|
|
19616
|
-
tabIndex: parentListContext ? parentListContext.activeIndex === listItemData.index ? 0 : -1 : 0,
|
|
19834
|
+
tabIndex: parentListContext ? (parentListContext.tabbableIndex ?? parentListContext.activeIndex) === listItemData.index ? 0 : -1 : 0,
|
|
19617
19835
|
...diginButtonProps,
|
|
19618
19836
|
type: "button",
|
|
19619
19837
|
children: [
|
|
@@ -19674,7 +19892,7 @@ const SubMenu = (props) => {
|
|
|
19674
19892
|
"data-selected": selected,
|
|
19675
19893
|
"data-disabled": disabled,
|
|
19676
19894
|
"data-active": parentListContext ? parentListContext.activeIndex === listItemData.index : false,
|
|
19677
|
-
tabIndex: parentListContext ? parentListContext.activeIndex === listItemData.index ? 0 : -1 : 0,
|
|
19895
|
+
tabIndex: parentListContext ? (parentListContext.tabbableIndex ?? parentListContext.activeIndex) === listItemData.index ? 0 : -1 : 0,
|
|
19678
19896
|
...referencePropsWithoutRef,
|
|
19679
19897
|
type: "button",
|
|
19680
19898
|
children: [
|